Author |
Message
|
murugaanandam |
Posted: Mon May 24, 2004 11:31 pm Post subject: MQServer with JMS without using Application Server |
|
|
Novice
Joined: 22 Apr 2004 Posts: 19
|
Dear all,
i have one doubt, like
i want to commiunicate MQServer with JMS without using Application Server.
for example,
QueueConnection conn = null;
try
{
InitialContext ctx = new InitialContext();
QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup(qcfName);
Queue senderQ = (Queue) ctx.lookup(queueName);
conn = qcf.createQueueConnection();
conn.start();
QueueSession session =
conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
TextMessage message = session.createTextMessage(msg);
QueueSender sender = session.createSender(senderQ);
sender.send(message);
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
if(conn != null)
{
try
{
conn.close();
conn = null;
}
catch (javax.jms.JMSException je)
{
je.printStackTrace();
}
}
}
}
my doubt is
its possible to create initialcontext object without passing PROVIDER_URL
plz explain me
thanx in advance
regards
muruganandam |
|
Back to top |
|
 |
fschofer |
Posted: Tue May 25, 2004 12:13 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
Hi,
you do not have to use WAS as JNDI provider, you can also use the filesystem or a LDAP server.
There are also some samples for using JMS without JNDI included in the MQ installation (at least in the windows version).
For example take a look at <MQ Install>/Tools/Java/jms/PTPSample01.java
Greetings
Frank |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 25, 2004 4:02 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, there are specific steps outline in the Using Java manual for building a QCF and etc at runtime - without using JNDI at all. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Tue May 25, 2004 5:27 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
|
Back to top |
|
 |
murugaanandam |
Posted: Wed May 26, 2004 1:12 am Post subject: Can't find SerialContextProvider |
|
|
Novice
Joined: 22 Apr 2004 Posts: 19
|
dear all
i run my java application
i got some exception
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
a:63)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120
)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at JMSTester.main(JMSTester.java:19)
how to resolve this prblm
plz help me solve the pbm |
|
Back to top |
|
 |
JLRowe |
Posted: Wed May 26, 2004 5:13 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
You have no naming service.
You need to decide whether you want to:
1) Create the JMS objects within the code, this will tie your code down to the JMS provider - MQSeries.
2) Use a naming service such as fscontext which allows you to store managed objects in the file system, you will need to use the JMS admin tool to setup the managed objects. This approach isolates your code from the JMS implementation.
I would suggest you muddle your way through (1), and then decide what to do. The MQSeries programming with Java manual gives *plenty* of details and some example code. |
|
Back to top |
|
 |
|