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)

my server.xml:

<!--

    configuration for dos-environments
    author Peter Romianowski (30/aug/2001)

-->

<Server port="8005" shutdown="SHUTDOWN" debug="0">

  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Tomcat-Standalone">

    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="8080" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="60000"/>

    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Standalone" defaultHost="localhost" debug="0">


      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared
globally -->

      <!-- Define the default virtual host -->
      <Host name="localhost" debug="0"
appBase="o:/coreg/projects/main/devenv/www" unpackWARs="true">

        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="o:/coreg/projects/main/devenv/logs"
prefix="localhost_access_log." suffix=".txt"
                 pattern="common"/>

        <Logger className="org.apache.catalina.logger.SystemOutLogger"
directory="o:/coreg/projects/main/devenv/logs"/>

        <!-- Tomcat Examples Context -->
        <Context path="" override="true" reloadable="false" cookies="false"
docBase="" debug="0" workDir="o:/coreg/projects/main/devenv/tomcat/work"/>
      </Host>

    </Engine>

  </Service>


</Server>


you are right: the error upon jsp-compilation disappeared (i did not recheck
after switching to tomcat 4b07 right after its release)

hope this helps (you to help me) - thanks again, i appreciate your work. as
i said i'm trying to build the testcase. perhaps i have to strip down my
application to gain the test case... but perhaps this is only a
configuration fault or there's a workaround... (for now the workaround is,
that i simply catch the error for i know that the second run works - i could
live with that if i am the only one struggling with this)...

sincerly,
pero



-----Ursprüngliche Nachricht-----
Von: Remy Maucherat [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 6. September 2001 03:59
An: [EMAIL PROTECTED]
Betreff: Re: LinkageError: duplicate Class definition


> hi there,
>
> I got a weird problem getting on here. I'm using tomcat 4b07 on both
win2000
> and linux.
> after startup I start some threads and when they execute for the first
time
> I get a LinkageError: duplicate Class definition.
> there are 4 things with this I dont understand:
> 1st: all classes are there exactly once. no jar is twice within the
> classpath (I checked that a dozen times)
> 2nd: the error occurs only when the thread is executing for the very first
> time. after each execution I wait some amount of time (Thread.sleep) and
> when the code which crashed before is re-executed everything works fine.
> 3rd: the linkage error is not restricted to a particular package. if I
> remove the non working threads, then the linkage error comes back again at
> some other place/thread.
> 4th: sometimes (very rarely) the error does not occur, but after
restarting
> tomcat it is back again.
>
> i figured out that this is not nescessarely related to threads I start. if
i
> do not start any thread of my own, then the first jsp-execution (after
> compilation) brings up the error.

At least the JSP part is supposed to be fixed.
It's bug 3107 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3107), and
the attached test case (which looks like it would duplicate your problem) is
now working fine for me.

If it's still not working, would it be possible to pull together a test case
? Could I get the stack trace you get in your threaded app if pulling
together a test case isn't possible ?

> my configuration:
> 1 wep app (not war) with all required jars in WEB-INF/lib (which are
> deployed at startup)

Remy

Reply via email to