开发者

DeploymentException while deploying the remote EJB

I am getting this exception while running a dynamic web project

Error installing to Real: name=vfsfile:/C:/jboss-5.0.1.GA_1/jboss-5.0.1.GA/server/default/deploy/BookMartEAR.ear/ state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error deploying BookMartEJB.jar: Container jboss.j2ee:ear=BookMartEAR.ear,jar=BookMartEJB.jar,name=BookMartBean,service=EJB3 failed to resolve persistence unit 开发者_运维百科BookMartEjb
.
.
.
Caused by: java.lang.IllegalArgumentException: Can't find a persistence unit named 'BookMartEjb' in AbstractVFSDeploymentContext@26167457{vfsfile:/C:/jboss-5.0.1.GA_1/jboss-5.0.1.GA/server/default/deploy/BookMartEAR.ear/BookMartEJB.jar/}

The EJB, EAR and Web project names are as mentioned.

The persistence.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
    <persistence-unit name="BookMartEJB" transaction-type="JTA">
        <jta-data-source>MySqlDS</jta-data-source>
        <class>com.misys.book.Book</class>
        <class>com.misys.book.Sale</class>
        <class>com.misys.book.Saleitem</class>
        <class>com.misys.book.Customer</class>
        <class>com.misys.book.User</class>
    </persistence-unit>
</persistence>

is there any problem with this xml file? I am using JBoss AS server, and MySql database.

Kindly suggest where I could have gone wrong. Also, tell if any other information is required.


What's the location of persistence.xml in your EAR? It should be inside the META-INF folder of your EJB module. If it's not there (e.g. it's in the EAR root or in the web module), then it indeed can not be found.

Also, if the persistence unit eventually is going to be found you might run into the next problem. Your data source is set to just MySqlDS, but most likely this should be java:/MySqlDS as that's the location JBoss AS will bind data sources to.

Further unrelated to your question, but you probably don't have to list your classes explicitly. Unless you don't want run-time scanning to occur but then you also have to include the <exclude-unlisted-classes/> element. (oh, and one last thing JTA is already the default so you could also leave out transaction-type="JTA")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