【发布时间】:2017-05-17 11:43:13
【问题描述】:
我正在尝试在 JBoss (wildfly-10.1.0.Final) 中运行我的 .ear 应用程序。
以前它使用 Glassfish 4.1 运行没有任何问题。
在 JBoss 上,我成功部署了它,但它引发了大量异常。
例如:
2017-05-17 13:42:00,911 ERROR [org.jboss.as.ejb3.invocation] (default task-18) WFLYEJB0034: EJB Invocation failed on component VersionDao for method public abstract java.util.List com.valor.anthillprodashboard.db.dao.VersionDaoLocal.getAllVersions(): javax.ejb.EJBTransactionRolledbackException: NamedQuery of name: Version.findAll not found.
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:159)
2017-05-17 13:40:03,504 ERROR [org.jboss.as.ejb3.invocation] (default task-110) WFLYEJB0034: EJB Invocation failed on component DataAccessFacade for method public abstract java.util.List com.valor.anthillprodashboard.bl.da.DataAccessFacadeLocal.getAllVersions(): javax.ejb.EJBTransactionRolledbackException: NamedQuery of name: Version.findAll not found.
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:159)
在这两种情况下,我都使用 eclipselink 和 MySQL。
我尝试使用 Glassfish 中的相同参数配置 JBoss。
Glassfish 配置:
JBoss 配置(来自standalone.xml):
<datasources>
<datasource jta="true" jndi-name="java:/jdbc/anthillprodashboard" pool-name="mysql_anthillprodashboard_rootPool" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/anthillprodashboard?zeroDateTimeBehavior=convertToNull</connection-url>
<driver>mysql</driver>
<security>
<user-name>****</user-name>
<password>****</password>
</security>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
<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;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql"/>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
我的 Persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="AnthillProDashboard-ejbPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/anthillprodashboard</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
</properties>
</persistence-unit>
</persistence>
这些例外没有任何意义,因为同样的方法在 glassfish 上也能正常工作。 这些异常的原因可能是什么?
【问题讨论】:
标签: java mysql jboss glassfish wildfly