You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jon Stevens <jo...@latchkey.com> on 2001/06/22 20:23:57 UTC

[t4] again...classloader stuff...

on 6/21/01 7:13 PM, "Remy Maucherat" <re...@apache.org> wrote:

> If you're paranoid, you can do as I did and delete StandardLoader from your
> tree.
> 
> Remy

Or I can check out your recent fixes...

"  - Forgot to rename StandardClassLoader -> WebappClassLoader."

:-)

Ok...with the latest CVS update, now the .jar files are being copied over
and basic classreloading is working. Thank you for fixing things.

But when I log into Turbine and then try to cause a classreloader to reload,
I'm still getting this crash below and it causes the SESSION.ser file to be
left in the work directory which ends up screwing things up if I
quit/restart tomcat because it tries to read that file on startup and it is
invalid or corrupt or noclassdeffound...

I have started to trace the problem down and the weird thing is what is
happening is this:

In initializeBeanProp (see the stack trace below), there is a
Class.forName() call...it is getting the Class for various objects that are
passed into it. I put a System.out.println before the Class.forName() to see
what is happening...when things are working fine (ie: before a classloader
reload), it ends like this:

Everything is fine...

...
className: 'org.tigris.scarab.om.AttributeOption' propName: 'AttributeId'
className: 'org.tigris.scarab.om.AttributeOption' propName: 'AttributeId'
className: 'org.tigris.scarab.om.Attribute' propName: 'Deleted'
className: 'org.tigris.scarab.om.Attribute' propName: 'Deleted'
className: 'org.tigris.scarab.om.Attribute' propName: 'Description'
className: 'org.tigris.scarab.om.Attribute' propName: 'Description'
className: 'org.tigris.scarab.om.Attribute' propName: 'Name'
className: 'org.tigris.scarab.om.Attribute' propName: 'Name'
className: 'org.tigris.scarab.om.Attribute' propName: 'TypeId'
className: 'org.tigris.scarab.om.Attribute' propName: 'TypeId'
className: 'org.tigris.scarab.om.Attribute' propName: 'PrimaryKey'
className: 'org.tigris.scarab.om.Attribute' propName: 'PrimaryKey'

-----------------------------------------------------------------------

When I force a classloader reload...this gets output on the next request...

...
className: 'org.tigris.scarab.om.AttributeOption' propName: 'AttributeId'
className: 'org.tigris.scarab.om.AttributeOption' propName: 'AttributeId'
className: 'org.tigris.scarab.om.Attribute' propName: 'Deleted'
className: 'org.tigris.scarab.om.Attribute' propName: 'Deleted'

For some reason, it seems to stop at the 'Description' propName and throws
the exception shown below...

Note: I'm not sure it makes any difference, but the Scarab classes are
stored in WEB-INF/classes and the Turbine classes are in WEB-INF/lib.

Again, everything works fine as long as the classloader hasn't reloaded...

-jon



Horrible Exception: java.lang.NoClassDefFoundError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at 
org.apache.turbine.services.intake.TurbineIntakeService.initializeBeanProp(T
urbineIntakeService.java:224)
    at 
org.apache.turbine.services.intake.TurbineIntakeService.getFieldGetter(Turbi
neIntakeService.java:581)
    at 
org.apache.turbine.services.intake.TurbineIntake.getFieldGetter(TurbineIntak
e.java:235)
    at org.apache.turbine.services.intake.model.Field.<init>(Field.java:180)
    at 
org.apache.turbine.services.intake.model.BooleanField.<init>(BooleanField.ja
va:73)
    at 
org.apache.turbine.services.intake.model.FieldFactory$2.getInstance(FieldFac
tory.java:90)
    at 
org.apache.turbine.services.intake.model.FieldFactory.getInstance(FieldFacto
ry.java:154)
    at org.apache.turbine.services.intake.model.Group.<init>(Group.java:154)
    at 
org.apache.turbine.services.intake.TurbineIntakeService.getGroup(TurbineInta
keService.java:363)
    at 
org.apache.turbine.services.intake.TurbineIntake.getGroup(TurbineIntake.java
:85)
    at 
org.apache.turbine.services.intake.IntakeTool.init(IntakeTool.java:131)
    at 
org.apache.turbine.services.pull.TurbinePullService.populateWithRequestTools
(TurbinePullService.java:463)
    at 
org.apache.turbine.services.pull.TurbinePullService.populateContext(TurbineP
ullService.java:391)
    at 
