web-dev-qa-db-ja.com

jboss-deployment-structure.xmlはMyEARプロジェクトの依存関係をロードしません

これは、EARプロジェクトのjboss-deployment-structure.xmlです。

<?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であり、1つはWARです。私のプロジェクトの1つは、EARプロジェクトのlibの依存関係を使用しています。ここで、libフォルダーからjarを削除し、jboss-deployment-structure.xmlの上に追加します。 jarがロードされておらず、必要なjarが見つからないというエラーが表示されると思います。これは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が追加されていないことを意味しますが、それが問題である理由です。

10
Sindhoo Oad

Jboss-deployment-structure.xmlは、トップレベルデプロイメント内で定義する必要があります。つまり、WARファイルを直接デプロイする場合は、記述子が含まれている可能性があります。 WARをEARファイル内にパッケージ化する場合は、記述子の内容を移動して、EARファイルのjboss-deployment-structure.xml内で定義する必要があります。

サブデプロイメントを行う必要があります。

<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>

JBossドキュメント上 の良い説明があります

16

モジュールの依存関係を、jarファイルのDeploymentsタグの下のmanifest.mfファイルに追加する必要があります。それはうまくいくはずです。

1
Dahakka