2011-09-06 75 views
2

我正在使用Adobe LiveCycle ES 2交鑰匙項目,它在JBoss AS 4.2.1.GA上運行。我在獲取JNDI綁定在JBoss中工作時遇到問題。這似乎與之前的帖子problem configure JBoss to work with JNDI很相似,但我當然找不到解決方案。JBoss中的JNDI綁定(LiveCycle交鑰匙)

這是我的設置。我有一個適當的-ds.xml文件:

C:\Adobe\Adobe LiveCycle ES2\jboss\server\lc_turnkey\deploy\rmb-ds.xml 

這個文件的內容如下:

<datasources> 
    <local-tx-datasource> 
     <jndi-name>RMB_DS</jndi-name> 
     <connection-url>jdbc:sqlserver://localhost\SQLEXPRESS;DatabaseName=rmb</connection-url> 
     <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class> 
     <user-name>sa</user-name> 
     <password>password</password> 
     <check-valid-connection-sql>SELECT 1 FROM sysobjects</check-valid-connection-sql> 
     <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> 
     <metadata> 
     <type-mapping>MS SQLSERVER2000</type-mapping> 
     </metadata> 
    </local-tx-datasource> 
</datasources> 

我有一個Java項目,該項目/元/的WebContent/WEB-INF/web.xml文件包含以下內容:

​​

現在,我每次部署WAR時,它失敗,出現以下錯誤:

2011-09-06 15:44:17,786 ERROR [org.jboss.deployment.MainDeployer] Could not start deployment: file:/C:/Adobe/Adobe LiveCycle ES2/jboss/server/lc_turnkey/deploy/RMB.war 
org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: resource-ref: java:RMB_DS has no valid JNDI binding. Check the jboss-web/resource-ref.) 
    at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:384) 
... 
Caused by: javax.naming.NamingException: resource-ref: java:RMB_DS has no valid JNDI binding. Check the jboss-web/resource-ref. 
    at org.jboss.web.AbstractWebDeployer.linkResourceRefs(AbstractWebDeployer.java:623) 

我100%肯定JNDI綁定本身是正確的。我可以看到在Web控制檯>系統> JMX豆類以下> jboss.jdbc> jboss.jdbc:服務=元數據,數據源= RMB_DS

MBean Name: Domain Name: jboss.jdbc 
service: metadata 
datasource: RMB_DS 
MBean Java Class: org.jboss.ejb.plugins.cmp.jdbc.metadata.DataSourceMetaData 

而且,使用的LiveCycle工作臺我可以說達到這個服務的過程並運行一些針對數據源java:/ RMB_DS的SQL。

因此,我的WAR或web.xml中必須出現錯誤嗎?我錯過了明顯的東西嗎?

回答

1

非常感謝Ketan!

所需一個JBoss-web.xml中:

<?xml version="1.0" encoding="UTF-8"?> 
<jboss-web> 
    <resource-ref> 
     <res-ref-name>RMB_DS</res-ref-name> 
     <jndi-name>java:/RMB_DS</jndi-name> 
    </resource-ref> 
</jboss-web> 

,改變了原有的web.xml中有:

<resource-ref> 
    <description>DB Connection</description> 
    <res-ref-name>RMB_DS</res-ref-name> 
    <res-type>javax.sql.DataSource</res-type> 
    <res-auth>Container</res-auth> 
</resource-ref> 

其中人民幣ds.xml中匹配

<datasources> 
    <local-tx-datasource> 
     <jndi-name>RMB_DS</jndi-name> 
     <connection-url>jdbc:sqlserver://localhost\SQLEXPRESS;DatabaseName=RMB</connection-url> 
     <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class> 
     <user-name>sa</user-name> 
     <password>password</password> 
     <check-valid-connection-sql>SELECT 1 FROM sysobjects</check-valid-connection-sql> 
     <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> 
     <metadata> 
     <type-mapping>MS SQLSERVER2000</type-mapping> 
     </metadata> 
    </local-tx-datasource> 
</datasources>