zu implementieren Ich entwickle ein Web-Modul in Struts2 Framework und EJB-Modul in Eclipse mit Hibernate als ORM-Framework. Jedes Mal, wenn ich mein EJB-Modul ändere, muss ich es in jar packen und es in meinen Web-Modul/WEB-INF/lib-Ordner einfügen, um meine gesamte Anwendung auszuführen. Obwohl die Anwendung auf diese Weise gut funktionierte, war es sehr zeitaufwendig. Also habe ich versucht, sie in einem EAR-Modul abzubilden. Aber wenn ich versuche, EAR-Modul zu laufen. Es gibt unter AusnahmenNicht in der Lage, EAR-Datei
2016-12-24 13:23:43,992 ERROR [org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler] (default task-4) Exception occurred during processing request: WFLYEJB0442: Unexpected Error: javax.ejb.EJBException: WFLYEJB0442: Unexpected Error
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:184)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at com.ebs.persistence.dao.UserDao.<clinit>(UserDao.java:16)
at com.ebs.business.service.UserAuthorisationBusinessService.getUserProfile(UserAuthorisationBusinessService.java:28)
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)
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException from [Module "deployment.EBS.ear.EBS-ejb.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 179 more
Unten ist, wo ich die Ausnahme
private static SessionFactory sessfct = SessionFactoryGenerator.getSessionFactory();
Es scheint zu bekommen vermuten mit Classloader einige Problem zu sein. Seit früher verwendet es, um mit derselben Reihe von Gläsern gut zu arbeiten, als EAR nicht im Bild war. Ich bin wahrscheinlich neu in EAR. Im Folgenden ist die Struktur der application.xml
<module>
<web>
<web-uri>EBS-web.war</web-uri>
<context-root>EBS-web</context-root>
</web>
</module>
<module>
<ejb>EBS-ejb.jar</ejb>
</module>
Ich habe auch versucht, in EAR lib Ordner alle Gläser, einschließlich, jedoch wurde kein Erfolg