Bug 36204 - Webapp unable to pick the Class by the shared classloader
Summary: Webapp unable to pick the Class by the shared classloader
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.12
Hardware: Other Windows XP
: P1 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-16 18:47 UTC by vibz
Modified: 2006-10-05 11:53 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vibz 2005-08-16 18:47:39 UTC
When tomcat is embedded in the application (run programmatically by Bootstrap 
init and start). The web application is unable to find the class inside a jar 
in the folder shared/lib.

e.g. activation.jar is placed inside the shared/lib but still the webapp says 
that NoClassDefFoundError
Comment 1 Yoav Shapira 2005-10-13 05:27:02 UTC
Please note 5.0.16 is an ancient release: does this still happen on 5.5.12?

Please attach two things: first, the stack trace of log snippet showing the
error you're encountering.  Second, the steps we can take to reproduce this bug.

I assume you're familiar with the difference between a ClassNotFoundException
and a NoClassDefFoundError, right?  The latter can arise for reasons that are
quite different from the former, e.g. clashing versions of a class on the classpath.
Comment 2 Arthur Herzog 2005-11-14 19:38:57 UTC
I have a similar problem. The error encounters when trying to acces a class 
inside a jar in the folder shared/lib.
I am using Tomcat 5.5.12 on a WindowsXP system. Tomcat is running as service.
Error stack:
SCHWERWIEGEND: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: net/sf/regain/crawler/document/RawDocument
	at de.herzog.frdkm.Inuus.init(Inuus.java:85)
	at org.apache.catalina.core.StandardWrapper.loadServlet
(StandardWrapper.java:1091)
	at org.apache.catalina.core.StandardWrapper.load
(StandardWrapper.java:925)
	at org.apache.catalina.core.StandardContext.loadOnStartup
(StandardContext.java:3880)
	at org.apache.catalina.core.StandardContext.start
(StandardContext.java:4141)
	at org.apache.catalina.core.ContainerBase.addChildInternal
(ContainerBase.java:759)
	at org.apache.catalina.core.ContainerBase.addChild
(ContainerBase.java:739)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
	at org.apache.catalina.startup.HostConfig.deployDescriptor
(HostConfig.java:603)
	at org.apache.catalina.startup.HostConfig.deployDescriptors
(HostConfig.java:535)
	at org.apache.catalina.startup.HostConfig.deployApps
(HostConfig.java:470)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent
(HostConfig.java:310)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
(LifecycleSupport.java:119)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
	at org.apache.catalina.core.StandardEngine.start
(StandardEngine.java:442)
	at org.apache.catalina.core.StandardService.start
(StandardService.java:450)
	at org.apache.catalina.core.StandardServer.start
(StandardServer.java:680)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:536)
	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:275)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Comment 3 Sergio Lissner 2005-12-28 13:16:12 UTC
I have this bug too.
My configuration
jre1.5.0_6
Tomcat 5.5.12
Windows XP

Temporary work around - move all jar files to common/lib dir
Comment 4 Sergio Lissner 2005-12-28 13:23:20 UTC
tracelog:

java.lang.NoClassDefFoundError: 
org/riverock/webmill/container/portlet/PortalInstance
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(Unknown Source)
	java.security.SecureClassLoader.defineClass(Unknown Source)
	org.apache.catalina.loader.WebappClassLoader.findClassInternal
(WebappClassLoader.java:1650)
	org.apache.catalina.loader.WebappClassLoader.findClass
(WebappClassLoader.java:856)
	org.apache.catalina.loader.WebappClassLoader.loadClass
(WebappClassLoader.java:1305)
	org.apache.catalina.loader.WebappClassLoader.loadClass
(WebappClassLoader.java:1187)
	java.lang.ClassLoader.loadClassInternal(Unknown Source)
	org.riverock.webmill.portlet.ContextNavigator.createNewPortalInsance
(ContextNavigator.java:107)
	org.riverock.webmill.portlet.ContextNavigator.doGet
(ContextNavigator.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.riverock.webmill.a3.audit.RequestStatisticFilter.doFilter
(RequestStatisticFilter.java:370)
Comment 5 Prabhu 2006-04-06 18:17:51 UTC
Can someone suggest me some workaround for this. not moving all jars to
common/lib. If having a different directory is supported, then it will be fine.
Comment 6 Yoav Shapira 2006-04-18 13:14:07 UTC
Prabhu: an alternative approach is to use another directory for your classloader
repository.  See conf/catalina.properties where you can configure virtually
arbitrary repository locations as common or shared.

Downgrading from critical.  Serge, can you please post the webapp (or a test
webapp that shows the error) you used in testing?
Comment 7 Sergio Lissner 2006-06-28 10:36:52 UTC
I just upgrade Tomcat to 5.5.17 and bug still exist
in previous my post I wrote was OS winXP, but real OS is Win2k

IMHO this bug exist because I'm using JRE, not JDK 
Comment 8 Sergio Lissner 2006-09-23 22:59:59 UTC
After rewrite my application from using commons-digester to JAXB 2.x, all 
classes from shared now loaded.

I think this bug related on using commons-logging.jar
I was use 
commons-logging-1.1.jar
commons-beanutils-1.7.0.jar
commons-digester-1.7.jar
commons-lang-2.1.jar

there files was used too:
commons-dbcp-1.2.1.jar
commons-pool-1.2.jar
Comment 9 Mark Thomas 2006-10-05 11:53:34 UTC
Glad you fixed it. Closing this as invalid since it was an app / 3rd party lib
issue rather than a Tomcat one.