0

I have a web application which deploys fine as an ear file. But when I try to deploy it in exploded form it fails like this:

17:13:17,305 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=app.ear/#app-persistence state=Create
java.lang.RuntimeException: could not find relative path: lib/persistence-jpa.jar
    at org.jboss.jpa.deployment.PersistenceUnitDeployment.getRelativeURL(PersistenceUnitDeployment.java:208)
    at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:267)
.
.
.
Caused by: java.lang.RuntimeException: could not find child 'lib/persistence-jpa.jar' on 'FileHandler@4348388[path= context=file:/home/petteri/bin/jboss-5.1.0.GA/server/standard/deploy/ real=file:/home/petteri/bin/jboss-5.1.0.GA/server/standard/deploy/]'
    at org.jboss.jpa.deployment.PersistenceUnitDeployment.getRelativeURL(PersistenceUnitDeployment.java:203)

The persistence.xml looks like this:

<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="app-persistence">
        <jta-data-source>java:/app</jta-data-source>
        <jar-file>lib/persistence-jpa.jar</jar-file>
        <properties>

 ... some hibernate stuff ...

        </properties>
    </persistence-unit>
</persistence>

Any ideas? Thanks!

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
Petteri H
  • 11,779
  • 12
  • 64
  • 94

2 Answers2

2

What is your server directory structure. You should have deploy/lib/persistance-jpa.jar/ in order for this to work.

Caused by: java.lang.RuntimeException: could not find child 'lib/persistence-jpa.jar' on
     'FileHandler@4348388[path= context=file:/home/petteri/bin/jboss-5.1.0.GA/server/standard
    /deploy/ real=file:/home/petteri/bin/jboss-5.1.0.GA/server/standard/deploy/]'  

is saying that that file/directory is not found..

coolest_head
  • 1,388
  • 1
  • 7
  • 6
  • Hmm, true - I modified the persistence.xml to have app.ear/lib/persistence-jpa.jar and now it works. I assumed that the lookup would happen inside the exploded ear directory. – Petteri H Nov 18 '09 at 10:17
-1

Directory structure should be:

EAR
   - warfile.WAR
   - lib
       - persistence-jpa.jar
       - The other jar file which contain persistence.xml
   - enterpricejavabean.ejb


persistace.xml file jar element should be <jar-file>../lib/persistence-jpa.jar</jar-file>