0

我有一个 Web 应用程序,可以很好地部署为 ear 文件。但是当我尝试以爆炸形式部署它时,它会像这样失败:

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)

persistence.xml 如下所示:

<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>

有任何想法吗?谢谢!

4

2 回答 2

2

你的服务器目录结构是什么。您应该拥有 deploy/lib/persistance-jpa.jar/ 才能使其正常工作。

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/]'  

是说找不到该文件/目录..

于 2009-11-17T17:29:06.940 回答
-1

目录结构应该是:

EAR
   - warfile.WAR
   - lib
       - persistence-jpa.jar
       - 另一个包含 persistence.xml 的 jar 文件
   - enterpricejavabean.ejb


persistace.xml 文件的 jar 元素应该是 <jar-file>../lib/persistence-jpa.jar</jar-file>

于 2010-11-30T09:19:57.890 回答