Bug 738615 - Cannot use non XA connection factory in a servlet
Summary: Cannot use non XA connection factory in a servlet
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-jca
Version: 2.0
Hardware: All
OS: All
unspecified
urgent
Target Milestone: 2.1.2
: ---
Assignee: messaging-bugs
QA Contact: MRG Quality Engineering
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-15 11:45 UTC by Martin Vecera
Modified: 2012-12-07 17:45 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Martin Vecera 2011-09-15 11:45:13 UTC
Connection factory configured like this:

  <tx-connection-factory>
    <jndi-name>QpidJMS</jndi-name>
    <xa-transaction/>
    <rar-name>qpid-ra.rar</rar-name>
    <local-transaction/>
    <connection-definition>org.apache.qpid.ra.QpidRAConnectionFactory</connection-definition>
    <config-property name="useLocalTx" type="java.lang.Boolean">true</config-property>
    <config-property name="connectionURL">amqp://guest:guest@/test?brokerlist='tcp://mrg01.mw.lab.eng.bos.redhat.com:5672'</config-property>
    <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
    <max-pool-size>20</max-pool-size>
  </tx-connection-factory>

cannot be used in a servlet. An attempt to create a session with this connection throws:

13:33:13,733 WARN  [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
java.lang.NullPointerException
	at org.apache.qpid.ra.QpidRAManagedConnection.getXAResource(QpidRAManagedConnection.java:462)
	at org.jboss.resource.connectionmanager.TxConnectionManager.createConnectionListener(TxConnectionManager.java:557)
	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:643)
	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:273)
	at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:690)
	at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
	at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:424)
	at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
	at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
	at org.apache.qpid.ra.QpidRASessionFactoryImpl.allocateConnection(QpidRASessionFactoryImpl.java:850)
	at org.apache.qpid.ra.QpidRASessionFactoryImpl.createSession(QpidRASessionFactoryImpl.java:483)
	at org.jboss.test.mdb.MRGBasicOpServlet.doGet(MRGBasicOpServlet.java:46)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
	at java.lang.Thread.run(Thread.java:619)
13:33:13,734 ERROR [QpidRASessionFactoryImpl] Could not create session
javax.resource.ResourceException: Unable to get managed connection for QpidJMS
	at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:441)
	at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:424)
	at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
	at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
	at org.apache.qpid.ra.QpidRASessionFactoryImpl.allocateConnection(QpidRASessionFactoryImpl.java:850)
	at org.apache.qpid.ra.QpidRASessionFactoryImpl.createSession(QpidRASessionFactoryImpl.java:483)
	at org.jboss.test.mdb.MRGBasicOpServlet.doGet(MRGBasicOpServlet.java:46)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.resource.JBossResourceException: Unexpected throwable while trying to create a connection: null; - nested throwable: (java.lang.NullPointerException)
	at org.jboss.resource.JBossResourceException.rethrowAsResourceException(JBossResourceException.java:61)
	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:304)
	at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:690)
	at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
	... 28 more
Caused by: java.lang.NullPointerException
	at org.apache.qpid.ra.QpidRAManagedConnection.getXAResource(QpidRAManagedConnection.java:462)
	at org.jboss.resource.connectionmanager.TxConnectionManager.createConnectionListener(TxConnectionManager.java:557)
	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:643)
	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:273)
	... 30 more


Steps to reproduce:

1. checkout https://svn.devel.redhat.com/repos/jboss-qa/mrg/tests/mdb
2a. fix annotation in
/mdb-ejb/src/main/java/org/jboss/test/mdb/MRGJCAMessageBean.java to point to
your MRG server (this class is not used in the test, but could prevent deployment)
2b. set @Resource(mappedName = "java:/QpidJMS") for ConnectionFactory field in mdb/mdb-servlet/src/main/java/org/jboss/test/mdb/MRGBasicOpServlet.java
3. compile with mvn -DskipTests clean package
4. copy mdb/mdb-test/target/mdb-test.ear to deploy directory of EAP 5.1.1
(profile production)
5. checkout https://svn.devel.redhat.com/repos/jboss-qa/mrg/qpid-java-jca
6. configure qpid-java-jca/qpid-jca-ds.xml to point to your MRG server
7. copy qpid-java-jca/qpid* to server's deploy directory
7. Start EAP
8. Go to http://localhost:8080/mdb-servlet/mrgbasic and see server log.

Comment 1 Andrew Stitcher 2011-09-22 13:30:36 UTC
This has been fixed in package qpid-java-jca-0.10-10

Comment 3 Martin Vecera 2011-10-10 13:39:41 UTC
This issue is still present in qpid-java-jca-0.10-10:

2011-10-10 07:31:50,989 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/mdb-servlet].[MRGTestServlet]] (http-127.0.0.1-8080-1) Servlet.service() for servlet MRGTestServlet threw exception
java.io.IOException: javax.jms.JMSException: Could not create a session: Unable to get managed connection for QpidJMS
        at org.jboss.test.mdb.TestUtil.processRequest(TestUtil.java:412)
        at org.jboss.test.mdb.MRGTestServlet.doGet(MRGTestServlet.java:35)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
        at java.lang.Thread.run(Thread.java:662)
Caused by: javax.jms.JMSException: Could not create a session: Unable to get managed connection for QpidJMS
        at org.apache.qpid.ra.QpidRASessionFactoryImpl.allocateConnection(QpidRASessionFactoryImpl.java:894)
        at org.apache.qpid.ra.QpidRASessionFactoryImpl.createSession(QpidRASessionFactoryImpl.java:483)
        at org.jboss.test.mdb.TestUtil.test01(TestUtil.java:202)
        at org.jboss.test.mdb.TestUtil.processRequest(TestUtil.java:403)
        ... 23 more

Comment 4 Martin Vecera 2011-10-10 14:34:08 UTC
(In reply to comment #3)
> This issue is still present in qpid-java-jca-0.10-10:
> 
> 2011-10-10 07:31:50,989 ERROR
> [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/mdb-servlet].[MRGTestServlet]]
> (http-127.0.0.1-8080-1) Servlet.service() for servlet MRGTestServlet threw
> exception
> java.io.IOException: javax.jms.JMSException: Could not create a session: Unable
> to get managed connection for QpidJMS
>         at org.jboss.test.mdb.TestUtil.processRequest(TestUtil.java:412)
>         at org.jboss.test.mdb.MRGTestServlet.doGet(MRGTestServlet.java:35)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
>         at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
>         at
> org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
>         at
> org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>         at
> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
>         at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
>         at java.lang.Thread.run(Thread.java:662)
> Caused by: javax.jms.JMSException: Could not create a session: Unable to get
> managed connection for QpidJMS
>         at
> org.apache.qpid.ra.QpidRASessionFactoryImpl.allocateConnection(QpidRASessionFactoryImpl.java:894)
>         at
> org.apache.qpid.ra.QpidRASessionFactoryImpl.createSession(QpidRASessionFactoryImpl.java:483)
>         at org.jboss.test.mdb.TestUtil.test01(TestUtil.java:202)
>         at org.jboss.test.mdb.TestUtil.processRequest(TestUtil.java:403)
>         ... 23 more

Ignore Comment #3 for now please. It seems to be a bug in Qpid installation...

Comment 5 Martin Vecera 2011-10-14 13:41:53 UTC
This now works in 0.10-10

Comment 6 Martin Vecera 2011-10-21 07:26:08 UTC
Why did you change status to ON_QA when I already set it to VERIFIED?


Note You need to log in before you can comment on or make changes to this bug.