-
1. Re: Unexpected scan path for <jar-file> in persistence.xml
chris.howe-jones Apr 4, 2006 3:37 AM (in response to chris.howe-jones)I have worked out how to solve this one. You need to make the URL to the jar file a relative URL by adding '../' in front of the jar name. So:
<jar-file>myjar.jar</jar-file>
becomes :<jar-file>../myjar.jar</jar-file>
JBoss AS then searches in the deploy directory for the jar. -
2. Re: Unexpected scan path for <jar-file> in persistence.xml
epbernard Apr 4, 2006 4:38 AM (in response to chris.howe-jones)open a jira issue, I'm not sure this is expected
-
3. Re: Unexpected scan path for <jar-file> in persistence.xml
abl Apr 5, 2006 6:04 AM (in response to chris.howe-jones)I encountered exactly the same problem. thanks for the hint.
but my jar with entities is packed inside an ear. I tried:
<jar-file>../mc.ear/entities.jar</jar-file>
but it doesn't work.
It works if I deploy mc.ear unpacked.
any hint? -
4. Re: Unexpected scan path for <jar-file> in persistence.xml
chris.howe-jones Apr 5, 2006 6:20 AM (in response to chris.howe-jones)My jar is also in an ear. What I forgot to mention is that you need to add the jar into the application.xml description as a jar modue. So in my example I would have something like this in the application.xml:
<application> <display-name>MyApp</display-name> <module> <ejb>myapp.jar</ejb> </module> <module> <java>myjar.jar</java> </module> </application>
And the following in the persistence.xml in the myapp.jar:<persistence> <persistence-unit name="myunit"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/MYDS</jta-data-source> <jar-file>../myjar.jar</jar-file> </persistence-unit> </persistence>
-
5. Re: Unexpected scan path for <jar-file> in persistence.xml
abl Apr 6, 2006 2:59 AM (in response to chris.howe-jones)still can't get it to work.
I have an ear (mc.ear) for my application. Inside there are:
- entities.jar with entities classes and persistence.xml including 1 PUnit
- business.jar with SBs and POJOs
- web.war
all 3 packages are listed in application.xml as modules:<?xml version="1.0" encoding="UTF-8"?> <application> <display-name>mc</display-name> <module> <java>entities.jar</java> </module> <module> <ejb>business.jar</ejb> </module> <module> <web> <web-uri>web.war</web-uri> <context-root>mc</context-root> </web> </module> </application>
everything is ok.
now I want to deploy an additional persistence unit by creating an jar (entities2.jar) with only this persistence.xml in it:<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="mcora"> <jta-data-source>java:/mcDS</jta-data-source> <jar-file>../entities.jar</jar-file> <properties> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/> <property name="hibernate.show_sql" value="false"/> <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/> <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/> <property name="jboss.entity.manager.jndi.name" value="java:/EntityManagers/mcora"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/mcora"/> </properties> </persistence-unit> </persistence>
this gives me:
java.lang.RuntimeException: error trying to scan <jar-file>: file:/Z:/mc/jboss/jboss-4.0.4.CR2/server/default/deploy/entities.jar
I tried your hint and packed entities2.jar in another ear with application.xml:<?xml version="1.0" encoding="UTF-8"?> <application> <display-name>mcora</display-name> <module> <java>entities.jar</java> </module> <module> <ejb>entities2.jar</ejb> </module> </application>
but this results in:
org.jboss.deployment.DeploymentException: Failed to find module file: entities.jar
I guess I get you wrong?!