title: JBoss 5.1.0 EAP. Randomly Occuring a java.lang.NoClassDefFoundError
body: <p>In our EJB 3.0 - application, we have an randomly occuring java.lang.NoClassDefFoundError happening.</p>
  
  <p>It just happens localy in the IDE.</p>
  
  <h2>Setup:</h2>
  
  <pre><code>OS: Windows 7 32 Bit
  Java JDK: 1.6.0_24 (32 Bit)‎
  IDE: IntelliJ 11.1‎
  App-Server: JBoss 5.1.0 EAP
  EAR-Building with „maven-ear-plugin“‎
  WAR-Building with Maven „&lt;packaging&gt;war&lt;/packaging&gt;“‎
  EJB-Building with Maven „&lt;packaging&gt;ejb&lt;/packaging&gt;“ und „maven-ejb-‎plugin“‎
  </code></pre>
  
  <h2>EAR looks like this:</h2>
  
  <pre><code>xxx.ear
  ‎   |___ META-INF
  ‎   |    |___ application.xml (Information about EAR, EJB und WEB-Modul ‎configured)‎
  ‎   |‎
  ‎   |___ xxxEJB.jar‎
  ‎   |    |‎
  ‎   |    |___ META-INF
  ‎   |    |    |___ persistance.xml (JPA 1.0 configuration)‎
  ‎   |    |    |___ jboss.xml (JBoss-Config)‎
  ‎   |    |    |___ ejb-jar.xml (EJB 3.0 definition)‎
  ‎   |    |‎
  ‎   |    |___ country/yyy/xxx/.. (our own compiled classes)
  ‎   |    |___ report/.. (JasperReport-Tamplates)
  ‎   |    |___ quickfix/.. (QuickFixJ-configuration)
  ‎   |    |___ all dependent libraries for our EJB 3.0 project, (74-jar-files)
  ‎   | ‎
  ‎   |___ xxxWAR.war‎
  ‎        |‎
  ‎        |___ META-INF
  ‎        |___ WEB-INF
  ‎             |‎
  ‎             |___ lib‎
  ‎             |    |___ all dependent libraries for the Servlet-‎project, (2-jar-files)
  ‎             |___ classes‎
  ‎             |    |___ country/yyy/xxx/.. (our own compiled classes)
  ‎             |___ web.xml (Servlet-configuration)‎
  </code></pre>
  
  <h2>Stacktrace looks like this:</h2>
  
  <p>The JVM has been started with the option: -verbose:class to see all the classloading actions.</p>
  
  <pre><code>--- SNIP JBoss-Log ---‎
  
  ‎[Loaded country.yyy.xxx.service.issue.util.IssueUtil from file:/C:/Workarea/Projects/xxx-‎trunk/xxx/target/classes/]‎
  ‎[Loaded org.joda.time.DateTimeZone from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.Chronology from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.chrono.BaseChronology from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.DateTimeZone$1 from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.tz.NameProvider from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.JodaTimePermission from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.tz.Provider from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.tz.FixedDateTimeZone from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ‎[Loaded org.joda.time.tz.ZoneInfoProvider from jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar]‎
  ERROR - javax.ejb.EJBTransactionRolledbackException: Unexpected Error
  java.lang.NoClassDefFoundError: org/joda/time/tz/DefaultNameProvider
  at org.joda.time.DateTimeZone.getDefaultNameProvider(DateTimeZone.java:545)‎
  at org.joda.time.DateTimeZone.setNameProvider0(DateTimeZone.java:515)‎
  at org.joda.time.DateTimeZone.&lt;clinit&gt;(DateTimeZone.java:116)‎
  at ‎country.yyy.xxx.service.issue.util.InitialFixingDateTimeUtil.getHedgingTimestampsForIssue(InitialFixingDateTimeUtil.java:83)‎
  at ‎country.yyy.xxx.service.issue.util.InitialFixingDateTimeUtil.getFirstHedgingTimestampForIssue(InitialFixingDateTimeUtil.java:43)‎
  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)‎
  
  ‎--- SNAP JBoss-Log ---‎
  </code></pre>
  
  <p>The file "org/joda/time/tz/DefaultNameProvider" is definitely in the jar file jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-‎ear/target/xxx.ear!/xxxEJB.jar</p>
  
  <h2>Suggestions:</h2>
  
  <p>We have the feeling that the Quarz has something to do with it. So when something has been scheduled, out of an EJB 3.0 Remote-Stateless-Service. Sometimes the error occures.</p>
  
  <p>The Quartz-Scheduler is initially created in the Servlet-Context, but mostly it works fine.</p>
  
  <p>Did somebody had the same issue?</p>
  
  <h2>JBoss Deployment is done via IntelliJ JBoss plugin:</h2>
  
  <p>Can it be, that the problem is because of the deployment mechanism we are using? we deploy the application with intelliJ JBoss Plugin, so JBoss says:</p>
  
  <pre><code>09:39:21,614 INFO  [MainDeployer] deploy, url=file:/C:/Workarea/Projects/xxx-trunk/xxx-ear/target/xxx.ear
  09:39:33,613 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@2726974{vfszip:/C:/Workarea/Projects/xxx-trunk/xxx-ear/target/xxx.ear/xxxEJB.jar/}
  </code></pre>