cancel
Showing results for 
Search instead for 
Did you mean: 

JMS configuration

Former Member
0 Kudos

Hi !

On development of MDBs I have configured a JMSQueue within Visual Administrator as follows:

Service: JMS Provider

JMS Server Instances: default

created: SupplierXYZQueue (lookup: jmsqueues/default/SupplierXYZQueue)

uses: QueueConnectionFactory (lookup: jmsfactory/default/QueueConnectionFactory)

So far, so good; everything defined shows up within JNDI as defined.

On deployment, SDM mourns about something not running. As far as I figured out, I have to define the JMS stuff at service JMSConnector as well.

How is this done, I've checked the help files but could not make it (needs a better man than I am).

Trying to provide the JMSConnector with ApplicationName (Supplier in this case) and FactoryName (I tried with QueueConnectionFactory -> see above) simply fails for whatever reason.

Help appreciated !

Accepted Solutions (1)

Accepted Solutions (1)

guru_subramanianb
Active Contributor
0 Kudos
Former Member
0 Kudos

OK, have made it so far, but:

Exception:

javax.jms.JMSException: The following hosts (hostname:port) cannot be accessed: . Check host names and ports.

at com.sap.jms.client.connection.ConnectionFactory.getSocket(ConnectionFactory.java:447)

at com.sap.jms.client.connection.ConnectionFactory.createConnection(ConnectionFactory.java:300)

at com.sap.jms.client.connection.QueueConnectionFactory.createQueueConnection(QueueConnectionFactory.java:77)

at brockhaus.j2ee.cart.components.supplier.TestSupplier.main(TestSupplier.java:46)

Here is the code:

Properties props = new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");

props.put(Context.PROVIDER_URL, "localhost:50004");

props.put(Context.SECURITY_PRINCIPAL, "Administrator");

props.put(Context.SECURITY_CREDENTIALS, "****");

InitialContext ctx = new InitialContext(props);

QueueConnectionFactory factory;

factory = (QueueConnectionFactory) ctx.lookup("jmsfactory/default/SupplierQueueConnectionFactory");

Queue queue = (Queue) ctx.lookup("jmsqueues/default/SupplierQueue");

QueueConnection connection = factory.createQueueConnection(); // Here's the bang !!

Any idea ??

Answers (2)

Answers (2)

Former Member
0 Kudos

Well, just to summarize what I've done.

(1) Developed the Bean (no big Deal), build the ear file (SupplierEar.ear)

(2) Configured a new Queue using JMS Provider Service / default / create new Queue

(3) Configured a Factory within JMS Provider Service

(4) Checked everything within JNDI, all there

(5) Deployment failed FOR WHATEVER REASON, removed it.

(6) Tried to define the stuff within JMS Connector Service; first the Factory: Application -> SupplierEar and so on

(7) Redeployed ear; Definition of Step(6) gone FOR WHATEVER REASON

(8) Invocation of testclass (see code above) Exception as mentioned.

What is going wrong ???

Using a different App.-server you don't have to configure any (JMS) administrable object it simply works after deployment !

Regards

M.

Former Member
0 Kudos

> Well, just to summarize what I've done.

>

>

> What is going wrong ???

>

> Using a different App.-server you don't have to

> configure any (JMS) administrable object it simply

> works after deployment !

>

> Regards

>

> M.

And how so ? That's probably because all those definitions to jndi were done in the deployment descriptor....

You need to have defined:

a) a JMS Provider

b) the jndi information for the JMS administered objects

c) possibly as well the resource reference information for above marked b) jndi information

All this goes into your EAR.

Enjoy

Former Member
0 Kudos

Hello Matthias,

You can try connecting to the queue using this code:

Context jndiContext = new InitialContext();

QueueConnectionFactory qfactory =

(QueueConnectionFactory) jndiContext.lookup(

"jmsFactory/"+getAConstant().findconstantvalue("MDB_QUEUE_FACTORY"));

javax.jms.Queue queue = (javax.jms.Queue) jndiContext.lookup("jmsQueues/"+getAConstant().findconstantvalue("MDB_QUEUE"));

QueueConnection qconnect =

qfactory.createQueueConnection(getAConstant().findconstantvalue("MDB_REQUEST_LOGIN"), getAConstant().findconstantvalue("MDB_REQUEST_PASSWORD"));

QueueSession qsession = qconnect.createQueueSession(false,

javax.jms.Session.AUTO_ACKNOWLEDGE);

QueueSender sender = qsession.createSender(queue);

Just replace the constants by your specific values.

This worked for me! I don't see much difference/error in your code upfront. However, you can try this.

Cheers,

Rahul

Former Member
0 Kudos

Hi Rahul,

but where is getAConstant() defined ???

ndiContext.lookup(

"jmsFactory/"+getAConstant().findconstantvalue("MDB_QUEUE_FACTORY"))

Regards

M.