org.apache.turbine.services.pull.TurbinePull.populateContext(TurbinePull.jav
a:145)
    at 
org.apache.turbine.services.velocity.TurbineVelocityService.getContext(Turbi
neVelocityService.java:221)
    at 
org.apache.turbine.services.velocity.TurbineVelocity.getContext(TurbineVeloc
ity.java:140)
    at 
org.apache.turbine.modules.pages.VelocityPage.doBuildBeforeAction(VelocityPa
ge.java:84)
    at 
org.tigris.scarab.pages.ScarabPage.doBuildBeforeAction(ScarabPage.java:74)
    at 
org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:137)
    at org.apache.turbine.modules.Page.build(Page.java:90)
    at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
    at org.apache.turbine.Turbine.doGet(Turbine.java:502)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
    at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:255)
    at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:219)
    at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
    at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:472)
    at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2253)
    at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
    at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
    at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
    at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
    at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
888)
    at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:980)
    at java.lang.Thread.run(Thread.java:496)


Re: [t4] again...classloader stuff...

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/22/01 11:48 AM, "Remy Maucherat" <re...@betaversion.org> wrote:

> Ok, I'll make sure I find an explanation. If I remember well, you had problems
> in the manager, right ?
> These should be gone.

Yes...this problem is a whole new problem and seems to exist in both the
StandardClassLoader and the WebappClassLoader...

> Is it with the default config of Turbine with some example app ?

I'm using Scarab...if you already have MySQL installed somewhere, it is
pretty easy to get things up and running...I can give you a cookbook for
setting up Scarab for testing if you want...

-jon


Re: [t4] again...classloader stuff...

Posted by Remy Maucherat <re...@betaversion.org>.
Quoting Jon Stevens <jo...@latchkey.com>:

> on 6/21/01 7:13 PM, "Remy Maucherat" <re...@apache.org> wrote:
> 
> > If you're paranoid, you can do as I did and delete StandardLoader from
> your
> > tree.
> > 
> > Remy
> 
> Or I can check out your recent fixes...
> 
> "  - Forgot to rename StandardClassLoader -> WebappClassLoader."
> 
> :-)

The env is set up by the Standard[Webapp]Loader, so the problem was there.
The fix above should fix problems with the extensions feature.

> Ok...with the latest CVS update, now the .jar files are being copied
> over
> and basic classreloading is working. Thank you for fixing things.

Cool.

> But when I log into Turbine and then try to cause a classreloader to
> reload,
> I'm still getting this crash below and it causes the SESSION.ser file to
> be
> left in the work directory which ends up screwing things up if I
> quit/restart tomcat because it tries to read that file on startup and it
> is
> invalid or corrupt or noclassdeffound...

Ok, I'll make sure I find an explanation. If I remember well, you had problems 
in the manager, right ?
These should be gone.

Is it with the default config of Turbine with some example app ?

Remy

Re: [t4 patch] delete the damn file. :-)

Posted by Remy Maucherat <re...@betaversion.org>.
Quoting Jon Stevens <jo...@latchkey.com>:

> Untested...
> 
> If there is an exception thrown during the processing, the file won't
> get
> deleted because it isn't in a try/finally statement...

That looks like a good idea (more robust).

I would add the finally block to the second try (the one in the sync(sessions) 
block) (apparently, if the first one is failing, it's only because no file 
exists).

Remy

> cvs diff StandardManager.java
> Index: StandardManager.java
> ===================================================================
> RCS file: 
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/se
> ssion/StandardManager.java,v
> retrieving revision 1.10
> diff -r1.10 StandardManager.java
> 353a354,355
> >         try {
> >
> 445,447c447,451
> <         // Delete the persistent storage file
> <         file.delete();
> <
> ---
> >         } finally {
> >             // Delete the persistent storage file
> >             if (file != null && file.exists() )
> >                 file.delete();
> >         }
> 

[t4 patch] delete the damn file. :-)

Posted by Jon Stevens <jo...@latchkey.com>.
Untested...

If there is an exception thrown during the processing, the file won't get
deleted because it isn't in a try/finally statement...

-jon

cvs diff StandardManager.java
Index: StandardManager.java
===================================================================
RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/se
ssion/StandardManager.java,v
retrieving revision 1.10
diff -r1.10 StandardManager.java
353a354,355
>         try {
>
445,447c447,451
<         // Delete the persistent storage file
<         file.delete();
<
---
>         } finally {
>             // Delete the persistent storage file
>             if (file != null && file.exists() )
>                 file.delete();
>         }