I am working on a Java Dynamic Web Project in Eclipse. Everything was running smoothly until I realized that my package names were uppercase, and decided to change them.
After changing them, I am getting ClassNotFoundExceptions at runtime. The code compiles fine. From what I understand, this is a runtime classpath issue.
The error is shown here:
javax.servlet.ServletException: Error instantiating servlet class
Controllers.LoginServlet
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoClassDefFoundError: Model/Converter
db.UserHelper.(UserHelper.java:34)
Controllers.LoginServlet.(LoginServlet.java:36)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source) java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.ClassNotFoundException: Model.Converter
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
db.UserHelper.(UserHelper.java:34)
Controllers.LoginServlet.(LoginServlet.java:36)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source) java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
Here's a screenshot of my folder structure:
http://imgur.com/VJvJbeb
src/Controllers and src/Model were the packages I switched to lower case. I switched them back hoping to resolve the issue, but to no avail.
I tried checking my runtime classpath for the project by going to Run --> Run Configurations, but the project isn't listed there.
Here is a snapshot of my Web Deployment Assembly:
http://imgur.com/D0rg2aZ
Does anyone know how I might go about fixing this? Any help would be greatly appreciated.
Solution Found
Thanks for responses everyone. Thankfully I managed to fix the issue by:
Right clicking the project folder ---> Build Path ---> Configure Build Path
Navigating to Source tab
I saw that the default output folder was "WorkTicketSystem/build/classes." I switched this to "WorkTicketSystem/WebContent/WEB-INF/classes."
And, voila. I'm not exactly sure why or how my actions fixed the problem, but if anyone could explain I would be very interested to hear it. For now I am just happy that it runs.
In your web.xml, you have a reference to the class Model.Converter. You need to change this to model.Converter.
If we change the package name to uppercase we have to check whether all references with that package got modified or not. As you are saying that if you try to run package names with lower case is working fine. If you try to modify the package names with IDE that will ask for updating references also. Once check that.
NOTE: *As per java coding standards package names should be in lower case.*
Related
I know this is a duplicate question, but none of the other 15+ thread's answers helped, or i missed something.
I am trying to implement authentication using JDBC Realm in my JAX-WS java web app, and i can't even get past connecting to the db.
This is what i tried:
Adding the connector to the WEB-INF/lib dir in the app structure
Adding it to the build path
Adding it to the $CATALINA-HOME/lib of the server
Adding JRE, JDK, CATALINA_HOME paths to startap.bat
Cleaning the project
Deleting the contents of the temp folder
Enviromental variables:
User
System
Using:
apache-tomee-plus-1.7.4
jre1.8.0_161
jdk1.8.0_144
Actual trace:
Apr 13, 2018 9:07:49 PM org.apache.catalina.realm.JDBCRealm getPassword
SEVERE: Exception performing authentication
java.sql.SQLException: com.mysql.jdbc.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:692)
at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:544)
at org.apache.catalina.realm.RealmBase.getDigest(RealmBase.java:1266)
at org.apache.catalina.realm.RealmBase.authenticate(RealmBase.java:420)
at org.apache.catalina.realm.CombinedRealm.authenticate(CombinedRealm.java:111)
at org.apache.tomee.catalina.TomEERealm.authenticate(TomEERealm.java:55)
at org.apache.catalina.authenticator.DigestAuthenticator$DigestInfo.authenticate(DigestAuthenticator.java:708)
at org.apache.catalina.authenticator.DigestAuthenticator.authenticate(DigestAuthenticator.java:275)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:577)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:688)
... 20 more
As ashamed as i am, I have to admit that i used a wrong version of tomEE i had on my PC, that wasn't even connected to eclipse, but i was sure it was the right one, until i checked the actual path from eclipse.
Anyway, as JDBC Realm goes, as many other threads' answers suggested, the DBMS connector .jar needs to be in the servers lib directory ($CATALINA-HOME/lib).
I´m trying to consume a Jersey Rest Service from a Web Application (Dynamic Web App in eclispe) as follows:
Client client = ClientBuilder.newBuilder().build(); // Here is the error
WebTarget target = client.target("url/rest").path("List");
String result = target.request(MediaType.TEXT_PLAIN).get(String.class);
When debugging in the line ClientBuilder.newBuilder() the system throws the ClassNotFoundException: javax.ws.rs.client.ClientBuilder error, but the same code, in a java project works perfect.
Full trace:
javax.servlet.ServletException: Error instanciando clase de servlet test
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
causa raíz
java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder
test.<init>(test.java:27)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
causa raíz
java.lang.ClassNotFoundException: javax.ws.rs.client.ClientBuilder
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1324)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177)
test.<init>(test.java:27)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
So here it comes ;)
First for the understanding:
javax.ws.rs.client is the standard package for RESTFul client implementations. Developers should programm against this interface.
At runtime you need an implementation of this interface in your classpath. Thats where projects like resteasy or jersey comes in.
Second:
In eclipse the buildpath and classpath settings only efect the environment in eclipse. When you put something in there manualy, it exist only in eclipse.
Third:
When you developing a webapplication depending on the Java EE webprofile you have automaticly access to all bundled packages of your application server like tomcat or jboss.
If your application uses more packages you have to distribute them together with your application. To do this you can place your third party jars under "WEB-INF/libs" in your project. When it is deployed to your application server, jars inside this folder are automaticly placed in your classpath of your app.
Fourth (about your solution):
Putting third party libs in the application server lib or endorsed directy make them accessable to all applications deployed on this application server and adds more complexity into your app server setup and maintenance.
I followed the quick steps to configure DWR in my web application (http://directwebremoting.org/dwr/introduction/getting-started.html).
When the setup phase ends and I try to access my "localhost:8080/[myAppPath]/dwr/", a NumberFormatException is thrown:
javax.servlet.ServletException: java.lang.NumberFormatException: null
org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:77)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
org.directwebremoting.util.VersionUtil.loadProperties(VersionUtil.java:119)
org.directwebremoting.util.VersionUtil.getLabel(VersionUtil.java:99)
org.directwebremoting.impl.StartupUtil.logStartup(StartupUtil.java:157)
org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:62)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
I did just as the DWR Tutorials says and I've tried youtube tutorials, googling and even here on stackoverflow and the people who had the same problem didn't get answers.
Here's my servlet declaration on my web.xml:
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/dwr.xml</param-value>
</init-param>
</servlet>
And here's my dwr.xml:
<dwr>
<allow>
<create creator="static" javascript="DWRManager">
<param name="class" value="negocio.DWRManager"/>
</create>
</allow>
</dwr>
What could be causing this exception?
I have downloaded DWR 3.0 and put dwr.xml in the same folder as web.xml (WEB-INF)
org.directwebremoting.util.VersionUtil.loadProperties(VersionUtil.java:119)
it seems to be internal DWR bug in org.directwebremoting.util.VersionUtil class:
major = Integer.parseInt(props.getProperty(KEY_MAJOR));
cannot parse value in "dwr-version.properties" file for some reason.
try using latest stable version advertised on their website 2.0.10. it seems DWR 3 isn't really ready for widespread use yet.
I get the following error:
java.lang.ClassNotFoundException: org.springframework-web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1062)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4935)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5262)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5257)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I got these .jar's in my WEB-INF/lib directory
spring-beans-3.2.0.RELEASE.jar
spring-context-3.2.0.RELEASE.jar
spring-core-3.2.0.RELEASE.jar
spring-expression-3.2.0.RELEASE.jar
spring-webmvc-3.2.0.RELEASE.jar
spring-web-3.2.0.RELEASE.jar
What else do i need?
It should be org.springframework.web.servlet.DispatcherServlet without the dash in the package name. Just a typo in your web.xml maybe?
Factors which may cause the exception :
Jars are not added to the WEB-INF/lib directory
DispatcherServlet reference is not configured properly in web.xml
Can you upload the web.xml, project structure and verify the information above?
First I created a Java App to test my code to contact the NXT Brick using Bluetooth. Once this worked I created a Webservice instead which should connect to the NXT Brick through Bluetooth.
This is where the problems start. My Webservice works fine, I can see the services and I can invoke them.
One service uses NXTComm, which is in the Lejos PC Libraries (lejos.pc.comm.NXTComm). I've added these libraries to the project and I've added "import lejos.pc.comm.*;" at the top of the class but I still get the following error.
[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
Why can't the services get to these libraries and what should I do to fix this?
So what have you done in order to add the leJOS libraries to your web application? Why would you expect, that they are in the classpath?
It might work, if you but the JAR files from the folder lib/pc in your leJOS distribuion into the WEB-INF/lib folder of your web application. Alternatively, there is a directory for libraries that all web application can access. It must be located somewhere where Tomcat is located.
BTW: The system property java.class.path does not really return the paths that are searched for classes. If one is using classloaders (which tomcat does), the paths they search are not present in java.class.path.