I'm pretty new to JWS.
I have a web application ( several web services ) that I want to deploy using tomcat 6.0.20 on a linux system.
Everything's ok if I generate a .war file with all used libraries inside and put it in the webapps directory, but I want to have these jars shared, and the .war file itself is way too big.
First I tried the intuitive way - I created a link ( WEB-INF/lib ) to the directory containing the jars, but strangely it fails to deploy ( it starts if the directory is not a link ):
SEVERE: Error configuring application listener of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3877)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
After that I created the $CATALINA_HOME/shared/lib directory, and moved the jars there ( I've deleted the WEB-INF/lib ) and it still displays the same error - it seems tomcat isn't looking for the jars anywhere else than the WEB-INF/lib directory. But on the other hand - why would creating a symbolic link make any difference?
My CATALINA_HOME and JRE_HOME vars seems to be right.
Tomcat JAR deployment options There are three recommended options to make this happen: Package the JAR file in the WEB-INF\lib folder of the Java web application; Place the JAR file in the \lib subfolder of the Apache Tomcat installation; Configure a folder for shared JAR files by editing Tomcat's common.
Apache Tomcat (or simply Tomcat) is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle, and provides a "pure Java" HTTP web server environment for Java code to run in.
A classpath is an argument that tells the JVM where to find the classes and packages necessary to run a program. The classpath is always set from a source outside the program itself.
Did you try putting the shared jar files in $CATALINA_HOME/lib? It says that ". Normally, application classes should NOT be placed here" but sounds like you would actually want to in your case.
The $CATALINA_HOME/shared/lib seems to be gone in 6.0 (it was there in 5.5).
To add a bit more detail on this.
Shared Class loader
Shared resources are shared across all web applications and not used by Tomcat internal classes.If Tomcat 6 requires a shared library. Adjust $CATALINA_HOME/conf/catalina.properties and set shared.loader=${catalina.home}/shared/lib/*.jar
Endorsed libraries
To update the java platform and incorporate a new version of a given library, included in the standard distribution, one can add the library to /lib/endorsed or set the system wide property java.endorsed.dirs If Tomcat 6 requires an endorsed library. Several strategies can be used to incorporate the required endorsed library
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With