jboss-deployment-structure.xml不会加载My EAR项目中的依赖项 [英] jboss-deployment-structure.xml does not loads the dependencies in My EAR project

查看:159
本文介绍了jboss-deployment-structure.xml不会加载My EAR项目中的依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的EAR项目的jboss-deployment-structure.xml。

this is my jboss-deployment-structure.xml of EAR project.

<?xml version="1.0" encoding="UTF-8"?>

<jboss-deployment-structure >

<deployment>

    <dependencies>
        <module name="org.javassist" export="true" />
        <module name="org.apache" export="true"/>
        <module name="org.antlr" export="true"/>
        <module name="org.dom4j" export="true"/>
        <module name="org.apache" export="true"/>
        <module name="org.hibernate" export="true"/>

    </dependencies>

</deployment>


</jboss-deployment-structure>

和EAR项目将我的其他项目放在部署路径中。一些是JARS,一个是WAR。我的一个Project使用EAR项目库中的依赖项。现在我从lib文件夹中删除jar并添加到jboss-deployment-structure.xml上面。我猜罐子没有加载,并给出了找不到所需罐子的错误。
这是StackTrace

and EAR project have my other projects in deployment path. some are JARS and one is WAR. and my one of Project uses the dependencies in the lib of EAR project. now I m removing the jars from lib folder and added above jboss-deployment-structure.xml . I guess jars are not being loaded and gives the error of not finding the required jars. this is the StackTrace

08:54:05,555 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SBOS_Online].[resteasy-servlet]] (http--0.0.0.0-8080-1) Servlet.service() for servlet resteasy-servlet threw exception: org.jboss.resteasy.spi.UnhandledException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userBusinessImpl' defined in class path resource [config/applicationContext.xml]: Cannot resolve reference to bean 'userHibernateDAOImpl' while setting bean property 'userDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userHibernateDAOImpl' defined in class path resource [config/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.scs.sbos.dao.hibernate.impl.UserHibernateDAOImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems: 
The import org.hibernate.Query cannot be resolved
The import org.hibernate.Session cannot be resolved
The import org.hibernate.SessionFactory cannot be resolved
The import org.hibernate.Transaction cannot be resolved
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
Transaction cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
Transaction cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
Transaction cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Query cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Query cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Query cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Session cannot be resolved to a type
SessionFactory cannot be resolved to a type
Query cannot be resolved to a type
SessionFactory cannot be resolved to a type
SessionFactory cannot be resolved to a type
SessionFactory cannot be resolved to a type
SessionFactory cannot be resolved to a type

 at     org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

这意味着没有添加Hibernate jar,但为什么会出现这个问题。

It means Hibernate jars are not being added, but why thats the problem.

推荐答案

jboss-deployment-struct必须在顶级部署中定义ure.xml。也就是说,如果直接部署WAR文件,它可能包含描述符。如果将WAR打包在EAR文件中,则需要移动描述符的内容并在EAR文件的jboss-deployment-structure.xml内定义它。

A jboss-deployment-structure.xml must be defined inside of the top-level deployment. That is, if you are deploying a WAR file directly, it may contain a descriptor. If you package the WAR inside of an EAR file, you need to move the content of the descriptor and define it inside of the jboss-deployment-structure.xml of the EAR file.

您需要进行子部署:

<jboss-deployment-structure>
     <sub-deployment name="myapp.war">
       <dependencies>
         <module name="org.javassist" export="true" />
         <module name="org.apache" export="true"/>
         <module name="org.antlr" export="true"/>
         <module name="org.dom4j" export="true"/>
         <module name="org.apache" export="true"/>
         <module name="org.hibernate" export="true"/>
       </dependencies>
     </sub-deployment>
</jboss-deployment-structure>

有一个很好的描述

There is a good description of on the JBoss Docs

这篇关于jboss-deployment-structure.xml不会加载My EAR项目中的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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