You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Licht Jiang <li...@gmail.com> on 2010/05/31 05:16:50 UTC
java.lang.NoClassDefFoundError: Could not initialize class
I got the following error from a web service running in Apache
Tomcat/5.5.27 and JVM 1.6.0_17-b04-248-10M3025.
java.lang.NoClassDefFoundError: Could not initialize class
com.myservice.web.TestClass
TestClass is a class called by the servlet in doget().
But class "TestClass" is in "WEB-INF/classes/come/myservice/web" under
the service deployment folder in webapps of tomcat. According to the
following class loader how-to page of tomcat 5.5, I guess tomcat
should be able to find and load the class:
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
So, what could be wrong?
Thanks,
-J
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Logger / Context
Posted by Pid <pi...@pidster.com>.
On 31/05/2010 11:51, Stefan Rainer wrote:
> Hello,
>
> we've been using context + logger for redirecting "stdout-logs"
> from different servlets to different folders in tomcat 5.0.*:
>
> <Context docBase="axis" path="/axis" reloadable="true" swallowOutput="true">
> <Logger className="org.apache.catalina.logger.FileLogger"
> directory="logs/axis/" prefix="StdOut_axis_" suffix=".log"
> timestamp="true"/>
> </Context>
>
> After upgrading to tomcat 6.*, this log redirects does not work anymore.
> Has anyone a hint or a link to some information how this could be done in
> Tomcat 6?
Please don't reply to an existing thread and edit the subject/body -
this is called thread hi-jacking. Please start a completely new message.
p
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Logger / Context
Posted by Stefan Rainer <s....@teamaxess.com>.
Hello,
we've been using context + logger for redirecting "stdout-logs"
from different servlets to different folders in tomcat 5.0.*:
<Context docBase="axis" path="/axis" reloadable="true" swallowOutput="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs/axis/" prefix="StdOut_axis_" suffix=".log"
timestamp="true"/>
</Context>
After upgrading to tomcat 6.*, this log redirects does not work anymore.
Has anyone a hint or a link to some information how this could be done in
Tomcat 6?
thanks, stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: java.lang.NoClassDefFoundError: Could not initialize class
Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/5/31 Licht Jiang <li...@gmail.com>:
> java.lang.NoClassDefFoundError: Could not initialize class
> com.myservice.web.TestClass
>
"Could not initialize" = the class is found, but its initialization
failed. There can be many reasons for that, e.g. 1) missing dependent
classes, 2) exception is thrown when executing a static{}
initialization block in the class. It is hard to tell what exactly
went wrong without seeing the actual exception.
>
>> Show us the full stack trace(s); there are usually at least two in cases like this.
>
> Now I have no access to the service.
>
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: java.lang.NoClassDefFoundError: Could not initialize class
Posted by Licht Jiang <li...@gmail.com>.
Thanks Charles for your help!
>> java.lang.NoClassDefFoundError: Could not initialize class
>> com.myservice.web.TestClass
>
> Show us the full stack trace(s); there are usually at least two in cases like this.
Now I have no access to the service.
>> But class "TestClass" is in "WEB-INF/classes/come/myservice/web"
>
> Note the discrepancy between "com.myservice.web" and "come/myservice/web"; is one of them a typo?
2nd's a typo, should be com/myservice/web
> What is a "service deployment folder"? What's in your server.xml? What is the exact structure under Tomcat's webapps directory?
The service is a war file, "MyService.war". It is put in "webapps"
folder of tomcat. "TestClass.class" is in the following folder:
tomcat_home/webapps/MyService/WEB-INF/classes/com/myservice/web
In web.xml, a servlet is defined (which calls TestClass in doget),
when requested, it generated the exception as posted.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: java.lang.NoClassDefFoundError: Could not initialize class
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Licht Jiang [mailto:licht.jiang@gmail.com]
> Subject: java.lang.NoClassDefFoundError: Could not initialize class
>
> java.lang.NoClassDefFoundError: Could not initialize class
> com.myservice.web.TestClass
Show us the full stack trace(s); there are usually at least two in cases like this.
> But class "TestClass" is in "WEB-INF/classes/come/myservice/web"
Note the discrepancy between "com.myservice.web" and "come/myservice/web"; is one of them a typo?
> under the service deployment folder
What is a "service deployment folder"? What's in your server.xml? What is the exact structure under Tomcat's webapps directory?
> So, what could be wrong?
Lots of things.
- 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org