You don't need application-client.xml if you want to access JMS from
servlets.

You have to write your queueconnection and queues in web.xml.  Add
resoure-ref entries in web.xml
<resource-ref>
 <res-ref-name>jms/theQueueConnectionFactory</res-ref-name>
 <res-type>javax.jms.QueueConnectionFactory</res-type>
 <res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
 <res-ref-name>jms/processQueue</res-ref-name>
 <res-type>javax.jms.Queue</res-type>
 <res-auth>Container</res-auth>
</resource-ref>

Once you have the resource-ref entries in web.xml from your servlet write
the following

Context ctx = new InitialContext();
QueueConnection con =
(QueueConnection)ctx.lookup("java:comp/env/jms/theQueueConnectionFactory");
Queue queue = (Queue)ctx.lookup("java:comp/env/jms/processQueue");

I didn't understand your question of different containers?  Do you mean
different containers different orion server?
If you want to get access JMS queue/connection of different orion server
provide proper JNDI properties for obtaining InitialContext.

Example:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.evermind.server.ApplicationClientInitialContextFactory");
env.put(Context.PROVIDER_URL, "ormi://host/applicationname");
env.put(Context.SECURITY_PRINCIPAL, "username");
env.put(Context.SECURITY_CREDENTIALS, "password");
Context ctx = new InitialContext(env);
Rest of the code is common.

Hope this helps you.

----- Original Message -----
From: "Lomesh Contractor" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Sunday, November 11, 2001 10:21 PM
Subject: Urgent :: How to access JMS service from Servlet/JSP


> Hi Steve,
>
> Well, I am able to run a standalone client that accesses JMS service, but
> when I access that service using servlet it shows following error::
>
> javax.naming.NamingException: META-INF/application-client.xml resource not
> found (see J2EE spec, application-c
> lient chapter for requirements and format of the file)
>         at
>
com.evermind.server.ApplicationClientInitialContextFactory.getInitialContext
> (Unknown Source)
>         at javax.naming.spi.NamingManager.getInitialContext(Unknown
Source)
>         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
>         at javax.naming.InitialContext.init(Unknown Source)
>         at javax.naming.InitialContext.<init>(Unknown Source)
>         at elitecore.bea.web.control.ApplicationReflector.<init>(Unknown
> Source)
>         at
> elitecore.bea.web.control.ApplicationReflector.createInstances(Unknown
> Source)
>         at elitecore.bea.web.control.ApplicationReflector.<clinit>(Unknown
> Source)
>         at elitecore.bea.web.util.LoadServlet.init(Unknown Source)
>         at com.evermind._ah._axe(Unknown Source)
>         at com.evermind._ah._fpd(Unknown Source)
>         at com.evermind._ah._bae(Unknown Source)
>         at com.evermind._ah._bie(Unknown Source)
>         at com.evermind._ah.<init>(Unknown Source)
>         at com.evermind._ck._czc(Unknown Source)
>         at com.evermind._ae._czc(Unknown Source)
>         at com.evermind._ab._au(Unknown Source)
>         at com.evermind._io._twc(Unknown Source)
>         at com.evermind._io._gc(Unknown Source)
>         at com.evermind._if.run(Unknown Source)
>
> So, to eliminate this error where I have to make changes ??  Also, I want
> to access JMS service of multiple servers. So, to achieve that where could
I
> have to make changes in the configuration files (xml files).
>
> If you are familiar with accessing EJB of multiple servers then that also
> would be helpful. And if you can send sample configuration files that also
> would be helpful to me.
>
> Waiting for reply..
>
> Regards,
>
> Lomesh.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Stephen
> Davidson
> Sent: Monday, November 12, 2001 6:59 AM
> To: Orion-Interest
> Subject: Re: How to accesss JMS service from Servlet/JSP
>
>
> Lomesh Contractor wrote:
>
> > Hi All,
> >
> > How can I access JMS service of different **container(s)** from my
> > servlet/jsp ??
> >
> > Which configuration files I have to change to achieve it ?? web.xml or
> > ejb-jar.xml ??
> >
> > If so, Can you send me a sample configuration file ???
> >
> > Waiting for reply..
> >
> > Lomesh.
>
> Hi Lomesh.
>
> Check the orion docs on the JMS.xml file.  Unfortunately, I do not have
any
> good examples to send at this time.
>
> -Steve
>
> --
> Stephen Davidson
> Java Consultant
> Delphi Consultants, LLC
> http://www.delphis.com
> Phone: 214-696-6224 x208
>
>

Reply via email to