<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: ClassNotFoundException or NoClassDefFoundError while using JBoss</title> <atom:link href="http://iderror.com/errors/java/java_jboss/classnotfoundexception-or-noclassdeffounderror-while-using-jboss/feed/" rel="self" type="application/rss+xml" /><link>http://iderror.com/errors/java/java_jboss/classnotfoundexception-or-noclassdeffounderror-while-using-jboss/</link> <description>You have errors, we have solutions!</description> <lastBuildDate>Fri, 10 Jun 2011 15:06:54 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>By: admin</title><link>http://iderror.com/errors/java/java_jboss/classnotfoundexception-or-noclassdeffounderror-while-using-jboss/comment-page-1/#comment-7975</link> <dc:creator>admin</dc:creator> <pubDate>Fri, 20 Mar 2009 10:28:59 +0000</pubDate> <guid
isPermaLink="false">http://localhost/idError/?p=8048#comment-7975</guid> <description>a. Use jar -tf whatever.jar to show the class is in the correct place
b. Use javap to look at the class (assuming you don&#039;t have the source code)
c. The class is compiled for java5 but you are trying to use it on java1.4.  Note that this can happen when the subclass was compiled with the correct version but its superclass was not.  Often, java will report the NoClassDefFoundError on the subclass when the problem was really the fact that its superclass was compiled with the wrong version.
d. This happens when you have an isolated deployment (like a war) and you try to load it from outside the war. This may not be directly. e.g. A war class loads a class from outside the war which in turn tries to load a class from inside the war.
e. Path names in NTFS have a hard limit of 255 characters, which means that if the exploded full path is longer than 255, the path is truncated. For example this one which contains 269 characters:
/C:/JBoss/jboss-4.0.4.GA/server/Server1/tmp/deploy/tmp8590CCFF_Administration-test-blabla.ear-contents/CCFF_Administration_blabla-exp.war/WEB-INF/classes/me/you/house1/ccff/administration/controller/web/actionForms/logconfiguration/LogConfigurationListActionForm.classThis path would through an exception like this because it would truncated to something like this:
/C:/JBoss/jboss-4.0.4.GA/server/Server1/tmp/deploy/tmp8590CCFF_Administration-test-blabla.ear-contents/CCFF_Administration_blabla-exp.war/WEB-INF/classes/me/you/house1/ccff/administration/controller/web/actionForms/logconfiguration/LogConfigurationListAcf. The class has a static initialization block that is throwing an error
public class MyClass{
static{
throw new Error(&quot;Usually not reported in the NoClassDefError if this is loaded by an import :-(&quot;);
}
}g. If you use Class.forName() this is MyClass.class.getClassLoader().loadClass(...) which will start from the classloader where your class is deployed.
You should use Thread.currentThread().getContextClassLoader().loadClass(...) to load from the current application&#039;s classloader.</description> <content:encoded><![CDATA[<p>a. Use jar -tf whatever.jar to show the class is in the correct place<br
/> b. Use javap to look at the class (assuming you don&#8217;t have the source code)<br
/> c. The class is compiled for java5 but you are trying to use it on java1.4.  Note that this can happen when the subclass was compiled with the correct version but its superclass was not.  Often, java will report the NoClassDefFoundError on the subclass when the problem was really the fact that its superclass was compiled with the wrong version.<br
/> d. This happens when you have an isolated deployment (like a war) and you try to load it from outside the war. This may not be directly. e.g. A war class loads a class from outside the war which in turn tries to load a class from inside the war.<br
/> e. Path names in NTFS have a hard limit of 255 characters, which means that if the exploded full path is longer than 255, the path is truncated. For example this one which contains 269 characters:<br
/> /C:/JBoss/jboss-4.0.4.GA/server/Server1/tmp/deploy/tmp8590CCFF_Administration-test-blabla.ear-contents/CCFF_Administration_blabla-exp.war/WEB-INF/classes/me/you/house1/ccff/administration/controller/web/actionForms/logconfiguration/LogConfigurationListActionForm.class</p><p>This path would through an exception like this because it would truncated to something like this:<br
/> /C:/JBoss/jboss-4.0.4.GA/server/Server1/tmp/deploy/tmp8590CCFF_Administration-test-blabla.ear-contents/CCFF_Administration_blabla-exp.war/WEB-INF/classes/me/you/house1/ccff/administration/controller/web/actionForms/logconfiguration/LogConfigurationListAc</p><p>f. The class has a static initialization block that is throwing an error<br
/> public class MyClass{<br
/> static{<br
/> throw new Error(&#8220;Usually not reported in the NoClassDefError if this is loaded by an import <img
src='http://iderror.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> &#8220;);<br
/> }<br
/> }</p><p>g. If you use Class.forName() this is MyClass.class.getClassLoader().loadClass(&#8230;) which will start from the classloader where your class is deployed.<br
/> You should use Thread.currentThread().getContextClassLoader().loadClass(&#8230;) to load from the current application&#8217;s classloader.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: iderror.com @ 2012-02-10 14:38:24 -->
