You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Edmund Mitchell <em...@emn8.com> on 2007/12/05 19:34:35 UTC

Class not found exception help in 6.0.10?

Read the excellent FAQ, and well as the classloader how-to for Tomcat 6.

We drop our simple webapp jar (just one) in $CATALINA_HOME/lib.  Our class
that implements Filter is in that jar, and the app can't function without
that class -- it handles every request.

99.99% of the time, all is well, but once a week or so we'll get a Class Not
Found exception in the Tomcat std out log -- Tomcat can't find this very
important class.  The webapp will obviously not work, and once Tomcat is
restarted, normal functionality resumes. 

I'm no Tomcat developer, so I'm struggling to understand how Tomcat can spin
up, find the class, use it for every request, and then, in the next second,
not be able to find it anymore.

I have no problem believing I've made one or more mistakes, but this
inconsistent behavior has me wondering what it might be.  

Any thoughts on how I can pursue this?  Something I can test, or look into?

Thanks for any hints,

E




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by Edmund Mitchell <em...@emn8.com>.

> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Subject: RE: Class not found exception help in 6.0.10?
> 
> > From: Edmund Mitchell [mailto:emitchell@emn8.com]
> > Subject: RE: Class not found exception help in 6.0.10?
> >
> > So since CATALINA_HOME/lib is a parent repository (and the
> > code is definitely there), and since the problem does not
> > manifest itself duringinit, this exception in the logs must
> > not be related to the problem.
> 
> I wouldn't assume that.  The timestamp on the log entry is:
> Nov 30, 2007 3:08:03 PM
> 
> Is that the time of the last Tomcat startup, or is it the time the error
> was encountered some time after Tomcat started?

That is the time of the last Tomcat startup.

> Are you sure the webapp isn't being restarted for some reason?

Hmmmm.  I'll look more into that.  I think I'm sure, but maybe...

> Do you have any <WatchedResources> set for it?  

None -- didn't even know about watched resources.  More cool stuff -- thanks
for the tips!

E


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Edmund Mitchell [mailto:emitchell@emn8.com] 
> Subject: RE: Class not found exception help in 6.0.10?
> 
> So since CATALINA_HOME/lib is a parent repository (and the
> code is definitely there), and since the problem does not
> manifest itself duringinit, this exception in the logs must
> not be related to the problem.

I wouldn't assume that.  The timestamp on the log entry is:
Nov 30, 2007 3:08:03 PM

Is that the time of the last Tomcat startup, or is it the time the error
was encountered some time after Tomcat started?

