Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
部署错误:。。。使用jboss设置JPA时出现无连接可用错误_Jpa_Jboss_Persistence.xml - Fatal编程技术网

部署错误:。。。使用jboss设置JPA时出现无连接可用错误

部署错误:。。。使用jboss设置JPA时出现无连接可用错误,jpa,jboss,persistence.xml,Jpa,Jboss,Persistence.xml,我正在将glassfish jpa应用程序移植到jboss,遇到以下错误: 部署出错: 由于以下原因,部署“persistence.unit:unitName=Avengers.war#AvengersPU”出错:org.hiberna te.HibernateException:当没有可用连接时,必须设置“hibernate.dial” 可以使用jboss管理控制台成功地测试连接,我可以手动登录到我的数据库,所以我被这个错误消息弄糊涂了。有人能告诉我我错过了什么吗 这是我的mysql ds.x

我正在将glassfish jpa应用程序移植到jboss,遇到以下错误:

部署出错: 由于以下原因,部署“persistence.unit:unitName=Avengers.war#AvengersPU”出错:org.hiberna te.HibernateException:当没有可用连接时,必须设置“hibernate.dial”

可以使用jboss管理控制台成功地测试连接,我可以手动登录到我的数据库,所以我被这个错误消息弄糊涂了。有人能告诉我我错过了什么吗

这是我的mysql ds.xml文件:

<datasources>
  <local-tx-datasource>
    <jndi-name>jdbc/thor_ds</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/thor</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>apple</user-name>
    <password>apple</password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>   
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>

jdbc/thor\u ds
jdbc:mysql://localhost:3306/thor
com.mysql.jdbc.Driver
苹果
苹果
org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
mySQL
和mypersistence.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="AvengersPU" transaction-type="JTA">
    <!--<jta-data-source>jdbc/thor_ds</jta-data-source>-->
    <jta-data-source>java:/jdbc/thor_ds</jta-data-source>
    <class>avenger.Grouptable</class>
    <class>avenger.MyUser</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
    </properties>
  </persistence-unit>
</persistence>

java:/jdbc/thor\ds
复仇者,分组表
复仇者
真的
编辑:按照JMelnik的说明,我的配置属性标签现在有以下内容:

<properties>
    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>

您应该在persistence.xml中设置数据库方言:

<properties>
    <property name="hibernate.dialect" value="org.hibernate.dialect.DIALECT" />
</properties>


将方言替换为来自的方言

谢谢!我一直在努力工作,目前正陷于这种情况,以防你愿意达到顶峰。:)@Simginer,你是JTAtransaction经理小姐,在这里找到答案