Search code examples
jmsjndiweblogic11g

JNDI with JMS in jdeveloper 11g


I'm trying to start JMS application from OAS 10.1.2 to BeaWebLogic 11g but there is a problem locating the JMS JNDI's. When I start the server this exception is thrown:

        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

The jndi which I have mapped in the BWL console is jms/Topic.

I recieved this error on server start up:

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

Thanks in advance.


Solution

  • The answer of my question is here

    Here is how I got it to work.

    Add the following line to the weblogic.xml file.

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

    Then add the following to your web.xml file

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

    After I did that, everything worked fine. Additionally, if you are trying to configure Spring to use this data source, add the following bean.

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

    Then use your data source a appropriate. I hope this helps.