Re: moding tomcat to be a proxy server

2003-06-24 Thread Peter Romianowski
Bill Ataras wrote:

LB ?
Load Balancing, I guess ;)

(it's early for me)

-Original Message-
From: Remy Maucherat [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 24, 2003 5:07 AM
To: Tomcat Developers List
Subject: Re: moding tomcat to be a proxy server

Bill Ataras wrote:

Google doesn't give me much. I've gotten good results in a few hours
so

far (I'm browsing with it now:) writing a valve that passes through
http

traffic using the host field and filtering some headers. Takes
advantage

of all the coyote connection/http11/thread stuff. Installs in
StandardEngine via server.xml config and doesn't pass the request to
invokeNext() so no need to config context/host etc.
I'm wondering if anyone has used tomcat in this way for real (beyond a
few hours of mucking around).


Personally, I would write the proxy as the Coyote adapter. That should 
faster as you can use reusable buffers instead of manipulating String 
objects. Your solution would work fine, though :)

Add in LB and a caching engine, and that's a feature we'd be very happy 
if you contributed :)

Remy

-
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]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: DO NOT REPLY [Bug 15315] New: - Error in catalina.sh for cygwin/XP

2002-12-12 Thread Peter Romianowski
This is fixed in 4.1.17 alpha.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, December 12, 2002 5:01 PM
 To: [EMAIL PROTECTED]
 Subject: DO NOT REPLY [Bug 15315] New: - Error in catalina.sh 
 for cygwin/XP
 
 
 DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
 RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT 
 http://nagoya.apache.org/bugzilla/show_bug.cg i?id=15315.
 
 ANY REPLY MADE TO THIS MESSAGE WILL NOT BE 
 COLLECTED AND 
 INSERTED IN THE BUG DATABASE.
 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15315

Error in catalina.sh for cygwin/XP

   Summary: Error in catalina.sh for cygwin/XP
   Product: Tomcat 4
   Version: 4.1.9
  Platform: PC
OS/Version: Windows XP
Status: NEW
  Severity: Normal
  Priority: Other
 Component: Unknown
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


When I tried deploying a JAR file in the WEB-INF/lib/ directory, I got an 
exception similar to that described in http://www.mail-archive.com/tomcat-
[EMAIL PROTECTED]/msg75929.html.

I found a solution: changing the catalina.sh script as follows worked for me:

102a103
   CATALINA_TMPDIR=`cygpath --path --windows $CATALINA_TMPDIR`

The problem was that the TMPDIR was specified in a Cygwin way, which did not 
work. All the other paths were changed to Windows-style, but I guess you 
forgot about the TMPDIR.

Note that I am actually on 4.1.12, but that version is not listed in Bugzilla, 
so I couldn't select that.

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Bug with Logger? (could be shorter...)

2002-12-03 Thread Peter Romianowski
  With 4.1.12 (4.0.x is ok) I experience a problem with logging.
There seems to be some strange buffering. I have a Servlet in
my webapp which does some initialisation. It prints progress 
information to STDOUT and error information
(exception.printStackTrace())
to STDERR. I have a System.exit call if something fails. (It is
really important for me that *nothing* is running in the case of
an initialisation-error). The problem is, that I never see my progress
information and no error-messages (if the System.exit part is reached). 
That makes finding the error *real* hard (it took me several hours 
yesterday to find that one of my XML-configuration files was not well 
formatted...).

  So the question is: Is there some buffering of output? BTW, if
everything works fine during init then the progress information is
shown *after* everything's done - so not really a progress
information.

  As said above, nothing of that kind happened with 4.0.x.

Peter
  


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: keystore alias and Tomcat

2002-11-25 Thread Peter Romianowski
AFAIK you can only have one certificate per keystore and
that has to have to alias tomcat.

