JBoss 5.1.0 EAP. Randomly Occurs java.lang.NoClassDefFoundError

In our EJB 3.0 application, we have a random event java.lang.NoClassDefFoundError.

It just happens locally in the IDE.

Setup:

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 β€ž<packaging>war</packaging>"β€Ž EJB-Building with Maven β€ž<packaging>ejb</packaging>" und β€žmaven-ejb-β€Žplugin"β€Ž 

EAR is as follows:

 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)β€Ž 

Stacktrace is as follows:

The JVM starts with the option: -verbose: class to see all the actions for loading classes.

 --- 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.<clinit>(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 ---β€Ž 

The file "org / joda / time / tz / DefaultNameProvider" is definitely located in the jar file: file: file: / C: / Workarea / Projects / xxx-trunk / xxx- ear / target / xxx.ear! /XxxEJB.jar

Suggestions:

We have a feeling that Quartz has something to do with it. Therefore, when something was planned, from EJB 3.0 Remote-Stateless-Service. Sometimes an error occurs.

Quartz-Scheduler is initially created in the context of the Servlet-Context, but basically it works fine.

Has anyone had the same problem?

JBoss deployment is done through the IntelliJ JBoss plugin:

Maybe the problem is related to the deployment mechanism used? we are deploying an application with the IntelliJ JBoss plugin, so JBoss says:

 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/} 
+7
source share
2 answers

The problem only occurs when deploying with IntelliJ IDEA JBoss-Run-Configuration.

Thanks to user1516873 for the hint to deploy manually through ANT / Maven.

We have tried this.

We introduced ANT -Task to simply copy the xxx.ear artifact into the JBoss-Deploy folder. It has been working fine ever since, and we don't have java.lang.NoClassDefFoundError yet.

build.xml is as follows:

 <project name="xxx-deploy"> <!-- Copy Artifact to JBoss-Deploy-Folder --> <target name="xxx-ear-deploy"> <copy file="C:/Workarea/Projects/xxx-trunk/xxx-ear/target/xxx.ear" todir="C:/Workarea/_tools/jboss-eap-5.1.0-xxx/jboss-as/server/default/deploy"/> </target> </project> 
0
source

Perhaps this is due to a jar conflict inside the binary (xx.ear). You can use the code below to find out the jar duplication in the lib folder of the ear folder

public class JarSearch {

 public static final String NL = System.getProperty("line.separator"); public static String directory = new String(); public static File file; public static Writer output; public static void main(String args[]) { /*if (args.length != 2){ System.out.println("You must provide 1. search directory and 2. search string"); System.exit(0); }*/ JarSearch search = new JarSearch(); try{ String dir = "E://lib";//path of lib folder directory = dir; file = new File(directory); String parentPath = file.getParent(); parentPath += "\\JarSearchResult.txt"; file = new File(parentPath); //output = new BufferedWriter(new FileWriter(file)); String searchStr = "DES.class";// name of class file to b searched search.searchDir(dir, searchStr);//"C:\\Program Files\\IBM\\Application Developer\\plugins\\com.ibm.etools.ctc.binding.java\\runtime\\ctcjava.jar"); }catch(IOException ioe){ System.out.println(ioe.toString()); } } public static void searchDir(String dirName, String searchStr)throws IOException{ File dir = new File(dirName); if (!dir.isDirectory()){ throw new IOException(dir+" is not a directory !!!"); } File files[] = dir.listFiles(); for (int i=0; i<files.length; i++){ if (files[i].isDirectory()){ searchDir(files[i].getAbsolutePath(), searchStr); }else{ if (files[i].getName().endsWith(".jar")){ searchFile(files[i].getAbsolutePath(), searchStr); } } } //output.close(); } public static void searchFile(String fileName, String searchStr)throws IOException{ //System.out.println("File Absolute Path :: " + fileName); boolean outputMessage = false; StringBuffer buf = new StringBuffer(); int index1 = fileName.lastIndexOf("\\"); int index2 = fileName.lastIndexOf("/"); //System.out.println(index1 + " :: " + index2 + " ===>>> " + NL); int index = -1; if (index1 > index2){ index = index1; } else { index = index2; } buf.append(NL); buf.append("DIR: "); buf.append(fileName.substring(0, index)); buf.append(NL); buf.append("JAR: "); buf.append(fileName.substring(index+1)); buf.append(NL); searchStr = searchStr.toLowerCase(); JarFile jar = new JarFile(fileName); Enumeration e = jar.entries(); while (e.hasMoreElements()){ JarEntry entry = (JarEntry)e.nextElement(); String strEntry = entry.getName().toLowerCase(); //System.out.println(strEntry); if (strEntry.indexOf(searchStr) > -1){ outputMessage = true; buf.append(entry.getName()); buf.append(NL); } } if (outputMessage){ System.out.println(buf); //output.write(buf.toString()); } } 

}

0
source

All Articles