JMS & Servlets

Hi
I'm wondering if anyone could help, I've been looking at creating a servlet with various methods and also sets up its own sleep time, Also these methods of the servlet can be invoked at any time using a JMS message.
Im not exactly sure how to go about this, or if I could set up the doGet as some kind of listener or what ever? ... and if doGet and doPost in Java servlets can accept anything other than HttpRequest and HttpResponse?
The kind of thing I was thinking of doing was. [excuse my psuedo code]
public void doGet ( .... ) throws .....
getMessage(params) //accept JMS message and its parameters
doPost(params)
public void doPost (....) throws .....
if params.value = 1 // depending on parameter value, do method call
method1()
if params.value = 2
method2()
else // if parameter value not what expected, then call sleepMethod
sleepMethod()
Anyone with any help, suggestions, ideas or thoughts on this ?

Thanks for the replies !!!!!!
The servlet is to monitor a list of escalations and create an event by calling on other methods when appropriate. This process is to be managed by a test and sleep mechanism that can be interrupted by a a JMS message. This JMS message causes the class to either invoke an escalation immediately (driven by an Escalate verb) or simply run the test / sleep process.
I am developing this in a JRun environment using EJBs, and it is implemented as a servelet to get around the inadequacies in the JRun JMS deployment for EJBs.

