首先,我創建了一個Java應用程序來測試我的代碼,以使用藍牙與NXT Brick聯繫。一旦這個工作,我創建了一個Web服務,而不是通過藍牙連接到NXT Brick。lejos noclassdeffounderror lejos/pc/comm/NXTComm
這是問題開始的地方。我的Web服務工作正常,我可以看到服務,我可以調用它們。 一項服務使用Lejos PC庫(lejos.pc.comm.NXTComm)中的NXTComm。我已經將這些庫添加到項目中,並添加了「import lejos.pc.comm。*;」在班級的頂部,但我仍然遇到以下錯誤。
[ERROR] lejos/pc/comm/NXTComm
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: lejos/pc/comm/NXTComm
at mindstorms.Connector.getBots(Connector.java:111)
at mindstorms.MindstormService.getBots(MindstormService.java:30)
... 29 more
Caused by: java.lang.ClassNotFoundException: lejos.pc.comm.NXTComm
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
... 31 more
爲什麼服務不能到達這些庫,我應該怎麼做才能解決這個問題?
驗證類** lejos.pc.comm.NXTComm **在類路徑中運行時是否可用? – ManuPK
這是我得到,如果我輸出 System.out.println(「classpath =」+ System.getProperty(「java.class.path」)); classpath = D:\ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ bin \ bootstrap.jar; D:\ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ bin \ tomcat-juli.jar 因此,它不是那裏爲什麼沒有更多呢?你確定它應該在那裏? – hhoud