我的web.xml中有以下配置
<resource-ref id="ResourceRef_1234567890">
<res-ref-name>jdbc/pcbDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
在部署应用程序时,我收到以下错误。
16:29:57,545 ERROR [org.jboss.as.controller.management-operation](HttpManagementService-threads - 6)JBAS014612:操作(“部署”)失败 - 地址:([(“deployment”=&gt; “APP-5.3.ear”)]) - 失败描述:{“JBAS014771:具有缺失/不可用依赖性的服务”=&gt; [ “jboss.naming.context.java.module。\”App-5.3 \“。\”WebArchive-5.1 \“。env.jdbc.pcbDB缺失[jboss.naming.context.java.jboss.resources.jdbc.pcbDB ]” ]}
之后发生回滚,
16:29:57,577 ERROR [org.jboss.as.server](HttpManagementService-threads - 6)JBAS015870:部署部署“APP-5.3.ear”,并回滚了以下失败消息: {“JBAS014771:缺少/不可用依赖项的服务”=&gt; [ “jboss.naming.context.java.module。\”App-5.3 \“。\”WebArchive-5.1 \“。env.jdbc.pcbDB缺失[jboss.naming.context.java.jboss.resources.jdbc.pcbDB ]” ]}
我在standalone.xml中创建了相应的数据源。从Web控制台Test Connection Succeeds ....
Name: pcbdb
JNDI: java:/jdbc/pcbDB
这是我在standalone.xml中的数据源定义......
<!--Here is datasource config.... As I had many spaces in xml config I couldn't add it as code..... Now I have copied it by the char comes with tilt ~ -->
<datasource jndi-name="java:/jdbc/pcbDB" pool-name="pcbdb" enabled="true">
<connection-url>jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=off)(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)(SERVER=DEDICATED)))</connection-url>
<driver>com.oracle</driver>
<pool>
<min-pool-size>3</min-pool-size>
<max-pool-size>5</max-pool-size>
</pool>
<security>
<user-name>pcbdb</user-name>
<password>passwd</password>
</security>
<validation>
<exception-sorter class-name="org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter"/>
</validation>
<timeout>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</datasource>
请给出解决方案....同样我也有context.lookup。它看起来像initCtx.lookup("java:comp/env/jdbc/pcbDB");
......这是正确的......?
答案 0 :(得分:0)
JDNI查找失败, - java:comp/env/jdbc/pcbDB
JNDI查找此字符串, - java:/jdbc/pcbDB
成功....