JBoss 中的 JNDI 绑定(LiveCycle 交钥匙)

发布于 2024-12-03 06:00:12 字数 2697 浏览 2 评论 0原文

我正在使用 Adob​​e LiveCycle ES 2 交钥匙项目,它在 JBoss AS 4.2.1.GA 上运行。我在 JNDI 绑定在 JBoss 中工作时遇到问题。它看起来与之前的文章非常相似,配置 JBoss 与 JNDI 配合使用时出现问题,但我当然没有找到解决方案。

这是我的设置。我有一个 -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 项目,其 /RMB/WebContent/WEB-INF/web.xml 包含以下内容:

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

现在,每次我部署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 绑定本身是正确的。我可以在网络控制台中看到以下内容>系统> JMX Bean > jboss.jdbc> jboss.jdbc:service=metadata,datasource=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 对吧?我错过了一些明显的东西吗?

I am using Adobe LiveCycle ES 2 turnkey project, which runs on JBoss AS 4.2.1.GA. I am having a problem getting a JNDI binding to work in JBoss. It seems eerily similar to an earlier post, problem configure JBoss to work with JNDI, but I certainly have found no solution.

This is my setup. I have a -ds.xml file in place:

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

The contents of that file are as follows:

<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>

I have a Java project, whose /RMB/WebContent/WEB-INF/web.xml contains the following:

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

Now, every time I deploy the WAR, it fails with the following error:

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)

I am 100% positive that the JNDI binding itself is correct. I can see the following in web console > System > JMX Beans > jboss.jdbc > jboss.jdbc:service=metadata,datasource=RMB_DS

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

Also, using LiveCycle workbench I can make a process that hits this service and runs some SQL against datasource java:/RMB_DS..

SO, there has to be something wrong with my WAR or web.xml right? Am I missing something obvious?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨曦÷微暖 2024-12-10 06:00:12

感谢 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>

与 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>

Thanks to Ketan, who is awesome!

Needed a 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>

And changed the original web.xml to have:

<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>

Which matches 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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文