我正在尝试在 Cloudbees Paas 上部署现有的 Jboss 7 战争应用程序,但我遇到了数据源配置问题。在此专用Cloudbees wiki 条目和相关线程之后,我在应用程序启动期间最终出现以下错误(线程中的其他人已经提到过):
javax.resource.ResourceException: Wrong driver class [class com.mysql.jdbc.Driver] for this connection URL [jdbc:cloudbees://cbdebate--1]
我的配置文件如下:
cloudbees-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<cloudbees-web-app xmlns="http://www.cloudbees.com/xml/webapp/1">
<!-- Application ID (formatted CB_ACCOUNT/APPNAME) -->
<appid>hck/debate</appid>
<!-- DataSources (use names refererenced via <resource-ref> in WEB-INF/web.xml) -->
<resource name="jdbc/debate" auth="Container" type="javax.sql.DataSource">
<param name="username" value="myuser" />
<param name="password" value="mypassword" />
<param name="url" value="jdbc:cloudbees://cbdebate--1" />
<!-- Connection Pool settings -->
<param name="maxActive" value="20" />
<param name="maxIdle" value="2" />
<param name="maxWait" value="10000" />
<param name="validationQuery" value="SELECT 1" />
</resource>
</cloudbees-web-app>
web.xml(相关部分)
(...)
<resource-ref>
<res-ref-name>jdbc/debate</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
(...)
persistence.xml(相关部分)
<persistence-unit name="debate" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/debate</jta-data-source>
(... entity classes declaration ...)
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.max_fetch_depth" value="5"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
<property name="org.hibernate.worker.batch_size" value="1000" />
</properties>
</persistence-unit>
预先感谢您的任何帮助
环境:Jboss 7,JPA 2.0