在我们的 EJB 3.0 - 应用程序中,我们随机发生了 java.lang.NoClassDefFoundError 发生。
它只是在 IDE 中本地发生。
设置:
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 看起来像这样:
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 看起来像这样:
JVM 已使用以下选项启动:-verbose:class 以查看所有类加载操作。
--- 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 ---
文件“org/joda/time/tz/DefaultNameProvider”肯定在jar文件jar:file:/C:/Workarea/Projects/xxx-trunk/xxx-ear/target/xxx.ear!/xxxEJB.jar
建议:
我们觉得Quarz与它有关。因此,当某些事情已经安排好时,可以使用 EJB 3.0 Remote-Stateless-Service。有时会发生错误。
Quartz-Scheduler 最初是在 Servlet-Context 中创建的,但大多数情况下它工作正常。
有人有同样的问题吗?
JBoss 部署是通过 IntelliJ JBoss 插件完成的:
有没有可能,问题出在我们使用的部署机制上?我们使用 intelliJ JBoss 插件部署应用程序,所以 JBoss 说:
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/}