不能部署EAR文件 [英] Not able to deploy EAR file

查看:341
本文介绍了不能部署EAR文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用hibernate作为ORM框架在eclipse中将struts2框架和ejb模块中的web模块开发出来。
每当我修改我的ejb模块时,我必须将其打包到jar中,并将其包含在我的web模块/ WEB-INF / lib文件夹中,以便运行我的整个应用程序。虽然应用程序以这种方式工作正常,但它真的很耗时。所以我试图将它们映射到EAR模块中。但是当我尝试运行EAR模块。它给出了以下例外

  2016-12-24 13:23:43,992错误[org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler] (默认任务-4)处理请求期间发生异常:WFLYEJB0442:意外错误:javax.ejb.EJBException:WFLYEJB0442:意外错误
在org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java: 184)
在org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
在org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java: 327)
在org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
在org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
在org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
在org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
在org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
在org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
在org .jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
在org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
在org.jboss.as .ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
在org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
导致: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)
在java.lang.reflect.Method.invoke(未知来源)
引起的:java.lang.ClassNotFoundException:org.hibernate.HibernateException from [Moduledeployment.EBS.ear.EBS-ejb.jar:mainfrom Service Module Loader]
在org.jboss.modules.ModuleClassLoader。 findClass(ModuleClassLoader.java:198)
在org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
在org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
在org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 179更多

以下是我怀疑获取异常的地方。

  private static SessionFactory sessfct = SessionFactoryGenerator.getSessionFactory (); 

类加载器似乎是一个问题。自从早些时候,当EAR不在图片中时,它可以使用同一组罐子进行工作。我可能是EAR的新手。以下是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>

我还尝试将所有的jar包括在EAR lib文件夹中,但没有成功实现

解决方案

您无法部署您的 EAR 文件,因为找不到以下类。 / p>

  java.lang.ClassNotFoundException:org.hibernate.HibernateException 

确保您的服务器lib文件夹中包含 hibernate 库或打包在您的 EAR lib存档。


I am developing a web module in struts2 framework and ejb module in eclipse with hibernate as ORM framework. Every time when I modify my ejb module I have to package it into jar and include it in my web module /WEB-INF/lib folder in order to run my whole application. Though the application worked fine in this way but it was really time consuming. So I tried to map them in a EAR module. But when I try to run EAR module. It gives below exceptions

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

Below is where I suspect to get the exception

private static SessionFactory sessfct = SessionFactoryGenerator.getSessionFactory();

It seems to be some issue with classloader. Since earlier it use to work fine with same set of jars when EAR was not in the picture. I am probably new to EAR. Below is the structure of 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>

I also tried including all the jars in EAR lib folder but no success was achieved

解决方案

You can not deploy your EAR file because the following class could not be found.

java.lang.ClassNotFoundException: org.hibernate.HibernateException

Make sure you have hibernate libraries in your server lib folder or packed in your EAR lib archive.

这篇关于不能部署EAR文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