我有一个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>
有什么想法吗?谢谢!
答案 0 :(得分:2)
您的服务器目录结构是什么。您应该部署/ 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/]'
表示找不到该文件/目录..
答案 1 :(得分:-1)
目录结构应该是:
EAR
- warfile.WAR
- lib
- persistence-jpa.jar
- 另一个包含persistence.xml的jar文件
- enterpricejavabean.ejb
persistace.xml文件jar元素应该是&lt; jar-file&gt; ../ lib / persistence-jpa.jar&lt; / jar-file&gt;