Shared jars in apache-tomcat 6.0.20
Solution 1
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).
Solution 2
To add a bit more detail on this.
- The metro project uses the shared class loader to make it possible to expose libraries to all webapps that you deploy.
- The metro project uses the endorsed library mechanism of Tomcat to update your standard java distribution
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
- add the given library to java-home/lib/endorsed
- set the Tomcat command line parameter -Djava.endorsed.dirs
- use the default directory $CATALINA_HOME/endorsed; see /bin/setclasspath.sh or /bin/setclasspath.bat
- set system wide parameter JAVA_ENDORSED_DIRS
Solution 3
In Tomcat 6, the content of $CATALINA_HOME/lib
will be made available to the "Common" class loader (see http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html). The shared/lib
directory that Tomcat 5.5 used to have no long exist.
However, I'd like to know what jars you are trying to put there exactly as the case of JAX-WS (or Metro) is "special". Also, what JDK are you using?
Update: As I said, the case of Metro is a bit special. To install it, copy webservices-rt.jar, webservices-tools.jar, webservices-extra.jar, webservices-extra-api.jar in $CATALINA_HOME/lib
. But webservices-api.jar and jsr173_api.jar should go in $CATALINA_HOME/endorsed
. Actually, this is what the metro-on-tomcat.xml
ant script provided in the metro distribution does (and I would recommend to mimic it).
zbigh
Updated on June 04, 2022Comments
-
zbigh about 2 years
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.