2014-11-11 23 views
8

to jest mój plik jboss-distribution-structure.xml projektu EAR.jboss-deployment-structure.xml nie ładuje zależności w projekcie My EAR

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

i projekt EAR mają moje inne projekty w ścieżce wdrożenia. niektóre to JARS, a jedna to WAR. i mój jeden z Projektów korzysta z zależności w bibliotece projektu EAR. teraz usuwam słoiki z folderu lib i dodam powyżej jboss-deployment-structure.xml. Sądzę, że słoiki nie są ładowane i daje błąd, nie znajdując wymaganych słoików. to 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:] 

Oznacza to słoiki Hibernate nie są dodawane, ale dlaczego to jest to problem.

Odpowiedz

15

Plik jboss-deployment-structure.xml musi zostać zdefiniowany wewnątrz wdrożenia najwyższego poziomu. Oznacza to, że jeśli wdrażasz bezpośrednio plik WAR, może on zawierać deskryptor. Jeśli umieścisz WAR w pliku EAR, musisz przenieść zawartość deskryptora i zdefiniować go w pliku jboss-deployment-structure.xml pliku EAR.

Trzeba iść z sub-Wdrożenie:

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

Jest dobry opis on the JBoss Docs

+0

dzięki za opał. tak, też to przeczytałem. ale problem polega na tym, że wszystkie te zależności są używane przez mój jeden Projekt, który jest "JAR", a kiedy go wdrażam, daje błąd. spójrz na ślad plz. I hace redagował pytanie –

+0

W ten sposób określania zależności JAR możemy określić wersję również? –

1

Należy dodać zależności moudle do manifest.mf pliku pod wdroĹĽeniach tagu pliku jar . To powinno działać dobrze.

+0

Kilka problemów, które mam z manifest.mf. Szybko zaczyna być trudny do odczytania, jeśli jest zbyt wiele wpisów. Liczba znaków jest ograniczona. – Koekiebox