Discussion between me and some Sun folks for getting JNDI mode to work
in the outbound direction
with SJS MQ.
- Binod.
attached mail follows:
Many many thanks for the help. I feel daft, the object registered in
the directory was indeed a QueueConnectionFactory rather than the XA
version! :-[
Managed to produce a message on to the queue via the ra via directory
lookup, using a pool in the app server. :-)
Now the next step is to try and get things consumed via an MDB. The
deployment descriptors for J2EE 1.4 look very different from those of
J2EE 1.3 - yoiks!
Cheers
Donald
Binod wrote:
> Generic RA does work with XA in both directions. That was one of the
> criterions during development.
>
> Your configuration of RA seem to be fine. Now, when you create
> resources in MQ, did you create
> XA versions?
>
> The imqobjmanager usage below seems to show that you nee to give -t xqf
>
> - Binod.
>
>
> [bp122320_at_javasoft12 : /wksp/gf.checkin/publish/gf/imq/bin] $
> ./imqobjmgr -h
> imqobjmgr usage:
>
> imqobjmgr <subcommand> [<options>]
> imqobjmgr -i <commandfile>
> imqobjmgr -h
> imqobjmgr -H
> imqobjmgr -v
>
> imqobjmgr subcommands:
> add : Add an administered object.
> delete : Delete an administered object.
> list : List administered objects.
> query : Query and display an administered object.
> update : Update/modify an existing administered object in the
> store.
>
> imqobjmgr options:
> -f : Perform action without user confirmation.
> -h, -help : Display usage help.
> -H, -Help : Display usage help, attribute list, and examples.
> -i : Specifies a command file containing the command to
> execute, and some or all the required information.
> -j : Specify object store (JNDI) attributes.
> -l : JNDI lookup name of the administered
> object to the service provider; this must
> be a unique name.
> -javahome : Specify an alternate Java 2 compatible runtime to use.
> Default is to use the bundled runtime.
> -o : Specify object attributes.
> -pre : Preview mode. Show what will be done without doing
> it.
> -s : Silent mode. No output will be displayed.
> -r : Set the read-only state of the object when creating
> or updating.
> state = {true, false} where
> true = object state will be read-only
> false = object state will not be read-only
> -t : Type of the administered object
> type = {q, t, cf, qf, tf, xcf, xqf, xtf, e} where
> q = JMS Queue
> t = JMS Topic
> cf = JMS ConnectionFactory
> qf = JMS QueueConnectionFactory
> tf = JMS TopicConnectionFactory
> xcf = JMS XA ConnectionFactory
> xqf = JMS XA QueueConnectionFactory
> xtf = JMS XA TopicConnectionFactory
> -v, -version : Display version information.
>
>
>
>
> - Binod.
>
>> Hi Binod,
>>
>> Thanks for looking into this.
>>
>> As to your points I do create some jndi external resources in the
>> scripts that I have been using to connect to the queues without using
>> the resource adapter. Mainly so that I can write the test
>> applications to write to and consume from the queues but also to
>> check the operation is the same via either mechanism.
>>
>> I have tried switching the order of 2 & 3 round and it does seem to
>> make a difference. The exception I am now getting is:-
>>
>> [#|2005-11-18T10:16:08.778+0000|WARNING|sun-appserver-ee8.1_02|javax.enterprise.system.stream.err|_ThreadID=14;|
>>
>> java.lang.ClassCastException: com.sun.messaging.QueueConnectionFactory
>> at
>> com.sun.genericra.outbound.ManagedQueueConnectionFactory.createXAConnection(ManagedQueueConnectionFactory.java:45)
>>
>> at
>> com.sun.genericra.outbound.AbstractManagedConnectionFactory.createPhysicalConnection(AbstractManagedConnectionFactory.java:127)
>>
>> at
>> com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:111)
>>
>> at
>> com.sun.enterprise.resource.ConnectorAllocator.createResource(ConnectorAllocator.java:90)
>>
>> at
>> com.sun.enterprise.resource.IASNonSharedResourcePool.createResourceAndAddToPool(IASNonSharedResourcePool.java:1111)
>>
>> at
>> com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:488)
>>
>> at
>> com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:166)
>>
>> at
>> com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:312)
>>
>> at
>> com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:250)
>>
>> at
>> com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:211)
>>
>> at
>> com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:172)
>>
>> at
>> com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:268)
>>
>> at
>> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:147)
>>
>> at
>> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:122)
>>
>> at
>> com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:69)
>>
>> at
>> com.sun.mq_tests.implementation.Queue_Impl.getConnection(Queue_Impl.java:47)
>>
>> at
>> com.sun.mq_tests.implementation.Queue_Impl.writeMsgsToQueue(Queue_Impl.java:100)
>>
>> at
>> com.sun.mq_tests.implementation.QueueProducerThread.run(QueueProducerThread.java:37)
>>
>> at
>> com.sun.mq_tests.implementation.ConcurrentMessageProducer_Impl.produceToQueue(ConcurrentMessageProducer_Impl.java:62)
>>
>> at
>> org.apache.jsp.jsp.producer_jsp._jspService(producer_jsp.java:98)
>> at
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
>> at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
>>
>> at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
>> at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
>> at
>> org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
>> at
>> org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
>>
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
>>
>> at
>> org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
>>
>> at
>> org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
>>
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
>>
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
>>
>> at
>> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
>>
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
>>
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
>>
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
>>
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
>>
>> at
>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
>> at
>> com.sun.enterprise.web.connector.httpservice.HttpServiceProcessor.process(HttpServiceProcessor.java:226)
>>
>> at
>> com.sun.enterprise.web.HttpServiceWebContainer.service(HttpServiceWebContainer.java:2071)
>>
>>
>> My conclusion from this was that I am at least now getting the
>> resource adapter registered. (Class cast issues rather than null
>> pointer ones) but that I was using the incorrect factory. (With the
>> external JNDI resources you can specify the type as
>> javax.jms.QueueConnectionFactory.) As such I have tried changing the
>> deployment scripts so that the connectordefinition in the connector
>> connection pool is javax.jms.XAQueueConnectionFactory but that seems
>> to result in the following deployment error:-
>>
>> Operation 'createConnectorConnectionPool' failed in 'resources'
>> Config Mbean.
>> Target exception message: Invalid connection definition. Connector
>> Module with connection definition
>> (javax.jms.XAQueueConnectionFactory) not found
>> CLI137 Command create-connector-connection-pool failed.
>>
>> This would suggest to me that I need to add something to the
>> deployment of the RAR to enable XA capability. Not sure what options
>> there are available to me on this. Any suggestions or am I barking
>> up the wrong tree?
>>
>> Many thanks
>>
>>
>>
>> Donald
>> PS. Assuming I do get these config problems cracked do you know if
>> XA transactions via the genericra with administered objects in an
>> external directory is supported?
>>
>> Binod wrote:
>>
>>> Hi Donald,
>>>
>>> I have been looking at the scripts you have created. There you seem
>>> to do create-jndi-resource. This command is used
>>> to create a resource that is pointing to an object bound in an
>>> external JNDI provider. This functionality is not required
>>> by the generic resource adapter.
>>>
>>> Basically follow the following high level tasks.
>>>
>>> 1. Create JMS administered objects in MQ using MQ commands.
>>>
>>> 2. Create a resource adapter configuration with JNDI provider
>>> configuration specifying stuff like
>>> initial context factory and provider URL. Try this task before
>>> deployment. Ideally this should have worked after
>>> deployment also. In any case, your domain.xml does not contain
>>> values for this. May be a bug in appserver.
>>>
>>> 3. Deploy the resource adapter.
>>>
>>> 4. Create pools and resources.
>>>
>>> 5. If you have MDBs, configure their deployment descriptors with
>>> proper values.
>>>
>>> 6. Deploy your app.
>>>
>>> 7. Run it.
>>>
>>> It seems, the only thing you did differently is the order of steps 2
>>> and 3.
>>>
>>> - Binod.
>>>
>>>> Hi Binod,
>>>>
>>>> Thanks for getting back to me so quickly.
>>>>
>>>> Attached is the domain.xml and a bunch of scripts that I have been
>>>> using to try and configure the app server. If you want to use them
>>>> you will need to do a little setup. Specifically ensure that the
>>>> rar and imq jar files are located appropriately and setup a
>>>> directory server and register a factory and destination in there
>>>> accordingly.
>>>>
>>>> As to the version of the RA I am using the 1.0 version, downloaded
>>>> recently from
>>>> https://genericjmsra.dev.java.net/servlets/ProjectDocumentList?folderID=4219&expandFolder=4219&folderID=4218
>>>>
>>>>
>>>> I have been reading the user guide and tibco example, without these
>>>> I think I would still be at stage one.
>>>>
>>>> Regards
>>>>
>>>>
>>>>
>>>> Donald
>>>>
>>>> Binod wrote:
>>>
>>>
>>>
>>>
>>>
>>>
>
>