Peter

 -Original Message-
 From: Naveen Pasumarthi [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, November 25, 2002 10:43 PM
 To: [EMAIL PROTECTED]
 Subject: Fwd: keystore alias and Tomcat
 
 
 
 any pointers would be helpful.
 
 thanks
 Original Message Follows
 From: Naveen Pasumarthi [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: keystore alias and Tomcat
 Date: Fri, 22 Nov 2002 20:29:20 +
 
 Hi All,
 
 If my keystore has two valid SSL certificates
 how does Tomcat figure out which one to use?
 
 I am still using Tomcat 3.x. Can I use
 an extra element in the Connector something like...
Parameter name=alias value=something /
 along with the other elements keystore, keypass
 etc
 
 
 thanks,
 naveen
 
 
 
 
 _
 Add photos to your messages with MSN 8. Get 2 months FREE*. 
 http://join.msn.com/?page=features/featuredemail
 
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 
 _
 The new MSN 8: advanced junk mail protection and 2 months FREE* 
 http://join.msn.com/?page=features/junkmail
 
 
 --
 To unsubscribe, e-mail:   
 mailto:tomcat-dev- [EMAIL PROTECTED]
 For 
 additional commands, 
 e-mail: mailto:[EMAIL PROTECTED]
 


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: [Jasper2] framework for tag optimization

2002-11-23 Thread Peter Romianowski
 If you think using it for JSTL is okay, why wouldn't it be 
 okay for other tag libraries? The same issues (if they are 
 issues) apply to JSTL, don't they?

  I thought of it beeing done by the jasper-crew, i.e. being
part of stock tomcat, so it could be assured that it is
working correct.

  The way I understand the proposal is that it *could* be some kind of
a replacement for a tag-library. So for conformity and interoperability
a programmer would have to implement the plugin *AND* the taghandler.
(And I extremely doubt that many will). 

 I was involved in a discussion about a precompile all JSPs in a 
webapp-functionality (which was wanted by *many* users). I was 
willing to contribute to it, but the developers (Craig himself, 
I think :) said that such a thing would not belong to a reference i
mplementation of a servlet-container. After he told me so, I agreed 
with him, although I still would like to have  this feature. :) So 
that was the reason why I posted my comments.

  As an application developer I would say: YES! Give me that plugin-
feature! since it would improve performance drastically. So, I like
the idea but I am not sure if such a thing would belong to stock
tomcat.


anyway,
Peter

  
 
 Hans
 
 -Original Message-
 From: Peter Lin [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, November 23, 2002 4:59 AM
 To: Tomcat Developers List; Kin-Man Chung
 Subject: Re: [Jasper2] framework for tag optimization
 
 
 
 hey kin-man,
  
 that sounds great!  I was actually thinking along those lines
 a while back, but thought it was impracticle because the 
 project I was working one didn't have enough time to explore 
 that approach.
  
 when I was doing performance analysis of jasper1 with jslt
 and saw how bad the performance was (due to the nested 
 try/catch bug), I went through and manually wrote scriplet 
 code to do the same exact logic. The performance compared to 
 jasper1 + jstl was tremendous. I had full mockups of a 3 
 pages written in JSTL and pure scriplet.
  
 If memory serves me correctly, the difference was 5-8x. the
 JSTL version using jasper1 would take 900-1000ms+ to display 
 15 results. The same exact page using scriplet took about 
 100-150ms. I would definitely be interested in spending time 
 on this and assisting. I may have some time opening up next 
 year, so I hope to start contributing actively :) cross my fingers.
  
 peter lin
  
  Kin-Man Chung [EMAIL PROTECTED] wrote:I am
 designing a framework in Jasper for enabling plugins that 
 work closely with Jasper to generate Java codes instead of 
 calls to tag handlers. The main idea is to take take JSTL 
 tags, such as
 
 
 ${i}
 
 
 and generates the Java codes
 
 for (int i = 0; i = 100; i++) { pageContext.setAttribute(i, 
 String.valueOf(i));
 out.print(evaluate(${i}));
 }
 
 or even
 
 for (int i = 0; i = 100; i++) {
 out.print(i);
 }
 
 The design is not to do the actual optimization in Jasper,
 but to provide a framework for taglib writers to develop 
 plugins to Jasper that will do the actual optimization. 
 Eventually, Jasper will be bundled with 1 or 2 plugins for 
 JSTL, as test cases for the framework and as examples for 
 writing the plugins.
 
 The plugins are specified in a xml file:
 
 
 
 the name of the tag class
 
 the name of the pkugin class
 
 
 
 
 There are currently 3 interfaces:
 
 TagPluginFactory
 Used for creating a TagPlugin.
 
 TagPlugin
 Created at code generation time for a specific tag
 invokation. Used by Jasper to generate java codes.
 
 TagPlugContext
 Created by Japser and used by the plugin to query properties
 of the current tag, and to use resources in Jasper.
 
 This work is at the very early stage of the design, and is
 purely experimental. I'll be checking in sources for this 
 work, and they should not affect the other part of Jasper, 
 when plugins are not turned on.
 
 I welcome comments and suggestions.
 
 
 --
 To unsubscribe, e-mail:
 For additional commands, e-mail: 
 
 
 
 -
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now
 
  
  
  
  --
  To unsubscribe, e-mail:   
 mailto:tomcat-dev- [EMAIL PROTECTED]
  For 
 additional commands, 
 e-mail: 
  mailto:[EMAIL PROTECTED]
  
 
 -- 
 Hans Bergsten[EMAIL PROTECTED]
 Gefion Software   http://www.gefionsoftware.com/
 Author of O'Reilly's JavaServer Pages, covering JSP 1.2 and JSTL 1.0
 Details athttp://TheJSPBook.com/
 
 
 --
 To unsubscribe, e-mail:   
 mailto:tomcat-dev- [EMAIL PROTECTED]
 For 
 additional commands, 
 e-mail: mailto:[EMAIL PROTECTED]
 


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




[PATCH] catalina.sh and cygwin

2002-10-14 Thread Peter Romianowski

Hi,

  I proposed this patch before without any notice. No problem at all,
you all seem very busy. But I got several people asking for help
regarding this issue, so I resend the patch.

  The problem is, that catalina.sh does not translate the
$CATALINA_TMPDIR
path to cygwin-path resulting tomcat in throwing these nasty
ContextConfig[] Exception processing JAR at resource path -
Exceptions.

  Here's a patch for that (against the 4.1.12 RELEASE)

--- catalina_orig.sh2002-09-23 11:23:00.0 +0200
+++ catalina.sh 2002-09-27 20:38:36.0 +0200
@@ -101,6 +101,7 @@
   CATALINA_HOME=`cygpath --path --windows $CATALINA_HOME`
   CATALINA_BASE=`cygpath --path --windows $CATALINA_BASE`
   CLASSPATH=`cygpath --path --windows $CLASSPATH`
+  CATALINA_TMPDIR=`cygpath --path --windows $CATALINA_TMPDIR`
   JSSE_HOME=`cygpath --path --windows $JSSE_HOME`
 fi

  I hope I did it the right way.

Peter


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




[PATCH] 4.1.12 catalina.sh for cygwin

2002-09-27 Thread Peter Romianowski

After 2 days of messing around with TC 4.1.12 on cygwin, I realized
that the catalina.sh is broken. It does not convert the $CATALINE_TMPDIR
environment-variable to a cygwin-path. This lead to these
javax.servlet.ServletException: Exception processing JAR at resource
path /WEB-INF/lib/some jar
exception, which lead me into the complete wrong direction :-)

