ok, i switched to today's nightly (20010906) but the error remains.
instead of bothering you again and again i downloaded the src (20010906) and
"fixed" the bug. (or at least make it disappear :-)
first i simply synchronized the complete method
(WebappClassLoader.findClassInternal) and that did the trick.
because of possible performance issues (dont know if there are some) i moved
the formally synchronized code to a separate synchronized method (and left
the findClassInternal unsynchronized).
but then the error reoccured (this time within the new method)... :-(
are there points for which the whole method must not be synchronized? if
not, i would synchronize it...
any other ideas?
as always - thanks dudes...
pero
-----Original Message-----
From: Remy Maucherat [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 06, 2001 5:05 PM
To: [EMAIL PROTECTED]
Subject: Re: LinkageError: duplicate Class definition
> ok, i try to develop a test case (and environment). but my first attempt
to
> reproduce the error in that testcase failed (even though it remains in my
> "real" application). here's a short doc on what's happening:
> 1. i start tomcat with tomcat/bin/catalina.sh -config myserver.xml - file
> follows
>
> tomcat startup message
>
> Using CLASSPATH:
>
c:/tools/java/tomcat4/bin/bootstrap.jar;c:\tools\java\jdk\1.3.1/lib/tools.ja
> r
> Using CATALINA_HOME: c:/tools/java/tomcat4
> Starting service Tomcat-Standalone
> Apache Tomcat/4.0-b7
> WebappLoader[]: Deploying class repositories to work directory
> o:\coreg\projects\main\devenv\tomcat\work
> WebappLoader[]: Deploy JAR /WEB-INF/lib/peroframework.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\peroframework
> .jar
> WebappLoader[]: Deploy JAR /WEB-INF/lib/coregmain.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\coregmain.jar
> WebappLoader[]: Deploy JAR /WEB-INF/lib/parser.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\parser.jar
> WebappLoader[]: Deploy JAR /WEB-INF/lib/ecs-1.4.1.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\ecs-1.4.1.jar
> WebappLoader[]: Deploy JAR /WEB-INF/lib/jaxp.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\jaxp.jar
> WebappLoader[]: Deploy JAR /WEB-INF/lib/mail.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\mail.jar
> WebappLoader[]: Deploy JAR /WEB-INF/lib/mysqljdbc202.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\mysqljdbc202.j
> ar
> WebappLoader[]: Deploy JAR /WEB-INF/lib/activation.jar to
> o:\coreg\projects\main\devenv\www\WEB-INF\lib\activation.jar
> StandardManager[]: Seeding random number generator class
> java.security.SecureRandom
> StandardManager[]: Seeding of random number generator has been completed
> StandardWrapper[:default]: Loading container servlet default
> default: init
> StandardWrapper[:invoker]: Loading container servlet invoker
> invoker: init
> StandardWrapper[:jsp]: Using Jasper classloader for servlet jsp
> jsp: init
> __coregapplication: init <--- THIS IS MY SERVLET
>
>
> 2. i've written a servlet which is executed on tomcat-startup (web.xml
> <load-on-startup>1000</...>)
> 3. within the init method i start some threads that are alive throughout
the
> whole server-lifetime
> 4. upon first execution there's the linkage-error
>
> trace:
>
> [Thu Sep 06 15:17:00 CEST 2001:
> coreg.mail.campaignuser.ReceiveDaemon.service]
> [[RecieveDaemon] unsubscribe] fatal exception
> java.lang.LinkageError: duplicate class definition:
> com/sun/mail/pop3/POP3Store
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
> at
>
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
> ader.java:1484)
> at
>
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
> a:851)
> at
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
> a:1230)
> at
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
> a:1113)
> at javax.mail.Session.getService(Session.java:587)
> at javax.mail.Session.getStore(Session.java:402)
> at javax.mail.Session.getStore(Session.java:364)
> at javax.mail.Session.getStore(Session.java:343)
> at pero.mail.Pop3Handler.connect(Pop3Handler.java:38)
> at
> coreg.mail.campaignuser.ReceiveDaemon.service(ReceiveDaemon.java:172)
> at pero.common.Deamon.run(Deamon.java:94)
This stacktrace shows you're not using the latest CVS version or nightly
(which syncs the call to defineClass and would probably solve the issue).
In the latest version, line 1484 of WebappClassLoader is:
-----> synchronized(this) {
clazz = defineClass(name, entry.binaryContent, 0,
entry.binaryContent.length, codeSource);
}
In the version before, it was the defineClass call.
So could you try again with the latest nightly ? Looking at the stack trace,
it really looks like the bug which was fixed.
Remy