2014-10-21 2 views
0

[WAR]/WEB-INF/lib에있는 두 개의 ejb-jars가있는 프로젝트가 있습니다. 두 ejb-jar는 JPA를 사용하고 @Entity 주석이 달린 클래스를 포함합니다. 하지만 패키징 및 배포에 문제가 있습니다 (Glassfish 4). 내 항아리 모두 다음의 persistence.xml이 포함 된 경우 내가 WAR/META-INF에 persistence.xml을 넣고 EJB-항아리에서 persistence.xml을 삭제 한war, ejb-jar 및 persistence.xml

java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [...] in the scope of the module called [...]. Please verify your application.

delpoyment에 다음과 같은 예외를 얻을. 배포에 성공,하지만 난 java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Problem compiling [SELECT ...]. [14, 18] The abstract schema type 'MyClass' is unknown.

MyClass

은 EJB-단지 중 하나에서 @Entity 클래스 런타임 예외를 얻을. 나는이 ejb-jar에서 문제가 persistence.xml 누락 된 것 같아요.

마지막으로 나는 WAR와 EJB-항아리에 persistence.xml을 넣어하려고했지만, 다시 나는

persistence.xml를 넣어 적절한 장소와 무엇 무엇 java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [...] in the scope of the module called [...]. Please verify your application.

는 패키지에 적절한 방법이다 얻을 신청?

답변

0

ejb 프로젝트와 persistence.xml에서 모든 엔티티를 간단한 jar 파일로 추출하여 해당 jar 파일을 WEB-INF/lib에 넣으십시오. (이 설정을 사용하지 않았으므로 EAR 패키징 (EAR, 3 모듈, 웹 및 2 ejbs 및 ear/lib 폴더의 엔티티 jar 포함)의 경우에도 작동합니다.

+0

모든 것이 하나의 항아리에 들어간 경우 그런 식으로 작동합니다. 나는 Java EE의 초심자이기 때문에 [전쟁] WEB-INF/lib에 ejb-jars를 넣는 것이 더 쉬워 보인다. 나는 귀에 포장의 철저한 이해가 없습니다. 귀에 포장하면 다른 ejb-jar 안에있는 하나의 ejb-jar에서 클래스를 볼 수 있습니까? – Joel

관련 문제