Here's a patch for that (against the 4.1.12 RELEASE)

--- catalina_orig.sh2002-09-23 11:23:00.0 +0200
+++ catalina.sh 2002-09-27 20:38:36.0 +0200
@@ -101,6 +101,7 @@
   CATALINA_HOME=`cygpath --path --windows $CATALINA_HOME`
   CATALINA_BASE=`cygpath --path --windows $CATALINA_BASE`
   CLASSPATH=`cygpath --path --windows $CLASSPATH`
+  CATALINA_TMPDIR=`cygpath --path --windows $CATALINA_TMPDIR`
   JSSE_HOME=`cygpath --path --windows $JSSE_HOME`
 fi

I hope I did it the right way.

Peter


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2001-09-07 Thread Peter Romianowski

no, Peter tells you that it is WORKING! Yep.

thanks,
pero

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 07, 2001 3:23 AM
To: [EMAIL PROTECTED]
Subject: cvs commit:
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java


remm01/09/06 18:23:25

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Should make the classloading fully thread safe (apparently synchronizing
on
the defineClass is not enough).
  - The critical path of findResourceInternal or findClassInternal should
not be
synchronized for performance reasons, because it is called very often
(unlike
the call to defineClass which only happens once).
  - I assume Peter will tell me it still doesn't work (in which case I would
appreciate
a test case) ;-)

  Revision  ChangesPath
  1.14  +23 -9
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClass
Loader.java

  Index: WebappClassLoader.java
  ===
  RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/W
ebappClassLoader.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WebappClassLoader.java2001/08/28 18:12:37 1.13
  +++ WebappClassLoader.java2001/09/07 01:23:25 1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/W
ebappClassLoader.java,v 1.13 2001/08/28 18:12:37 remm Exp $
  - * $Revision: 1.13 $
  - * $Date: 2001/08/28 18:12:37 $
  + * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/W
