Jboss 7.1.0 + EJB3 + JPA - 错误JBAS014771

时间:2013-06-26 18:06:08

标签: jpa ejb-3.0 jboss7.x

我完成了in this tutorial编写的所有步骤但是当我在Jboss部署应用程序时,这些错误会增加

  

17:31:05,744 INFO [org.jboss.as.server.deployment](MSC服务   线程1-7)JBAS015876:开始部署“JPAEJBProject.jar”   17:31:05,754 INFO [org.jboss.as.jpa](MSC服务主题1-7)   JBAS011401:为JPADB 17:31:05,764 INFO读取persistence.xml   [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor]   (MSC服务线程1-7)名为的会话bean的JNDI绑定   部署单元部署“JPAEJBProject.jar”中的ProjectBean为   如下:

     

Java的:全球/ JPAEJBProject / ProjectBean com.ibytecode.business.IProject     Java的:应用程序/ JPAEJBProject / ProjectBean com.ibytecode.business.IProject     Java的:模块/ ProjectBean com.ibytecode.business.IProject     Java的:JBoss的/导出/ JPAEJBProject / ProjectBean com.ibytecode.business.IProject!     Java的:全球/ JPAEJBProject / ProjectBean     java:app / JPAEJBProject / ProjectBean java:module / ProjectBean

     

17:31:06,076 INFO [org.jboss.as.server](DeploymentScanner-threads -   2)JBAS015870:部署部署“JPAEJBProject.jar”   返回失败消息{“JBAS014771:服务有   缺失/不可用的依赖项“=>   [ “jboss.persistenceunit。\” JPAEJBProject.jar#JPADB \ “jboss.naming.context.java.MySQLDSMissing [jboss.persistenceunit。\” JPAEJBProject.jar#JPADB \ “jboss.naming.context.java.MySQLDS]”] }

这是我的persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
    <persistence-unit name="JPADB">
    <jta-data-source>java:/MySQLDS</jta-data-source>
        <properties>
            <property name="showSql" value="true"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        </properties>
    </persistence-unit>
</persistence>

我在zmodules \ com \ mysql \ main中使用上面的内容创建了一个module.xml:

<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.0" name="com.mysql">
  <resources>
    <resource-root path="mysql-connector-java-5.1.25-bin.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
  </dependencies>
</module>

我还在zmodules \ com \ mysql \ main中粘贴了“mysql-connector-java-5.1.25-bin”并修改了“stanalone.xml”以添加数据源和驱动程序,如下所示:

<subsystem xmlns="urn:jboss:domain:datasources:1.0">
    <datasources>
        <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
            <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
            <driver>h2</driver>
            <security>
                <user-name>sa</user-name>
                <password>sa</password>
            </security>
        </datasource>
        <datasource jndi-name="java:/MySQLDS"
            pool-name="MySQLDS" jta="true" enabled="true" use-java-context="true">
            <connection-url>jdbc:mysql://localhost:3306/ejbexample</connection-url>
            <driver>mysqlDriver</driver>
            <security>
                <user-name>root</user-name>
                <password>root</password>
            </security>
        </datasource>               
        <drivers>
            <driver name="h2" module="com.h2database.h2">
                <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
            </driver>
            <driver name="mysqlDriver" module="com.mysql">
                <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
            </driver>                   
        </drivers>
    </datasources>
</subsystem>

有人可以帮助我吗?

0 个答案:

没有答案