[
https://issues.apache.org/jira/browse/GERONIMO-4468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664122#action_12664122
]
Janko Heilgeist commented on GERONIMO-4468:
-------------------------------------------
I tried the patch and it seems to solve the issue (partially?). The referenced
jar-files are now correctly resolved, but not all the entities inside of all
jars are discovered. (In the following traces I replaced the path of the
deployed EAR with $(EAR_ROOT) to make them more readable.)
1. EAR structure as before:
{noformat}
lib/my-pu-1.0-SNAPSHOT.jar
lib/my-entities1-1.0-SNAPSHOT.jar
my-entities2-1.0-SNAPSHOT.jar
{noformat}
During deployment only the entity in the jar on the same level as the
persistence root is discovered:
{noformat}
2 myPU TRACE [Thread-62] openjpa.MetaData - Scanning jar
"$(EAR_ROOT)/lib/my-pu-1.0-SNAPSHOT.jar" for persistent types.
2 myPU TRACE [Thread-62] openjpa.MetaData - Scanning jar file from URL
"file:$(EAR_ROOT)/lib/my-entities1-1.0-SNAPSHOT.jar" for persistent types.
2 myPU TRACE [Thread-62] openjpa.MetaData - Scanning jar file from URL
"file:$(EAR_ROOT)/my-entities2-1.0-SNAPSHOT.jar" for persistent types.
3 myPU TRACE [Thread-62] openjpa.MetaData - Scanning resource
"META-INF/orm.xml" for persistent types.
5 myPU TRACE [Thread-62] openjpa.MetaData - Scan of "META-INF/orm.xml" found
persistent types [Ljava.lang.String;@fe9034.
5 myPU TRACE [Thread-62] openjpa.MetaData - Mapping resource location
"jar:file:$(EAR_ROOT)/lib/my-entities1-1.0-SNAPSHOT.jar!/META-INF/orm.xml" to
persistent types "[com.heilgeist.testcase.geronimo.jarfile.MyEntity1]".
5 myPU TRACE [Thread-62] openjpa.MetaData - parsePersistentTypeNames() found
[com.heilgeist.testcase.geronimo.jarfile.MyEntity1].
5 myPU TRACE [Thread-62] openjpa.MetaData - Found 1 classes with metadata in
3 milliseconds.
{noformat}
2. EAR with both jars next to the persistence root:
{noformat}
lib/my-pu-1.0-SNAPSHOT.jar
lib/my-entities1-1.0-SNAPSHOT.jar
lib/my-entities2-1.0-SNAPSHOT.jar
{noformat}
During deployment both entities are discovered:
{noformat}
2 myPU TRACE [Thread-61] openjpa.MetaData - Scanning jar
"$(EAR_ROOT)/lib/my-pu-1.0-SNAPSHOT.jar" for persistent types.
2 myPU TRACE [Thread-61] openjpa.MetaData - Scanning jar file from URL
"file:$(EAR_ROOT)/lib/my-entities2-1.0-SNAPSHOT.jar" for persistent types.
2 myPU TRACE [Thread-61] openjpa.MetaData - Scanning jar file from URL
"file:$(EAR_ROOT)/lib/my-entities1-1.0-SNAPSHOT.jar" for persistent types.
2 myPU TRACE [Thread-61] openjpa.MetaData - Scanning resource
"META-INF/orm.xml" for persistent types.
5 myPU TRACE [Thread-61] openjpa.MetaData - Scan of "META-INF/orm.xml" found
persistent types [Ljava.lang.String;@1f0c908.
5 myPU TRACE [Thread-61] openjpa.MetaData - Mapping resource location
"jar:file:$(EAR_ROOT)/lib/my-entities1-1.0-SNAPSHOT.jar!/META-INF/orm.xml" to
persistent types "[com.heilgeist.testcase.geronimo.jarfile.MyEntity1]".
5 myPU TRACE [Thread-61] openjpa.MetaData - Scan of "META-INF/orm.xml" found
persistent types [Ljava.lang.String;@11e3986.
5 myPU TRACE [Thread-61] openjpa.MetaData - Mapping resource location
"jar:file:$(EAR_ROOT)/lib/my-entities2-1.0-SNAPSHOT.jar!/META-INF/orm.xml" to
persistent types "[com.heilgeist.testcase.geronimo.jarfile.MyEntity2]".
5 myPU TRACE [Thread-61] openjpa.MetaData - parsePersistentTypeNames() found
[com.heilgeist.testcase.geronimo.jarfile.MyEntity2,
com.heilgeist.testcase.geronimo.jarfile.MyEntity1].
5 myPU TRACE [Thread-61] openjpa.MetaData - Found 2 classes with metadata in
4 milliseconds.
{noformat}
I am not sure, whether this is related to this issue (a consequence of the
patch?) or a separate problem.
> <jar-file> elements are interpreted relatively to EAR root
> ----------------------------------------------------------
>
> Key: GERONIMO-4468
> URL: https://issues.apache.org/jira/browse/GERONIMO-4468
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Affects Versions: 2.1.3
> Reporter: Janko Heilgeist
> Assignee: Ivan
> Attachments: Geronimo-4468.patch, geronimo-jarfile.tar.gz,
> my-ear-1.0-SNAPSHOT.ear
>
>
> The <jar-file> elements in a persistence.xml are wrongly interpreted as
> relative to the EAR's root.
> EJB 3.0 persistence spec, section 6.2:
> {quote}
> [...] A persistence unit is defined by a persistence.xml file. The jar file
> or directory whose META-INF directory contains the persistence.xml file is
> termed the root of the persistence unit. [...]
> {quote}
> EJB 3.0 persistence spec, section 6.2:
> {quote}
> One or more JAR files may be specified using the jar-file elements [...] Such
> JAR files are specified relative to the root of the persistence unit [...].
> {quote}
> The attached EAR is correctly verified by the Glassfish verifier. Deploying
> it on Geronimo 2.1.3 or 2.2-SNAPSHOT results in a successful deployment,
> while on the console OpenJPA throws exceptions because it tries to resolve
> the jar-file paths relative to the EAR's root:
> {quote}
> <openjpa-1.0.3-r420667:677674 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException:
> $HOME/geronimo-tomcat6-javaee5-2.1.3/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-ear-1.0-SNAPSHOT.ear/my-entities1-1.0-SNAPSHOT.jar
> (No such file or directory)
> <openjpa-1.2.0-r422266:683325 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException:
> $HOME/geronimo-tomcat6-javaee5-2.2-SNAPSHOT/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-entities2-1.0-SNAPSHOT.jar
> (No such file or directory)
> {quote}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.