Hi Filip,
Thanks for your reply.
I've got pass that point but am now having new problem...(I'm using
OpenJMS)
After successfully creating the connectionFactory and the Connection, I
was prompted the following when Tomcat starts and the OpenJMS server is
alreay up and running:
[main] ERROR digester.Digester - Begin event threw exception
javax.jms.JMSException: Failed to createSession java.rmi.ServerException:
RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.net.MalformedURLException: no protocol: Group/Tomcat
at org.exolab.jms.client.rmi.RmiJmsConnectionStub.createSession(RmiJmsCo
nnectionStub.java:155)
at org.exolab.jms.client.JmsSession.<init>(JmsSession.java:225)
at org.exolab.jms.client.JmsTopicSession.<init>(JmsTopicSession.java:89)
at org.exolab.jms.client.JmsTopicConnection.createTopicSession(JmsTopicC
onnection.java:105)
at uk.org.hwlm.agent.TomcatARMValve.<init>(TomcatARMValve.java:70)
......
My code looks like this:
Hashtable prop = new Hashtable();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.exolab.jms.jndi.InitialContextFactory");
prop.put(Context.PROVIDER_URL, "rmi://localhost:1099/");
Context cxt = new InitialContext(prop);
cf = (TopicConnectionFactory)cxt.lookup("JmsTopicConnectionFactory");
con = cf.createTopicConnection();
session = con.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
......
Please note that the same code runs fine in a standalone J2ee
program. Any help would be greatly appreciated.
Thanks a lot.
Rui
On Wed, 26 May 2004, Filip Hanik (lists) wrote:
> what initial context are you trying to connect to
> you can do this:
>
> Properties props = new Properties();
> props.setProperty(...);
> Context cxt = new InitialContext(props);
>
> where you set the machine and port of the machine hosting your initial
> context. (should be the URL to the server where your JMS server is running)
> Filip
>
>
> -----Original Message-----
> From: Rui Zhang [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 26, 2004 6:45 PM
> To: Tomcat Users List
> Subject: Using JMS in Tomcat Valve
>
>
> Hi all,
>
> How can I configure tomcat to use JMS in its valve?
>
> I failed at the very beginning, when I tried to obtain the JNDI
> context, after moving the J2EE jms.jar to under server/lib.
>
> -----------------------------------
> The Exception I got was:
>
> [main] ERROR digester.Digester - Begin event threw exception
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application
> resource file: java.naming.factory.initial
>
> -----------------------------------
> My code in the valve constructor looks like the following. The same code
> runs perfectly fine in a normal J2EE application.
>
> Context cxt = new InitialContext();
> cf = (ConnectionFactory)cxt.lookup("jms/TopicConnectionFactory");
>
> con = cf.createConnection();
>
> session = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
>
> dest = (Topic)cxt.lookup("jms/hWLMTopic");
>
> producer = session.createProducer(dest);
>
> -----------------------------------
>
> Any advice will be hugely appreciated.
>
> Best regards,
>
> Rui
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.676 / Virus Database: 438 - Release Date: 5/3/2004
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.676 / Virus Database: 438 - Release Date: 5/3/2004
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]