-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Does <jar-file> work in persistence.xml
PostPosted: Wed Jul 22, 2009 9:17 am 
Regular
Regular

Joined: Sun Sep 25, 2005 11:35 pm
Posts: 57
I was having a hard time getting <jar-file> to work in persistence.xml, so wondering if it has been implemented. I did not see any test for it in Hibernate EntityManager.

Basically I have a domain.jar which contains my annotated domain entities. I have two other jars - application.jar and test.jar, that try to access the entities in domain.jar. These two jars package their own persistence.xml files which use <jar-file> to reference domain.jar:

Code:
<jar-file>domain.jar</jar-file>


However I get the following exception:

java.lang.IllegalArgumentException: Cannot parse persistence unit from class path resource [.../persistence.xml]
caused by
java.io.FileNotFoundException: class path resource [domain.jar] cannot be resolved to URL because it does not exist

I know domain.jar is in the class path. Should I be specifying it differently? Is this supposed to work in a J2SE environment or is this strictly for JavaEE environment>

Thanks.
Naresh


Top
 Profile  
 
 Post subject: Re: Does <jar-file> work in persistence.xml
PostPosted: Fri Jul 24, 2009 3:44 pm 
Regular
Regular

Joined: Sun Sep 25, 2005 11:35 pm
Posts: 57
Digging in more deeply. I definitely know that my domain.jar is in the classpath. Adding more logging, I see the following warning:

Code:
[ExplodedJarVisitor] WARNING: Exploded jar does not exists (ignored): file:domain.jar


I hope this just means that hibernate is first looking for an exploded jar. If it doesn't find it, it will look for a packaged jar. In any case, I don't think it is finding/scanning domain.jar.

However, I was able to get hibernate to recognize my entity by replacing <jar-file> with a <class> element:

Code:
<class>samples.jpatest.domain.Person</class>


So, it appears that <jar-file> is not working. Can someone more knowledgeable than me comment on this? Should I log a JIRA with my sample code?

Thanks.
Naresh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.