ebappClassLoader.java,v 1.14 2001/09/07 01:23:25 remm Exp $
  + * $Revision: 1.14 $
  + * $Date: 2001/09/07 01:23:25 $
*
* 
*
  @@ -123,7 +123,7 @@
*
* @author Remy Maucherat
* @author Craig R. McClanahan
  - * @version $Revision: 1.13 $ $Date: 2001/08/28 18:12:37 $
  + * @version $Revision: 1.14 $ $Date: 2001/09/07 01:23:25 $
*/
   public class WebappClassLoader
   extends URLClassLoader
  @@ -1482,11 +1482,17 @@
   }

   synchronized(this) {
  -clazz = defineClass(name, entry.binaryContent, 0,
  -entry.binaryContent.length, codeSource);
  +// Since all threads use the same ResourceEntry instance, it
is
  +// the one which will contain the class
  +if (entry.loadedClass == null) {
  +clazz = defineClass(name, entry.binaryContent, 0,
  +entry.binaryContent.length,
codeSource);
  +entry.loadedClass = clazz;
  +} else {
  +clazz = entry.loadedClass;
  +}
   }

  -entry.loadedClass = clazz;

   return clazz;

  @@ -1635,8 +1641,16 @@
   entry.binaryContent = binaryContent;

   // Add the entry in the local resource repository
  -synchronized (resourceEntries) {
  -resourceEntries.put(name, entry);
  +synchronized (this) {
  +// Ensures that all the threads which may be in a race to
load
  +// a particular class all end up with the same ResourceEntry
  +// instance
  +ResourceEntry entry2 = (ResourceEntry)
resourceEntries.get(name);
  +if (entry2 == null) {
  +resourceEntries.put(name, entry);
  +} else {
  +entry = entry2;
  +}
   }

   return entry;







RE: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2001-09-07 Thread Peter Romianowski

yes, the solution looks like a great deal in both, performance and
stability,
enven though i found out that synchronizing the ResourceEntry entry is
enough. (at least it does not cause my good old error :-)
i think the concurrent access to the ResourceEntry-object is the point which
leads to the error.
(but i'm not sure if changing synchronized (this) to synchronized (entry)
will have any signficant positive impact on the performance...)

keep on the good work!
pero

-Original Message-
From: Remy Maucherat [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 07, 2001 7:19 PM
To: [EMAIL PROTECTED]
Subject: Re: cvs commit:
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java


 no, Peter tells you that it is WORKING! Yep.

Way COOL ! It's great, because it would have been bad to sync anywhere on
the critical path (since findResourceInternal is called quite often). The
updated code doesn't hurt performance in any significant way (it strenghtens
a bit one sync, and makes two more HashMaps lookups during the class
loading), so that's great news.

Remy




AW: LinkageError: duplicate Class definition

2001-09-06 Thread Peter Romianowski

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-startup1000/...)
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=6/

!-- 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

RE: LinkageError: duplicate Class definition

2001-09-06 Thread Peter Romianowski

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-startup1000/...)
 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 

LinkageError: duplicate Class definition

2001-09-05 Thread Peter Romianowski

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.

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

not btw but with full attention: tomcat rulez, man!

sincerly,
pero




AW: LinkageError: duplicate Class definition

2001-09-05 Thread Peter Romianowski

hi again,

i tried the nightly build 20010904 but nothing changed. tomorrow i will try
the latest build.

but thanks for your fast reply

pero

-Ursprungliche Nachricht-
Von: craigmcc@localhost [mailto:craigmcc@localhost]Im Auftrag von Craig
R. McClanahan
Gesendet: Mittwoch, 5. September 2001 20:38
An: Peter Romianowski
Cc: [EMAIL PROTECTED]
Betreff: Re: LinkageError: duplicate Class definition


There was a race condition in the web app class loader in 4.0-beta-7 that
could cause this.  Could you try it again with a recent nightly build.

NOTE:  Use the one from 20010906 (tonight) or 20010904 -- the one from
20010905 has a bug related to session cookies that I just fixed.

Craig


On Wed, 5 Sep 2001, Peter Romianowski wrote:

 Date: Wed, 5 Sep 2001 20:20:04 +0200
 From: Peter Romianowski [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: 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.

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

 not btw but with full attention: tomcat rulez, man!

 sincerly,
 pero