Ok, I have removed all the setClasspath changes I did, and made sure that all
the 'common' JARs are under <tomcat_home>/lib. I ran my webapp and I
received the following exception:
SEVERE: Error deploying configuration descriptor MyWebApp.xml
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1094)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
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:525)
at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
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:578)
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:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Note:
1) (and as far as I know...) the javax/servlet/http/HttpServlet class is
located in servlet-api.jar, which located under under <tomcat_home>/lib. And
in the 'Class Loader HOW-TO' page it is written:
"Common - This class loader contains additional classes that are made
visible to both Tomcat internal classes and to all web applications." So, if
it is visible, so why I get the exception?
2) The file MyWebApp.xml is located at:
<tomcat_home>\conf\Catalina\localhost\MyWebApp.xml
Thanks,
M.
Pid-2 wrote:
>
> matyg wrote:
>> Yes, I know this page, but it is not understoodable from what is
>> described
>> how it should be done.
>> They write there "All such classes are visible to both Tomcat internal
>> classes, and to web applications".
>
> Classes placed inside a webapp should not be visible to the container.
> This is Servlet Spec stuff - otherwise there's little point in having a
> classloader hierarchy at all.
>
>
>> What I understand is that I need to add classes to the system class
>> loaded.
>> Where do I do that? where do I add them?
>
> You should add them to the server/shared classloader, which in 6.x means
> you just have to put them in a jar, in <tomcat_home>/lib.
> The JAAS docs indicate that any classes you use need to be in the same
> classloader as the module you're making.
>
>> But how come it worked fine in v6.0.14 and not in v6.0.18? What was
>> changed?
>
> Are you sure you haven't got the classes deployed in a jar in /lib?
> Even if you haven't what you're proposing is wrong and contrary to the
> way that applications are intended to operate.
>
> p
>
>
>> Konstantin Kolinko wrote:
>>> 2009/1/19 matyg <[email protected]>:
>>>> set
>>>> CLASSPATH=%CLASSPATH%;.;%CATALINA_HOME%\lib;%CATALINA_HOME%\lib\servlet-api.jar;%CATALINA_HOME%\lib\jsp-api.jar;%CATALINA_HOME%\lib\el-api.jar;%CATALINA_HOME%\webapps\webAppName;%CATALINA_HOME%\webapps\webAppName\WEB_INF\classes;%CATALINA_HOME%\webapps\webAppName\WEB_INF\lib;%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_HOME%\bin\commons-daemon.jar;
>>>>
>>> Do not mess with the CLASSPATH variable. That is not supported and you
>>> are severely breaking the classloader hierarchy. Thus are your
>>> problems.
>>>
>>> See
>>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>>>
>>> Best regards,
>>> Konstantin Kolinko
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Upgrading-Tomcat-from-6.0.14-to-6.0.18---classpath-issue-tp21541405p21558505.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]