Are you sure the webapp isn't being restarted for some reason?  Do you
have any <WatchedResources> set for it?  (By default, WEB-INF/web.xml is
watched.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by Edmund Mitchell <em...@emn8.com>.

> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Subject: RE: Class not found exception help in 6.0.10?
> 
> > From: Edmund Mitchell [mailto:emitchell@emn8.com]
> > Subject: RE: Class not found exception help in 6.0.10?
> >
> > Yes, a webapp initialization should occur when Tomcat
> > is started / restarted
> 
> So the problem you see once a week occurs only when you start Tomcat?

Oddly, we aren't seeing it when Tomcat starts -- it's usually after the
webapp has been in use for some time.

> How do you resolve the situation - by just trying to start Tomcat again?

Exactly -- restarting Tomcat always fixes the issue -- for about a week, on
average.

> Or do you take some other corrective action, such as recopying jar
> files?  (I'm speculating that there's a permissions problem in Tomcat
> accessing your jar in Tomcat's lib directory.)

No recopying of jar files is attempted.

> The set of repositories can be changed if needed by editing
> conf/catalina.properties; I presume you haven't done that.

Yes, you're correct.   And now I'm completely puzzled, because you said:

"This spot in the code should only be reached during webapp initialization,
either at Tomcat startup or redeployment, and only if both the webapp and
parent repositories don't contain the class of interest." 

So since CATALINA_HOME/lib is a parent repository (and the code is
definitely there), and since the problem does not manifest itself during
init, this exception in the logs must not be related to the problem.

Chuck, thanks very much for your help -- I'll try and look elsewhere for the
answers, but at least I can eliminate this path of investigation.

E


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Edmund Mitchell [mailto:emitchell@emn8.com] 
> Subject: RE: Class not found exception help in 6.0.10?
> 
> Yes, a webapp initialization should occur when Tomcat 
> is started / restarted

So the problem you see once a week occurs only when you start Tomcat?
How do you resolve the situation - by just trying to start Tomcat again?
Or do you take some other corrective action, such as recopying jar
files?  (I'm speculating that there's a permissions problem in Tomcat
accessing your jar in Tomcat's lib directory.)

> is $CATALINA_HOME/lib considered a "parent repository"?

Yes:

      Bootstrap
          |
       System
          |
       Common
       /     \
  Webapp1   Webapp2 ... 

The above is from:
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

The set of repositories can be changed if needed by editing
conf/catalina.properties; I presume you haven't done that.

 - Chuck
		

THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by Edmund Mitchell <em...@emn8.com>.

> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Subject: RE: Class not found exception help in 6.0.10?
>
> > From: Edmund Mitchell [mailto:emitchell@emn8.com]
> > Subject: RE: Class not found exception help in 6.0.10?
> >
> > once a week or so we'll get a Class Not Found exception
> >
> > SEVERE: Exception starting filter security
> > java.lang.ClassNotFoundException:
> > com.emn8.console.common.SecurityFilter
> > 	at
> >
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
> .java:1358)
> 
> This spot in the code should only be reached during webapp
> initialization, either at Tomcat startup or redeployment, and only if
> both the webapp and parent repositories don't contain the class of
> interest.
> 
> Is a webapp initialization expected to be occuring at this time?

Yes, a webapp initialization should occur when Tomcat is started / restarted
(we have never done a redeployment).  You made me aware that the webapp
repository doesn't contain our code (since we put it in $CATALINA_HOME/lib)
but is $CATALINA_HOME/lib considered a "parent repository"?

Thanks for your time,

E




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Edmund Mitchell [mailto:emitchell@emn8.com] 
> Subject: RE: Class not found exception help in 6.0.10?
> 
> once a week or so we'll get a Class Not Found exception
> 
> SEVERE: Exception starting filter security
> java.lang.ClassNotFoundException: 
> com.emn8.console.common.SecurityFilter
> 	at
>
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
.java:1358)

This spot in the code should only be reached during webapp
initialization, either at Tomcat startup or redeployment, and only if
both the webapp and parent repositories don't contain the class of
interest.

Is a webapp initialization expected to be occuring at this time?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by Edmund Mitchell <em...@emn8.com>.
Thanks for your reply, Chuck.

> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Sent: Wednesday, December 05, 2007 10:42 AM
> To: Tomcat Users List
> Subject: RE: Class not found exception help in 6.0.10?
> 
> > From: Edmund Mitchell [mailto:emitchell@emn8.com]
> > Subject: Class not found exception help in 6.0.10?
> >
> > We drop our simple webapp jar (just one) in
> > $CATALINA_HOME/lib.
> 
> First question: why are you putting a webapp jar in Tomcat's lib
> directory?  It belongs in the webapp's WEB-INF/lib.

No special reason, but if you think moving it will help, I have no problems
with moving it.



> > once a week or so we'll get a Class Not Found exception
> 
> Second question: a CNFE or NCDFE?  They're quite different.  You might
> want to post the exact exception.


SEVERE: Exception starting filter security
java.lang.ClassNotFoundException: com.emn8.console.common.SecurityFilter
	at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1358)
	at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1204)
	at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilter
Config.java:249)
	at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFil
terConfig.java:397)
	at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterCon
fig.java:108)
	at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:36
93)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
	at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
61)
	at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
	at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
	at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883
)
	at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
	at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:120)
	at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
	at
org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
	at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at
org.apache.catalina.core.StandardService.start(StandardService.java:448)
	at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Nov 30, 2007 3:08:03 PM org.apache.catalina.core.StandardContext start


> 
> If the class of interest happens to be in multiple locations in a
> particular branch of the classloader tree, all sorts of wondrous strange
> things can happen.


"Wondrous, strange things" sounds much better than the descriptions that are
being tossed around here ;>)

Thanks again

E




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Class not found exception help in 6.0.10?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Edmund Mitchell [mailto:emitchell@emn8.com] 
> Subject: Class not found exception help in 6.0.10?
> 
> We drop our simple webapp jar (just one) in
> $CATALINA_HOME/lib.

First question: why are you putting a webapp jar in Tomcat's lib
directory?  It belongs in the webapp's WEB-INF/lib.

> once a week or so we'll get a Class Not Found exception

Second question: a CNFE or NCDFE?  They're quite different.  You might
want to post the exact exception.

If the class of interest happens to be in multiple locations in a
particular branch of the classloader tree, all sorts of wondrous strange
things can happen.

> Something I can test, or look into?

Try moving up to 6.0.14, although I'm not aware of any specific fixes
for this problem.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org