Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java EE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 请教aglet高手
hly_gyx





发贴: 15
积分: 0
于 2005-07-20 11:38 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
从一个应用程序启动一个aglet的时候,我编写的serverApp.java如下,import com.ibm.aglet.*;
import com.ibm.aglet.system.*;
import java.net.URL;

import java.util.Properties;
import com.ibm.awb.util.Resource;
import com.ibm.atp.daemon.Daemon;

public class ServerApp extends ContextAdapter {

public void agletCreated(ContextEvent ev) {
  System.out.println("Aglet Created : " + ev.getAgletProxy());
}
public void agletCloned(ContextEvent ev) {
  System.out.println("Aglet Cloned : " + ev.getAgletProxy());
}
public void agletArrived(ContextEvent ev) {
  System.out.println("Aglet Arrived : " + ev.getAgletProxy());
}
public void agletActivated(ContextEvent ev) {
  System.out.println("Aglet Activated : " + ev.getAgletProxy());
}

public void agletDisposed(ContextEvent ev) {
  System.out.println("Aglet Disposed : " + ev.getAgletProxy());
}
public void agletDispatched(ContextEvent ev) {
  System.out.println("Aglet Dispatched : " + ev.getAgletProxy());
}
public void agletDeactivated(ContextEvent ev) {
  System.out.println("Aglet Deactivated : " + ev.getAgletProxy());
}
public void agletReverted(ContextEvent ev) {
  System.out.println("Aglet Reverted : " + ev.getAgletProxy());
}

public void showMessage(ContextEvent ev) {
  System.out.println("message : " + ev.getMessage());
}
public static AgletProxy startAglet(AgletContext cxt,String AgletName) throws java.lang.Exception {
  
   AgletProxy p = cxt.createAglet(null,AgletName, null);
   return p;
   }  
public static AgletContext initStart() throws java.lang.Exception {

  Daemon daemon = Daemon.init(null);

  daemon.setAccessLogStream(System.out);
  daemon.setMessageLogStream(System.out);
  daemon.setErrorLogStream(System.err);

    AgletRuntime runtime = AgletRuntime.init(null);

    AgletContext cxt = runtime.createAgletContext("test");
  cxt.addContextListener(new ServerApp());

  // If you want to allow incoming aglets to use GUI.
  // initialize gui....
String initializerName=System.getProperty("aglets.logger.class","org.aglets.log.quietInitializer");
Class.forName(initializerName);
  try {
   Class.forName("sun.awt.image.JPEGImageDecoder");
   Class.forName("sun.audio.AudioPlayer");
  } catch (Exception ex) {
   ex.printStackTrace();
  }
  try {
   Class.forName("sun.awt.PlatformFont"); // for 1.1
  } catch (Exception ex) {
   ex.printStackTrace();
  }
  try {
   new java.awt.Frame().addNotify();
  } catch (Exception ex) {
   ex.printStackTrace();
  } finally {
  }

  try {
   Class.forName("sun.awt.ScreenUpdater");
  } catch (Throwable t) {
  }

    daemon.start("aglets");

    cxt.start();
  return cxt;

}
}

运行的时候会出现以下错误提示:
java.lang.NullPointerException
at ecmAglet.ServerApp.startAglet(ServerApp.java:69)
at ecmAglet.ecmLanQue.service(ecmLanQue.java:228)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at sun.servlet.http.HttpServerHandler.sendResponse(HttpServerHandler.jav
a:165)
at sun.servlet.http.HttpServerHandler.handleConnection(Compiled Code)
at sun.servlet.http.HttpServerHandler.run(HttpServerHandler.java:90)
at java.lang.Thread.run(Thread.java:472)
哪位高手可指点一二。谢谢




请求JAVA学习方向?????

话题树型展开
人气 标题 作者 字数 发贴时间
13901 请教aglet高手 hly_gyx 3288 2005-07-20 11:38
11808 Re:请教aglet高手 liugongquan 26 2005-08-26 20:17
11877 Re:请教aglet高手 icefiregll 1455 2005-09-17 08:34
11637 Re:请教aglet高手 hly_gyx 23 2005-09-17 19:48
11684 Re:请教aglet高手 hly_gyx 41 2005-09-17 19:50
11736 Re:请教aglet高手 hly_gyx 41 2005-09-17 19:55
11621 Re:请教aglet高手 icefiregll 102 2005-09-17 21:32
12222 Re:请教aglet高手 icefiregll 46 2005-09-17 21:36
13601 Re:请教aglet高手 hly_gyx 57 2005-09-18 20:33

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923