中使用c3p0 pooling'New missing/unsatisfied dependencies'錯誤我想將c3p0
連接池集成到JBoss EAP 6.3.0.GA (AS 7.4.0.Final-redhat-19)
到Mbean
服務中。搜索了一些例子並嘗試將其整合。 這是我的配置。 添加c3p0
罐子和module.xml
成模塊DIR {JBOSS_HOME}/modules/system/layers/base/com/c3p0/main
,module.xml
配置:在JBoss EAP 6.3.0.GA(AS 7.4.0.Final-redhat-19)env
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.c3p0">
<resources>
<resource-root path="c3p0-0.9.5.1.jar"/>
<resource-root path="c3p0-oracle-thin-extras-0.9.5.1.jar"/>
<resource-root path="mchange-commons-java-0.2.10.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
在standalone.xml
加入c3p0
到全球模塊(類路徑):
<subsystem xmlns="urn:jboss:domain:ee:1.2">
<global-modules>
<module name="com.c3p0" slot="main"/>
</global-modules>
</subsystem>
新增服務文件到{JBOSS_HOME}/standalone/deployments/c3p0-service.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="urn:jboss:service:7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">
<mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource"
name="jboss.jca:service=DataSourceBinding,name=jdbc/myDB">
<attribute name="JndiName">java:jdbc/myDB</attribute>
<attribute name="JdbcUrl">jdbc:oracle:thin:@server.com:1521:sid</attribute>
<attribute name="DriverClass">oracle.jdbc.driver.OracleDriver</attribute>
<attribute name="User">username</attribute>
<attribute name="Password">password</attribute>
<attribute name="MaxPoolSize">20</attribute>
<attribute name="AcquireRetryAttempts">0</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>
推杆數據源配置分別從standalone.xml
分成{JBOSS_HOME}/standalone/deployments/c3p0-ds.xml
,ojdbc6.jar
放置在相同的目錄。
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jta="false" jndi-name="java:/jdbc/myDB" pool-name="myDB" enabled="true" use-ccm="false" use-java-context="true">
<connection-url>jdbc:oracle:thin:@server.com:1521:sid</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>ojdbc6.jar</driver>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<pool>
<min-pool-size>30</min-pool-size>
<max-pool-size>300</max-pool-size>
<prefill>true</prefill>
</pool>
<timeout>
<blocking-timeout-millis>120000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
</datasources>
web.xml
<resource-ref>
<description>
</description>
<res-ref-name>jdbc/myDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
jboss-web.xml
<resource-ref>
<res-ref-name>jdbc/myDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/jdbc/myDB</jndi-name>
</resource-ref>
在部署結束我得到錯誤: New missing/unsatisfied dependencies: service jboss.mbean.service.jboss:service=Naming.create (missing) dependents: [service jboss.mbean.service."jboss.jca:service=DataSourceBinding,name=jdbc/myDB".create] service jboss.mbean.service.jboss:service=Naming.start (missing) dependents: [service jboss.mbean.service."jboss.jca:service=DataSourceBinding,name=jdbc/myDB".start]
我試過很多的MBean '名' 的變化屬性,但似乎是問題是在依賴...需要幫助我做錯了什麼。 任何幫助將不勝感激!
EDIT: Found another approach which is described below.