commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [messenger] problem running messenger
Date Fri, 10 Jan 2003 07:26:13 GMT
Thanks for this Jukkis. Sorry it took so long to get to, but I've finally
committed your WebLogic deployment descriptor.

Incidentally rather than write 2 new programs to send & receive, you can
reuse the existing utillity programs to send & receive messages using your
config file.

e.g. instead of SendTest and Receive test you could do

java -Dorg.apache.commons.messenger=file:c:/dev/messengertest/messenger.xml
\
    org.apache.commons.messenger.tool.Producer \
    weblogic.examples.jms.exampleQueue message.txt

Where 'weblogic.examples.jms.exampleQueue' = the queue to use and
'message.txt' is a file name containing the message to be sent.

The above will send the message on the queue using your deployment
descriptor. Then to consume the message try..

java -Dorg.apache.commons.messenger=file:c:/dev/messengertest/messenger.xml
\
    org.apache.commons.messenger.tool.Consumer \
    weblogic.examples.jms.exampleQueue

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Jukka Nikki" <Jukka.Nikki@Kolumbus.fi>
To: "James Strachan" <james_strachan@yahoo.co.uk>;
<commons-user@jakarta.apache.org>
Sent: Friday, December 06, 2002 6:52 PM
Subject: VS: [messenger] problem running messenger


> Thanks James,
>
> I did find the problem. Tomcat 3.2.1 embedded inside JBuilder 5 did the
> trick. After this it was quite straightforward, some quirks still..
>
> 1) Sample messenger.xml did contain reference to dtd file that I didn't
have
> (I took reference off)
> 2) Properties needed some thought before I got them fine (studied
> javax.naming.Context static values)
> 3) Examples just needed addition of exception handling
>
> To help any of you I'll put what I did to this message. This works with
> WLS7+SP1 example server. Just install it, change configuration file path
> from source and run these from your command line..
>
> Messenger.XML
> -------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <manager>
>   <!-- WLS 7 + SP1 queue test -->
>   <messenger name="WLS_queue" jndiDestinations="true">
>     <jndi lookupName="weblogic.examples.jms.QueueConnectionFactory"
> topic="false">
>       <property>
>         <name>java.naming.factory.initial</name>
>         <value>weblogic.jndi.WLInitialContextFactory</value>
>       </property>
>       <property>
>         <name>java.naming.provider.url</name>
>         <value>t3://127.0.0.1:7001</value>
>       </property>
>     </jndi>
>   </messenger>
> </manager>
>
> SendMessage.java
> ----------------
>
> package messengertest;
>
> import org.apache.commons.messenger.*;
> import javax.jms.*;
> import javax.naming.*;
> import org.apache.commons.logging.*;
>
> public class sendMessage {
>
>   public static void main(String[] args) {
>     // sending
>     //Log log = logFactory
>     Log log = LogFactory.getLog("Tester");
>     try {
>       // --- NOTE: Change path!!!
>
MessengerManager.configure("file:c:/dev/messengertest/messenger.xml");
>       log.info("Messenger configured");
>       // get a Messenger and Destination
>       Messenger messenger = MessengerManager.get("WLS_queue");
>       log.info("WLS_queue initialized");
>       Destination destination = messenger.getDestination
> ("weblogic.examples.jms.exampleQueue");
>       log.info("Destination found");
>       // now lets send a message
>       TextMessage message = messenger.createTextMessage("testi");
>       log.info("Message created");
>       messenger.send( destination, message );
>       log.info("Message sent");
>     } catch (JMSException e) {
>       e.printStackTrace();
>       log.error("Sending error", e);
>     }
>   }
> }
>
> ReadMessage.java
> ----------------
>
> package messengertest;
>
> import org.apache.commons.messenger.*;
> import javax.jms.*;
> import org.apache.commons.logging.*;
>
> public class ReadMessage {
>
>   public static void main(String[] args) {
>     // sending
>     //Log log = logFactory
>     Log log = LogFactory.getLog("Tester");
>     try {
>       // --- NOTE: Change path!!!
>
MessengerManager.configure("file:c:/dev/messengertest/messenger.xml");
>       log.info("Messenger configured");
>       // get a Messenger and Destination
>       Messenger messenger = MessengerManager.get("WLS_queue");
>       log.info("WLS_queue initialized");
>       Destination destination = messenger.getDestination
> ("weblogic.examples.jms.exampleQueue");
>       log.info("Destination found");
>       // now lets read a message
>       Message message = messenger.receive(destination);
>       log.info("Message received");
>       System.out.println("Got text: "+((TextMessage)message).getText());
>       log.info("Message parsed");
>     } catch (JMSException e) {
>       e.printStackTrace();
>       log.error("receiving error", e);
>     }
>   }
> }
>
> If any of you needs straightforward message receiving and sending facade
> this one is easy to understand and gives some extras too..
>
> - Jukkis
>
> -----Alkuperäinen viesti-----
> Lähettäjä: James Strachan [mailto:james_strachan@yahoo.co.uk]
> Lähetetty: 6. joulukuuta 2002 20:16
> Vastaanottaja: Jukka Nikki; commons-user@jakarta.apache.org
> Aihe: Re: [messenger] problem running messenger
>
>
> From: "Jukka Nikki" <Jukka.Nikki@Kolumbus.fi>
> > Hi James,
> >
> > I'm sorry to disturb you, but I do have problem with nightly build of
> > messenger. I think I do have all needed libraries, but system halts
within
> > first test to "java.lang.NoSuchMethodError" message..
> >
> > ..
> >
> > 2002-12-06 07:41:40 - Ctx( /mestest ): Exception in: R( /mestest +
> > /sendmessageservlet + null) - java.lang.NoSuchMethodError at
> > org.apache.commons.digester.Digester.getXMLReader(Digester.java:607) at
> > org.apache.commons.digester.Digester.parse(Digester.java:1338) at
>
> The problem appears to be in digester performing a SAX parse, rather than
in
> messenger per-se. So it seems like you've an old SAX jar on the classpath
> somewhere?
>
> It might be worth trying the xml-apis-1.0b2.jar instead as thats actually
> more recent (the 2.0.* versions are wrong).
>
> http://www.ibiblio.org/maven/xml-apis/jars/
>
> Unless someone else has any bright ideas?
>
>
> >
>
org.apache.commons.messenger.MessengerManager.load(MessengerManager.java:57)
> > ..
> >
> > I'd like to know if 5.12.2002 build is stable enought or should I try
some
> > other and if these dependencies are still correct.
> >
> > commons-logging  1.0  commons-logging-1.0.jar
> > commons-beanutils  1.3  commons-beanutils-1.3.jar
> > commons-collections  2.0  commons-collections-2.0.jar
> > commons-digester  1.2  commons-digester-1.2.jar
> > servletapi  2.3  servletapi-2.3.jar
> > jms  1.0.2b  jms-1.0.2b.jar
> > xml-apis  2.0.0  xml-apis-2.0.0.jar
> > ant  1.4.1  ant-1.4.1.jar
> > junit  3.7  junit-3.7.jar
> >
> > I had some problems finding xml-apis, which is the correct place to look
> for
> > them?
> >
> > I am testing with WLS 7.0+SP1 - is there any mysteries with it?
> >
> > I'm glad if you have time to help me, this is quite nice abstraction and
> it
> > deserves to become widely used..
>
> Thanks!
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
> __________________________________________________ Do You Yahoo!?
Everything
> you'll ever need on one web page from News and Sport to Email and Music
> Charts http://uk.my.yahoo.com
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-user-help@jakarta.apache.org>
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Mime
View raw message