Topic: 请教aglet高手 |
Print this page |
1.请教aglet高手 | Copy to clipboard |
Posted by: hly_gyx Posted on: 2005-07-20 11:38 从一个应用程序启动一个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) 哪位高手可指点一二。谢谢 |
2.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: liugongquan Posted on: 2005-08-26 20:17 朋友,这个程序没有main()方法,你是怎么运行的? |
3.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: icefiregll Posted on: 2005-09-17 08:34 不知仁兄的问题解决没有,不过一个明显的问题如楼上所说的没有main方法。这个aglet很头痛,资料太少了。我也有个问题向hly_gyx 兄请教,我是在一个java application中想要呼叫一个aglet并派遣之。程序的部分代码如下。 import com.ibm.aglet.*; import com.ibm.aglet.system.Aglets; import bookms.SuperAglet; public class AddInfo extends Panel implements ActionListener, ItemListener{ ..... try { AgletProxy proxy = Aglets.createAglet("atp://" + InetAddress.getLocalHost().getHostAddress(),null,"bookms.SuperAglet",null); ....... proxy = proxy.dispatch(new URL(dataLocation));} 省略了很多无关紧要的步骤,因为程序编译通过了。并且运行时是在try那儿出问题的。这个程序也没有main因为main在其他主程序里,这只是个界面而已。出现问题如下: java.lang.NoClassDefFoundError at com.ibm.aglet.system.Aglets.createAglet(Unknown Source) at AddInfo.actionPerformed(AddInfo.java:242) at java.awt.Button.processActionEvent(Unknown Source) at java.awt.Button.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 。该怎么解决是不是也要extends ContextAdapter 才行呀。急盼解决,对回复者万分感谢!!!! |
4.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: hly_gyx Posted on: 2005-09-17 19:48 你得creatAglet()方法是那个类里的? |
5.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: hly_gyx Posted on: 2005-09-17 19:50 icefiregll ,希望你能留下qq,我们探讨一下,因为我又遇到了新的问题呵呵 |
6.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: hly_gyx Posted on: 2005-09-17 19:55 icefiregll ,希望你能留下qq,我们探讨一下,因为我又遇到了新的问题呵呵 |
7.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: icefiregll Posted on: 2005-09-17 21:32 这么快就有回应了。我没有qq,很落伍吧,我经常用POPO,如果你也有泡泡号的话。我的泡泡帐号是icefireblood,用户名是inaid。你把邮箱留下吧。我的是 gonglinliln@126.com |
8.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: icefiregll Posted on: 2005-09-17 21:36 因为这个creatAglet()是一个静态方法,所以接用Aglets类来调用。应该没问题吧。 |
9.Re:请教aglet高手 [Re: hly_gyx] | Copy to clipboard |
Posted by: hly_gyx Posted on: 2005-09-18 20:33 我已经把你加到popo里面的,不过提示:你不允许我给你发消息。呵呵 我的邮箱是meatkitty@sina.com |
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 |