Thursday, November 6, 2014

WebLogic JMS: Failed to create managed connection due to NullPointerException

Problem:

Our SOA composite is using the JMSAdapter to poll messages from a JMS queue. However, no messages were being polled.

Our JCA file looked like this. Nothing special about it and you can see that our connection factory JNDI is set to eis/jms/Order and our queue JNDI is jms/OrderQueue.
<adapter-config name="ConsumeOrder" adapter="JMS Adapter" wsdlLocation="ConsumeOrder.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
  <connection-factory location="eis/jms/Order" UIJmsProvider="WLSJMS" UIConnectionName="EBIZPROD"/>
  <endpoint-activation portType="Consume_Message_ptt" operation="Consume_Message">
    <activation-spec className="oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec">
      <property name="PayloadType" value="TextMessage"/>
      <property name="UseMessageListener" value="false"/>
      <property name="DestinationName" value="jms/OrderQueue"/>
    </activation-spec>
  </endpoint-activation>
</adapter-config>
When we enabled the oracle.soa.adapter logger to TRACE:32, not much additional information was revealed, but these are the recurring entries we see in the soa_server1-diagnostic.log file:
[2014-11-06T00:43:18.826-05:00] [soa_server1] [TRACE] [] [oracle.soa.adapter] [tid: [ACTIVE].ExecuteThread: '27' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 7fecb0f5a423ee5f:-2152fc99:1497985c034:-8000-0000000002803edb,0] [APP: soa-infra] [SRC_CLASS: oracle.integration.platform.blocks.adapter.fw.log.LogManagerImpl] [SRC_METHOD: log] JMSAdapter SOAOrder JMSConnectionFactoryFactory_getConnectionFactory: looking up 'null' 
[2014-11-06T00:43:18.826-05:00] [soa_server1] [ERROR] [] [oracle.soa.adapter] [tid: [ACTIVE].ExecuteThread: '27' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 7fecb0f5a423ee5f:-2152fc99:1497985c034:-8000-0000000002803edb,0] [APP: soa-infra] JMSAdapter SOAOrder JMSMessageConsumer_init:[destination = JMSServer_1@jms/OrderQueue (payload = 1)]:Failed to create managed connection: java.lang.NullPointerException 
[2014-11-06T00:43:18.826-05:00] [soa_server1] [ERROR] [] [oracle.soa.adapter] [tid: [ACTIVE].ExecuteThread: '27' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 7fecb0f5a423ee5f:-2152fc99:1497985c034:-8000-0000000002803edb,0] [APP: soa-infra] JMSAdapter SOAOrder [[
javax.resource.spi.ResourceAdapterInternalException: Failed to create managed connection: java.lang.NullPointerException
        at weblogic.connector.outbound.ConnectionFactory.createResource(ConnectionFactory.java:152)
        at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1322)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResourceInternal(ResourcePoolImpl.java:428)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:352)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:332)
        at weblogic.connector.outbound.ConnectionPool.reserveResource(ConnectionPool.java:620)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:326)
        at weblogic.connector.outbound.ConnectionManagerImpl.getConnectionInfo(ConnectionManagerImpl.java:380)
        at weblogic.connector.outbound.ConnectionManagerImpl.getConnection(ConnectionManagerImpl.java:320)
        at weblogic.connector.outbound.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:129)
        at oracle.tip.adapter.jms.JmsConnectionFactory.getConnection(JmsConnectionFactory.java:93)
        at oracle.tip.adapter.jms.JMS.JMSMessageConsumer.createConsumer(JMSMessageConsumer.java:321)
        at oracle.tip.adapter.jms.JMS.JMSMessageConsumer.init(JMSMessageConsumer.java:920)
        at oracle.tip.adapter.jms.inbound.JmsConsumer.init(JmsConsumer.java:894)
        at oracle.tip.adapter.jms.JmsDDEndpoint.onDestinationsAvailable(JmsDDEndpoint.java:175)
        at weblogic.jms.extensions.JMSDestinationAvailabilityHelper$DestinationAvailabilityListenerWrapper$2.run(JMSDestinationAvailabilityHelper.java:386)
        at weblogic.jms.extensions.JMSDestinationAvailabilityHelper$DestinationAvailabilityListenerWrapper.callOutListener(JMSDestinationAvailabilityHelper.java:402)
        at weblogic.jms.extensions.JMSDestinationAvailabilityHelper$DestinationAvailabilityListenerWrapper.onDDMembershipChange(JMSDestinationAvailabilityHelper.java:383)
        at weblogic.jms.common.CDS$DD2Listener.run(CDS.java:1279)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.NullPointerException
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at oracle.tip.adapter.jms.JMS.JMSConnectionFactoryFactory.getConnectionFactory(JMSConnectionFactoryFactory.java:132)
        at oracle.tip.adapter.jms.JMS.JMSConnectionFactoryFactory.getQueueConnectionFactory(JMSConnectionFactoryFactory.java:86)
        at oracle.tip.adapter.jms.JMS.JMSConnection.init(JMSConnection.java:156)
        at oracle.tip.adapter.jms.JMS.JMSConnection.<init>(JMSConnection.java:113)
        at oracle.tip.adapter.jms.JMS.WLJMSConnection.<init>(WLJMSConnection.java:76)
        at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createConnection(JmsManagedConnectionFactory.java:311)
        at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createDefaultConnection(JmsManagedConnectionFactory.java:305)
        at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createConnection(JmsManagedConnectionFactory.java:286)
        at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createManagedConnection(JmsManagedConnectionFactory.java:92)
        at weblogic.connector.security.layer.AdapterLayer.createManagedConnection(AdapterLayer.java:803)
        at weblogic.connector.outbound.ConnectionFactory.createResource(ConnectionFactory.java:91)
        ... 20 more

Navigating to the JmsAdapter in the WebLogic Server Administration Console (navigate to Deployments > JmsAdapter > Monitoring > Outbound Connection Pools), we can see that there are considerable "Rejected Connections":

In the Oracle documentation, the definition of a "Rejected Connection" does not yield too much information:
Rejected Connections:
The total number of rejected requests for a Connector connections in this Connector Pool since the pool is instantiated.

Solution:

Looking deeper into the stack trace in the log above, it seems that getting the connection factory is returning 'null'.

1. Log in to the WebLogic Server Administration Console

2. Navigate to Deployments > JmsAdapter > Configuration > Outbound Connection Pools

3. Expand oracle.tip.adapter.jms.IJmsConnectionFactory and click on the JNDI eis/jms/Order

4. The ConnectionFactoryLocation is empty. Populate this with the appropriate value.

5. Save and redeploy the JmsAdapter.


Applicable Versions:
  • Oracle WebLogic Server 11g (10.3.5+)
  • Oracle SOA Suite 11g (11.1.1.5+) 

 

No comments: