【问题标题】:JNDI with JMS in jdeveloper 11gjdeveloper 11g 中的 JNDI 和 JMS
【发布时间】:2015-05-14 22:49:47
【问题描述】:

我正在尝试将 JMS 应用程序从 OAS 10.1.2 启动到 BeaWebLogic 11g 但是定位 JMS JNDI 时出现问题。 当我启动服务器时,会引发此异常:

        weblogic.application.ModuleException: Could not setup environment
        at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1495)
        at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:438)
        at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
        Truncated. see log file for complete stacktrace
    Caused By: javax.naming.NamingException: Cannot bind null object to jndi with name jms/TopicJNDI
        at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:311)
        at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:277)
        at weblogic.deployment.EnvironmentBuilder.addConnectorRef(EnvironmentBuilder.java:277)
        at weblogic.deployment.EnvironmentBuilder.addResourceReferences(EnvironmentBuilder.java:169)
        at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:138)
        Truncated. see log file for complete stacktrace

我在 BWL 控制台中映射的 jndi 是 jms/Topic。

我在服务器启动时收到此错误:

        <An entity of type "ConnectionFactories" withname "Demo Topic Connection Factory" in JMS module "jmsModule" is not targeted. There is no sub-deployment with name "Demo Topic Connection Factory" in the configuration repository (config.xml), and so this entity will not exist anywhere in the domain.> 

提前致谢。

【问题讨论】:

    标签: jms jndi weblogic11g


    【解决方案1】:

    我的问题的答案是here

    这是我如何让它工作的。

    将以下行添加到 weblogic.xml 文件中。

    <resource-description>
    <res-ref-name>MyDataSourceRefName<res-ref-name>
    <jndi-name>jdbc/MyDataSourceNameAsDefinedInWeblogic</jndi-name>
    </resource-description>
    

    然后将以下内容添加到您的 web.xml 文件中

    <resource-ref>
    <description>Some description</description>
    <res-ref-name>MyResourceRefName</res-ref-name>
    <res-type>javax.sql.Datasource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    

    在我这样做之后,一切正常。此外,如果您尝试将 Spring 配置为使用此数据源,请添加以下 bean。

    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
    <value>MyDataSourceRefName</value>
    </property>
    </bean>
    

    然后使用适当的数据源。我希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2013-01-30
      • 2012-07-13
      • 1970-01-01
      • 2015-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多