You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Len Takeuchi <lt...@salescentrix.com> on 2002/11/01 01:09:09 UTC

Problem with JMS Transport using XAQueueConnectionFactory

Hello,

I am using JMS Transport with the caller being a session EJB and I would
like to use extended transactions within the bean (i.e. if web service call
and other operations should all succeed or all should get rolled back).  The
code that I'm using from the bean method is very similar to how the call is
made in the JMS sample (except that I don't have the listener since that is
the server side of the web service).  I'm finding that using
XAQueueConnectionFactory that when the bean method gets called for the
second time, I get an error message which basically says connection with the
given ID already exists.  I'm wondering if the connection is somehow
remaining open?  As in the sample, I do call transport.shutdown() at the end
of the bean method.   Is there some way I can explicitly close the
connection (if that is indeed the problem)?  My bean method code and error
stack is at the bottom.  Any help would be appreciated.

Regards,
Len Takeuchi

body of the bean method call:
-----------------------------
        ... some business logic here ...
        String wsdd =
            "<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\" " +
                  "xmlns:java=\"" + WSDDConstants.URI_WSDD_JAVA + "\">\n" +
            " <transport name=\"JMSTransport\"
pivot=\"java:org.apache.axis.transport.jms.JMSSender\"/>\n" +
            " <service name=\"" + WSDDConstants.URI_WSDD + "\"
provider=\"java:MSG\">\n" +
            "  <parameter name=\"allowedMethods\"
value=\"AdminService\"/>\n" +
            "  <parameter name=\"className\"
value=\"org.apache.axis.utils.Admin\"/>\n" +
            " </service>\n" +
            "</deployment>";

        HashMap connectorMap = new HashMap();
        HashMap cfMap = new HashMap();
        cfMap.put( "java.naming.factory.initial",
"com.sun.jndi.fscontext.RefFSContextFactory" );
        cfMap.put( "java.naming.provider.url", "file:///i:/JNDIStore" );
        cfMap.put( "transport.jms.ConnectionFactoryJNDIName", "MyCF" );
        String destination = "MyQ";
        String username = null;
        String password = null;

        Service  service = new Service(new XMLStringProvider(wsdd));

        // create the transport
        JMSTransport transport = new JMSTransport(connectorMap, cfMap);

        // create a new Call object
        Call     call    = (Call) service.createCall();

        call.setOperationName( new QName("urn:notify", "notify") );
//        call.setOperationName( new QName("urn:xmltoday-delayed-quotes",
"getQuote") );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.AXIS_VOID );
//        call.setReturnType( XMLType.XSD_FLOAT );
        call.setTransport(transport);

        // set additional params on the call if desired
        call.setUsername( "junk" );
        call.setPassword( "junk" );
        call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
        //call.setProperty(JMSConstants.PRIORITY, new Integer(5));
        //call.setProperty(JMSConstants.DELIVERY_MODE,
        //    new Integer(javax.jms.DeliveryMode.PERSISTENT));
        //call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));

        call.setProperty(JMSConstants.DESTINATION, destination);
        call.setTimeout(new Integer(10000));


        // invoke a call for each of the symbols and print out
          call.invokeOneWay( new Object[] {"Hello"} );

        // shutdown
        transport.shutdown();

Stack trace:
------------
- Unable to connect
javax.jms.JMSException: A connection for ID "XAQC_$CONNECTION$" and user
"junk"
already exists.
        at
progress.message.jimpl.JMSExceptionUtil.createJMSException(Unknown So
urce)
        at progress.message.jimpl.Connection.<init>(Unknown Source)
        at progress.message.jimpl.QueueConnection.<init>(Unknown Source)
        at progress.message.jimpl.xa.XAQueueConnection.<init>(Unknown
Source)
        at
progress.message.jclient.xa.XAQueueConnectionFactory.createXAQueueCon
nection(Unknown Source)
        at
progress.message.jclient.xa.XAQueueConnectionFactory.createQueueConne
ction(Unknown Source)
        at
org.apache.axis.transport.jms.QueueConnector.internalConnect(QueueCon
nector.java:137)
        at
org.apache.axis.transport.jms.JMSConnector.createConnectionWithRetry(
JMSConnector.java:175)
        at
org.apache.axis.transport.jms.JMSConnector.<init>(JMSConnector.java:1
36)
        at
org.apache.axis.transport.jms.QueueConnector.<init>(QueueConnector.ja
va:103)
        at
org.apache.axis.transport.jms.JMSConnectorFactory.createConnector(JMS
ConnectorFactory.java:168)
        at
org.apache.axis.transport.jms.JMSConnectorFactory.createClientConnect
or(JMSConnectorFactory.java:122)
        at
org.apache.axis.transport.jms.JMSTransport.createConnector(JMSTranspo
rt.java:217)
        at
org.apache.axis.transport.jms.JMSTransport.setupMessageContextImpl(JM
STransport.java:144)
        at
org.apache.axis.client.Transport.setupMessageContext(Transport.java:8
5)
        at org.apache.axis.client.Call.invoke(Call.java:2081)
        at org.apache.axis.client.Call.invoke(Call.java:1851)
        at org.apache.axis.client.Call.invoke(Call.java:1777)
        at org.apache.axis.client.Call.invoke(Call.java:1315)
        at org.apache.axis.client.Call.invokeOneWay(Call.java:1347)
        at employee.EmployeeBean.getEmployees(EmployeeBean.java:232)
        at
Employee_StatelessSessionBeanWrapper0.getEmployees(Employee_Stateless
SessionBeanWrapper0.java:424)
        at employee.EmployeeServlet.doGet(EmployeeServlet.java:49)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
stDispatcher.java:720)
        at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
vletRequestDispatcher.java:305)
        at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
tHandler.java:742)
        at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:248)
        at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
Exception during call: javax.xml.rpc.JAXRPCException:
cannotConnect(cannotConnec
t)