Similar Messages

  • New to EJB, JMS

    I recently started to understand the concepts and examples around EJB, JMS, servlets. Now I am trying to understand how does UserTransactions (JTA) works in an environment where there is a TIBCO server that handles the queues and transactions to Oracle that gets handled by JBoss. I am just trying to understand what happens between utx.begin and utx.commit or utx.rollback when there are calls specific to JMS and JDBC are involved (in my case Tibco and Jboss). Does everything gets rolled back or commit ? I couldn't find any material that clears such concept. Best I could get was some information about Bean Managed transaction in JavaEE 5 tutorial. It would be great and helpful if someone could direct me to good resources or if somebody could explain it to me.

    JTA can make your queue and database a single unit of work. If the database process fails, the message is put back on the queue. You have to use XA database drivers and two-phase commit.
    For somebody who's new, this is a pretty advanced topic.
    %

  • Java JMS

    Hello
    Does anyone know any good step by step guide or what ever, to set up Orion 2.0.7 working as a JMS servlet client towards Sun Application Server 9.1?
    I've already have developed a code-snippet for placing an retrieving messages from the MQ-box (remote btw), and runs smooth from commandline.
    However,,, when trying to apply the code into Orion, I get a whole world of issues.
    Tried most adapters I can think off, and everything seems to freeze when calling the InitialContextFactory for setup.
    I've tried the following:_
    MARK:removed real IP with ???.???.???.???:3700
             String useTestNr = "1";
             String factory = "";
             String providerURL = "";
             String pkgs = "";
             String state = "";
             if(useTestNr.equals("1")){  /*** STATUS = freezes up */
                  // TEST 1
                  factory      = "com.sun.enterprise.naming.SerialInitContextFactory";        
                  providerURL = "iiop://???.???.???.???:3700;
                  pkgs        = "com.sun.enterprise.naming";
                  state       = "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl";
             if(useTestNr.equals("2")){     /*** STATUS =freezes on text: "INFO: sumOfAllWeights = 10" */
                  // TEST 3
                  factory      = "com.sun.appserv.naming.S1ASCtxFactory";
                  //providerURL = "iiop://???.???.???.???:3700";
                  providerURL = "corbaname:iiop:???.???.???.???:3700";
                  pkgs        = "com.sun.enterprise.naming";
                  state       = "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl";
             if(useTestNr.equals("3")){  /*** STATUS = javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0] */            
                  // TEST 2
                  factory      = "com.sun.jndi.cosnaming.CNCtxFactory";
                  providerURL = "iiop://???.???.???.???:3700";
                  pkgs        = "com.sun.enterprise.naming";
                  state       = "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl";         
             if(useTestNr.equals("4")){     /*** STATUS = Server protocol was not ORMI. Sun app server aint got ORMI right??*/
                  // TEST 4         
                  factory      = "com.evermind.server.rmi.RMIInitialContextFactory";
                  providerURL = "iiop://???.???.???.???:3700";
                  pkgs        = "com.sun.enterprise.naming";
                  state       = "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl";                     
                   System.setProperty("java.naming.factory.initial", factory);                
                   System.setProperty("java.naming.factory.url.pkgs",pkgs);
                   System.setProperty("java.naming.factory.state",   state);
                   System.setProperty("org.omg.CORBA.ORBInitialHost",     mqServer);
                   System.setProperty("org.omg.CORBA.ORBInitialPort",     mqServerPort);
                   System.setProperty(Context.PROVIDER_URL, providerURL);
                  System.out.println("--Adding System.props to IntialContext()...--");
                 context = (Context) (new InitialContext());  // ALLWAYS freezes here on Orion
    {code}
    I've tried the:
    {code}
    Hashtable env = new Hashtable();
    en.put(......)
    context = (Context) (new InitialContext(env))
    {code}
    as well, but gets the same results
    Allso tried different versions of iiop, ormi etc, but never seem to get quite "there"
    Please please advice,,,been struggling with this the last month
    Cincerely Paul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    Assuming
    - you have got UDQ's
    - JMS client also working in a clustered fashion i,e not a singleton JMS client.
    -JMS client not connected to specific UDQ instance
    - JMS client has got 'all' message selectors on  ( and not just a few selectors on..)
    As soon as a message arrives on the UDQ instance . you JMS client  should be able to apply message selector and read the message from the queue as long as it matches the selection.
    have you got your client consuming only specific types on messages or not consuming any messages at all ?
    Sri

  • Certification C_JA320_70

    Hi All,
    I am appearing for the C_JA320_70 certification- Java with SAP NetWeaver 7.0
    Can anyone tell me the pattern for this certification?
    What percentage concentrates purely on Java ? ( EJB / JMS / Servlets etc..)
    Any help will be appreciated!
    Veena.

    Hi,
    Just check out the link below which depicts percentage alloted for the each competency.
    http://www.sap.com/services/education/certification/certificationtest.epx?context=%5b%5bC_JA320_70%5d%5d%7c
    Rgds
    Radhakrishna D S

  • Thread count setting in WLS 7

    Hello,
    I would like to know if I can allocate a set of 'n' threads for a particular
    business process in WLS 7.0. In WLS 5.1 there used to be threads for JMS, servlets
    and the execute threads. Is it possible to achieve something similar in WLS 7
    Thanks,
    Aswin.

    Hello Aswin,
    Refer to the following link for more information regarding the creation of execute
    queues:
    http://edocs.bea.com/wls/docs70/ConsoleHelp/domain_executequeue_config.html
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Aswin Dinakar" <[email protected]> wrote:
    >
    Hello,
    I would like to know if I can allocate a set of 'n' threads for
    a particular
    business process in WLS 7.0. In WLS 5.1 there used to be threads for
    JMS, servlets
    and the execute threads. Is it possible to achieve something similar
    in WLS 7
    Thanks,
    Aswin.

  • Send JMS Message to OJMS in a Servlet?

    I'm trying to get my servlet to send a message to a JMS queue hosted by OJMS. I have had the code working with the default JMS provider (in-memory only). I can't fathom what the appropriate JNDI names are for the connection factory and queue when using the resource-provider mechanism.
    The Docs suggest it's dead simple but don't give a single example to work from!
    In application.xml I have:
         <!-- JMS Resource Definition -->     
         <resource-provider class="oracle.jms.OjmsContext" name="myJMS">
              <description> OJMS/AQ </description>
              <property name="datasource" value="jdbc/myDS_OCI" />
         </resource-provider>
    The datasource connects to my Oracle 9i database and the schema contains a Queue Table with two queues in it. The one I want to use is called Timed_Event_Queue there.
    According to the docs, I should be able to do a lookup something like
    ctx.lookup("java:comp/resource/myJMS/Queues/Timed_Event_Queue")
    but I can't get anything to even pretend to work!
    I'm working with OC4J 9.0.4 at the moment.
    Any suggestions??
    Thanks,
    -Dominic

    Dominic,
    Were you able to get the QueueConnectionFactory? I have tried this on OC4J 903 and it does work fine. Is there some error message thrown at the OC4J console?
    If you want a sample code, then feel free to mail me at [email protected]
    Hope this helps,
    Rajat

  • Passing XML payload from Servlet to JMS

    Hi All,
    My requirement is that servlet will receive the HTTP request , convert it into XML format and publish it to JMS queue.
    Now, I am stuck at the part where I need to publish the XML payload to JMS queue.
    Is it possible to send the XML payload from servlet to JMS queue? Is yes, please let me know how can we achieve this.
    Thanks

    I suggest you go to the following page: [http://edocs.bea.com/wls/docs103/pdf.html] .
    In the "Programming" section, download and read at least "Programming WebLogic JMS" and perhaps "Developing Web Applications, Servlets, and JSPs for WebLogic Server" and "Developing Applications with WebLogic Server".

  • Javax.servlet.ServletException: javax/jms/JMSException

    Hi,
    I am trying to deploy a web application in tomcat 5.5, the application is trying to connect to BPEL using RMI. It throws the next exception when trying to retrieve the worklist:
    javax.servlet.ServletException: javax/jms/JMSException
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)....
    It works fine in the OC4J
    Please Help!!!

    Hi,
    I am trying to deploy a web application in tomcat 5.5, the application is trying to connect to BPEL using RMI. It throws the next exception when trying to retrieve the worklist:
    javax.servlet.ServletException: javax/jms/JMSException
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)....
    It works fine in the OC4J
    Please Help!!!

  • Sending a JMS message from a Servlet

    Hello All
    I�m using the Sun Java Sysytem Application Server and have been trying to implement a servlet which on receipt of a Post message, takes the message and sends it using JMS to a message queue. I�m developing my first web application so all is fairly new to me but I desparately need to know if this scenario is viable. I have worked through relevant sections of the Java EE5 tutorial and so have the required ConnectionFactory and Queue resouces in place. I located the code below which the author implemented in Eclipse 3.2 and have tried to run it to establish that messages can be successfully sent. The code compiles ok but after the post message has been sent the server appears to lock up.
    The servlet is as follows:
    import java.io.IOException;
    import javax.annotation.Resource;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.MessageProducer;
    import javax.jms.Queue;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class NewServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    @Resource(mappedName = "jms/Queue")
    private Queue queue;
    @Resource(mappedName = "jms/connectionFactory")
    private ConnectionFactory jmsConnectionFactory;
    //private Connection connection;
    public NewServlet() {
    super();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Connection connection = null;
    Destination dest = (Destination) queue;
    try {
    connection = jmsConnectionFactory.createConnection();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = session.createProducer(dest);
    TextMessage message = session.createTextMessage();
    message.setText("Hello");
    response.getOutputStream().println("Sending message: " + message.getText());
    System.out.println("Sending message: " + message.getText());
    producer.send(message);
    producer.send(session.createMessage());
    } catch (JMSException e) {
    e.printStackTrace();
    } finally {
    if (connection != null) {
    try {
    connection.close();
    } catch (JMSException e) {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    Please could someone point me in the right direction.
    Many Thanks

    Hello All
    I�m using the Sun Java Sysytem Application Server and have been trying to implement a servlet which on receipt of a Post message, takes the message and sends it using JMS to a message queue. I�m developing my first web application so all is fairly new to me but I desparately need to know if this scenario is viable. I have worked through relevant sections of the Java EE5 tutorial and so have the required ConnectionFactory and Queue resouces in place. I located the code below which the author implemented in Eclipse 3.2 and have tried to run it to establish that messages can be successfully sent. The code compiles ok but after the post message has been sent the server appears to lock up.
    The servlet is as follows:
    import java.io.IOException;
    import javax.annotation.Resource;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.MessageProducer;
    import javax.jms.Queue;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class NewServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    @Resource(mappedName = "jms/Queue")
    private Queue queue;
    @Resource(mappedName = "jms/connectionFactory")
    private ConnectionFactory jmsConnectionFactory;
    //private Connection connection;
    public NewServlet() {
    super();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Connection connection = null;
    Destination dest = (Destination) queue;
    try {
    connection = jmsConnectionFactory.createConnection();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = session.createProducer(dest);
    TextMessage message = session.createTextMessage();
    message.setText("Hello");
    response.getOutputStream().println("Sending message: " + message.getText());
    System.out.println("Sending message: " + message.getText());
    producer.send(message);
    producer.send(session.createMessage());
    } catch (JMSException e) {
    e.printStackTrace();
    } finally {
    if (connection != null) {
    try {
    connection.close();
    } catch (JMSException e) {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    }Please could someone point me in the right direction.
    Many Thanks

  • Concurrent access to JMS session in servlet

              We have a servlet that accepts a request from a browser,
              retrieves info from the request, places it in a JMS message and
              then sends the msg to a JMS Queue. We create all the JMS
              objects (connection, session, etc.) at init time (all these
              objects have class scope). There is only one session and I was
              wondering because servlets are multithreaded, while a request is
              being handled for one client, if there is a context switch in
              the middle of that client's send in order to handle another
              client's request, two different threads will be accessing the
              same session concurrently. I know the spec advises against
              this. Am I thining too much on this one????? All I have to do
              is synchronize the send call however I was just wondering if it
              was truely necessary.
              How are other people doing this out there?
              Let me know,
              Mark
              

    Hi Mark,
              You are definitely not thinking too much on this one! Multi-threading
              session access is unsafe and is definitely against spec. Either
              synchronize
              access, or, if performance is an issue, make sure each simultaneous
              sender has its
              own session.
              The WebLogic JMS Performance white paper on dev2dev.bea.com
              contains an example of a producer pool that looks like it should map
              well to your use case.
              Tom, BEA
              Mark Drifdon wrote:
              > We have a servlet that accepts a request from a browser,
              > retrieves info from the request, places it in a JMS message and
              > then sends the msg to a JMS Queue. We create all the JMS
              > objects (connection, session, etc.) at init time (all these
              > objects have class scope). There is only one session and I was
              > wondering because servlets are multithreaded, while a request is
              > being handled for one client, if there is a context switch in
              > the middle of that client's send in order to handle another
              > client's request, two different threads will be accessing the
              > same session concurrently. I know the spec advises against
              > this. Am I thining too much on this one????? All I have to do
              > is synchronize the send call however I was just wondering if it
              > was truely necessary.
              > How are other people doing this out there?
              >
              > Let me know,
              > Mark
              

  • HA Singleton Servlet - JMS

    Hello All,
    I have an issue when i try to invoke JMS application from a servlet. In the servlet i have set the configuration to start the servlet during the application server startup. When the servlet start it invokes JMS application (not MDB).
    Problem is when JMS application starts, lookup of ConnectionFactory fails since java:/JmsXA binding has still not happened. Meaning, before the application server binds with JmsXA , JMS tries to lookup causing the failure.
    Please provide how to handle this.
    Thanks.

    Hisham <[email protected]> wrote:
              > Hi, I've read ... that one can do JMS from a C/C++ client by
              > using a servlet.
              Sure, it's possible. There's other ways, too.
              Hisham <[email protected]> wrote:
              > I am not too familiar with C network programming, so
              > can anyone here provide some guidance or pointers for implementing
              > this C client.
              I like that "pointers" pun! Seriously, you may want to get involved
              with learning the basic of C/C++ network (socket) programming before
              attempting to implement this client.
              Hisham <[email protected]> wrote:
              > What libraries should be used? I would prefer to use
              > the https protocol. Any online references or sample code is
              > appreciated!!
              Here's something that I've heard was quite nice: JMS Courier (I think
              they're at release 1.1 these days). It works on both Solaris and
              Windows platforms. Basically, it's a big C++ class library. The
              concept is simple -- the C++ bindings access Java, thus providing all
              the cool JMS functionality for you C++ application.
              Let me know how it goes...
              Brian J. Mitchell
              BEA Systems Administrator
              TRX
              Atlanta, GA
              email: [email protected]
              office: 404-327-7238
              mobile: 678-283-6530
              

  • Client to Servlet using JMS

    Hi,
    Since JMS ensures reliability, is it possible to use JMS to send/receive JMS messages from/to a DESKTOP Java application and to/from a Servlet (over HTTP), so as to make sure the transmissions are reliable:
    Desktop Client <----> ReliableJMS <----> Servlet
    That is, can JMS be used to establish a 2-way reliable connection between a client and servlet?
    Is this typically done?
    Thanks

    Hi.
    I do not think you can do it over http.
    The servlet can be activated using the http request, but what happens when you want it do do a receive() on the connection from the desktop? I am not sure that this is possible.
    If you want the servlet to only send messages and not to receive over http - you can do it, but you will need something that will be able to decode the message sent in the http.
    Nimo.

  • C client- Servlet- JMS

    Hi, I've read on this post that one can do JMS from a C/C++ client by
              using a servlet. I am not too familiar with C network programming, so
              can anyone here provide some guidance or pointers for implementing
              this C client. What libraries should be used? I would prefer to use
              the https protocol. Any online references or sample code is
              appreciated!!
              THANK YOU!
              Hisham
              

    Hisham <[email protected]> wrote:
              > Hi, I've read ... that one can do JMS from a C/C++ client by
              > using a servlet.
              Sure, it's possible. There's other ways, too.
              Hisham <[email protected]> wrote:
              > I am not too familiar with C network programming, so
              > can anyone here provide some guidance or pointers for implementing
              > this C client.
              I like that "pointers" pun! Seriously, you may want to get involved
              with learning the basic of C/C++ network (socket) programming before
              attempting to implement this client.
              Hisham <[email protected]> wrote:
              > What libraries should be used? I would prefer to use
              > the https protocol. Any online references or sample code is
              > appreciated!!
              Here's something that I've heard was quite nice: JMS Courier (I think
              they're at release 1.1 these days). It works on both Solaris and
              Windows platforms. Basically, it's a big C++ class library. The
              concept is simple -- the C++ bindings access Java, thus providing all
              the cool JMS functionality for you C++ application.
              Let me know how it goes...
              Brian J. Mitchell
              BEA Systems Administrator
              TRX
              Atlanta, GA
              email: [email protected]
              office: 404-327-7238
              mobile: 678-283-6530
              

  • JMS setMessageListener in Servlets

              Our company is about to start testing with BEA 8.1. We have currently started
              testing with WebSphere 5.0 and they do not support JMS MessageListeners at the
              Web Tier, only with MDBs.
              Does BEA 8.1 support JMS MessageListeners at both the Web Tier and as MDBs?
              IBM told me the restriction was part of the J2EE 1.3.1 spec.
              Is this correct?
              

              Larry wrote:
              > We have a rules evaluation implementation at the web tier, which when the object
              > message is passed via jms from the ejbs to the evaluator, the evaluator maintains
              > the rule status and for the life of the application. If a rule is met, XML information
              > is passed to other listeners via JMS. We were trying to architect the application
              > in a way, to have deployment flexibility.
              >
              > In WebLogic 8.1, can we create JMSListeners from within a servlet?
              Yes - just don't use resource-references to access them -
              resource-references wrap JMS resources to prevent these
              kind of "illegal" calls.
              Actually, I'm not sure what the point would be, the
              servlet would still need to block somewhere waiting for
              its message when it is invoked - so why not just
              use synchronous receive() calls instead of JMSListeners?
              Unless you are using some kind of asynchronous servlet extension
              (I think there is one in WL, although I'm not sure it
              is well publicized)?
              Or unless you are not using
              the servlet as a servlet, but more of as a back-door
              startup class (a fairly common usage)?
              >
              > Thanks
              >
              > Larry
              >
              > Tom Barnes <[email protected]> wrote:
              >
              >>Hi Larry,
              >>
              >>They are correct, although there may be
              >>non-J2EE work-arounds - both for WLogic and
              >>for WSphere. What specifically are you
              >>trying to do?
              >>
              >>Tom, BEA
              >>
              >>Larry wrote:
              >>
              >>
              >>>Our company is about to start testing with BEA 8.1. We have currently
              >>
              >>started
              >>
              >>>testing with WebSphere 5.0 and they do not support JMS MessageListeners
              >>
              >>at the
              >>
              >>>Web Tier, only with MDBs.
              >>>
              >>>Does BEA 8.1 support JMS MessageListeners at both the Web Tier and
              >>
              >>as MDBs?
              >>
              >>>IBM told me the restriction was part of the J2EE 1.3.1 spec.
              >>>
              >>>Is this correct?
              >>
              >
              

  • Problem with a Servlet - URGENT help

    Hello
    i really need your help. here i uploaded my web project: http://www.2shared.com/file/4450238/aaa4d9cd/JMSTest.html
    it's about 2 servlets, one Test servlet sending a message, and another one, Receiver, to receive the message sent via JMS (i use ActiveMQ)
    i didn't know what's wrong, if i call http://localhost:8080/JMSTest , then i enter something into that textfield, then i press the button(form action is http://localhost:8080/test ). it writes that "Mesaj trimis" (message sent - written by me in Romanian), and when i call http://localhost:8080/receiver i did not receive the message. Why?
    I use queue, so i think the send message is stored in a queue until a receiver receives it.
    Please download the project, isn't complicated.
    I did not know what's the problem.
    here is the server.xml file from Tomcat conf folder:
    <?xml version="1.0" encoding="UTF-8"?>
    <Server port="8005" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
      <!-- Global JNDI resources
           Documentation at /docs/jndi-resources-howto.html
      -->
      <GlobalNamingResources>
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users
        -->
        <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
      </GlobalNamingResources>
      <Service name="Catalina">
        <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>      
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
        <Engine defaultHost="localhost" name="Catalina"> 
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
          <!-- Define the default virtual host
               Note: XML Schema validation will not work with Xerces 2.2.
           -->
          <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
            <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
            -->
            <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
                   prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
            -->
           <Context path="/JMSTest" docBase="JMSTest"
            debug="5" reloadable="true" crossContext="true">
        <Resource name="jms/ConnectionFactory" auth="Container"
                     type="org.apache.activemq.ActiveMQConnectionFactory"
                     description="JMS Connection Factory"
                     factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                     brokerURL="vm://localhost"
                     brokerName="LocalActiveMQBroker"
                     userName="activemq" password="activemq"
                     useEmbeddedBroker="false"
                     clientID="TomcatClientID" />
        <Resource name="jms/myQueue" auth="Container"
                     type="org.apache.activemq.command.ActiveMQQueue"
                     description="JMS Queue"
                     factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                     physicalName="TEST.FOO" />
        <Resource name="jms/myTopic" auth="Container"
                     type="org.apache.activemq.command.ActiveMQTopic"
                     description="JMS Topic"
                     factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                     physicalName="TEST.BAR"/>
    </Context>
           </Host>
        </Engine>
      </Service>
    </Server>or, how should i do this, but using Sun Message Queue? my way is using Apache MQ
    Thanks
    Edited by: Talkabout on Dec 13, 2008 7:15 AM

    I didn't go all through your code, but I'd say you should make sure that the Receiver servlet is up and running BEFORE your access the Sender servlet.

Maybe you are looking for