cancel
Showing results for 
Search instead for 
Did you mean: 

JMS Configuration

Former Member
0 Kudos

Hello,

I am trying to deploy my enterprise application in SAP WAS. The application interfaces with an extrnal standalone Java Client through JMS queues. I have a MessageConsumerBean in the J2EE application. I am struggling with a few questions at this stage

1. Do i have to define a JMS connector for my application to work? if yes where would the jms-factories.xml sit? inside the EAr file?

2. Do i need to specify references to the QueueConnectionfactory and Destination Queue in both the ejb-jar.xml and ejb-j2ee-engine.xml? What is the difference?

3. In the Visual Admin tool, under Services I can see two children - JMS Provider and JMS Connector and it seems i can create QueueConnectionfactory and Queues under both the children, what is the diference in creating a Queue under the JMS Provider/Runtime as opposed to under the JMS Connector?

Any help is highly appreciated

Thanks

Dushy

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Dushy,

>> 1. Do i have to define a JMS connector for my >>application to work? if yes where would the jms->>factories.xml sit? inside the EAr file?

Depends on what you want to do in you application. If you're using an external JMS provider, then yes, you need to use the JMS connector to set your JMS provider to work with your app. More info on that - <a href="http://help.sap.com/saphelp_nw04/helpdata/en/22/cf4e71c46cdb4da31153be96c5389f/frameset.htm">here</a>.

Apart from that, the Web AS Java provides its own JMS implementation - located in the JMS Provider service. You can use that out-of-the-box. More info <a href="http://help.sap.com/saphelp_nw04/helpdata/en/90/57849e5e3e45d784afc4e3bfa8136f/frameset.htm">here</a>.

>>2. Do i need to specify references to the >>QueueConnectionfactory and Destination Queue in both >>the ejb-jar.xml and ejb-j2ee-engine.xml? What is the >>difference?

In ejb-jar.xml you define the reference (i.e. name, type, etc.). In ejb-j2ee-engine.xml you "map" the reference name from the ejb-jar.xml to, for example, the real factory name (as defined in the jms-factories.xml). For more information, see the DTD of the ejb-j2ee-engine.xml <a href="http://help.sap.com/saphelp_nw04/helpdata/en/37/30c557fad05341a951cfd051bf0b44/frameset.htm">here</a>.

The answer to your 3rd question is given with the answer to the 1st one above - the difference is that you manage factories, etc. for different JMS providers.

Hope that helps!

Message was edited by: Ivaylo Ivanov

Former Member
0 Kudos

HI Ivaylo,

Thanks for the reponse, much appreciate it. In terms of your 1st comment - thats what i thought that i could use the SAP WAS JMS Provider service, but i spent hours trying to deploy my application with referneces to the default QueueConnectionFactory and I kept getting all sorts of errors and warnings during deployment. So the only way i could deploy my app was to add jms-factories and jms-destinations.xml in my Application and physically create a new Factory and Destinations under the JMS connector service.

I thought i should be able to get away by simply creating the Queue destinations i need.

<i>So this is what my ejb-jar.xml looks like:</i>

<message-driven>

<ejb-name>MachGatewayJmsClientListenerBean</ejb-name>

<ejb-class>com.yambay.mach.is.core.jmsgateway.messagehandler.message.MachGatewayJmsClientListenerBean</ejb-class>

<transaction-type>Container</transaction-type>

<message-driven-destination>

<destination-type>javax.jms.Queue</destination-type>

</message-driven-destination>

</message-driven>

I removed all the references from the xml but sounds as though i need them

<i>and this is what my ejb-j2ee-engine.xml looks like</i>

<enterprise-bean>

<ejb-name>MachGatewayJmsClientListenerBean</ejb-name>

<message-props>

<destination-name>TestQ</destination-name>

<connection-factory-name>mDroverQueueFactory</connection-factory-name>

</message-props>

</enterprise-bean>

I will try again adding referneces to the ejb-jar.xml and using the standard queueConnectionfactory and see how it goes.

BTW - i cannot find a way to allocate points to you - seems the radio buttons for allocating points are missing-

Former Member
0 Kudos

Hi Dushy,

what errors do you get at deployment? In general, you should be able to use the default factories of the JMS provider of the J2EE Engine (see also <a href="http://help.sap.com/saphelp_nw04/helpdata/en/25/bf8f44540c469abc19fb6ac3ac7885/frameset.htm">here</a>).

Try adding back the references to the xmls and, if you get errors again, post them here so that we can try to figure out the cause of it.

Regards,

Ivo

Steven_UM
Contributor
0 Kudos

Hi folks,

I am getting the same issues so I was wondering how this story continued ...

It simply works when I perform a JNDI lookup directly on "jmsfactory/default/QueueConnectionFactory".

When I add a reference to the web.xml file

<resource-ref>

<res-ref-name>QueueFactory</res-ref-name>

<res-type>javax.jms.QueueConnectionFactory</res-type>

<res-auth>Container</res-auth>

</resource-ref>

and a reference in the web-j2ee-engine.xml file

<resource-ref>

<res-ref-name>QueueFactory</res-ref-name>

<res-link>jmsfactory/default/QueueConnectionFactory</res-link>

</resource-ref>

then I get the following naming exception error:

com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name webContainer/applications/sap.com/GM_DATA_WEB_EAR/GMData/java:comp/env/QueueFactory, cannot resolve object reference. [Root exception is com.sap.engine.services.connector.exceptions.BaseResourceException: ConnectionFactory "jmsfactory/default/QueueConnectionFactory" does not exist. Possible reasons: the connector in which ConnectionFactory "jmsfactory/default/QueueConnectionFactory" is defined is not deployed or not started

Confusing !

Regards,

Steven

Former Member
0 Kudos

Hi,

The problem here is that <res-link> should point to name which is defined in jms connector which makes connection beetween jms provider and j2ee containers. So for this case you should have jms-factories.xml file located in META-INF folder of application archive which should contains:

<?xml version="1.0" encoding="UTF-8" ?>

<jms-factories>

<connection-factory>

<factory-name>

jmsfactory/default/QueueConnectionFactory

</factory-name>

<context-factory-type>

<link-factory-name>

jmsfactory/default/XAQueueConnectionFactory

</link-factory-name>

<initial-context-factory> com.sap.engine.services.jndi.InitialContextFactoryImpl

</initial-context-factory>

<provider-url>

</provider-url>

<security-principal>

</security-principal>

<security-credentials>

</security-credentials>

</context-factory-type>

</connection-factory>

</jms-factories>

You also have easier solution without additional info in web-j2ee-engine.xml, if you want to use it please remove

<resource-ref>

<res-ref-name>QueueFactory</res-ref-name>

<res-link>jmsfactory/default/QueueConnectionFactory</res-link>

</resource-ref>

from web-j2ee-engine.xml. And add jms-factories.xml with:

<?xml version="1.0" encoding="UTF-8" ?>

<jms-factories>

<connection-factory>

<factory-name>

QueueFactory

</factory-name>

<context-factory-type>

<link-factory-name>

jmsfactory/default/XAQueueConnectionFactory

</link-factory-name>

<initial-context-factory> com.sap.engine.services.jndi.InitialContextFactoryImpl

</initial-context-factory>

<provider-url>

</provider-url>

<security-principal>

</security-principal>

<security-credentials>

</security-credentials>

</context-factory-type>

</connection-factory>

</jms-factories>

I hope this helps.

Best Regards Nikola