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
          

Similar Messages

  • 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
              

  • Static Class JMS Listener

    I am designing an EJB component (MessageDrivenBean) that requires
    dynamic ("hot") configuration changes. As such, the bean must be
    notified somehow of configuration changes in the DB (rather than have
    to poll the DB for changes at every method call).
    I'm thinking of implementing this functionality using a static class
    instance (singleton) that is shared between the multiple instances of
    the bean. This static instance would listen on a JMS topic for
    configuration change events and update its internal cache accordingly
    (by getting the configuration information from the DB). The beans
    would then access this in-memory static instance everytime they need
    configuration info instead of polling the database. By using the JMS
    topic, I guarantee that clustered instances of Weblogic will all be
    notified of the database changes (each instance would have its own
    "cache" singleton).
    I'm pretty sure all of this will work, but I'm equally sure that I'm
    violating some EJB rules. Singletons and JMS listeners are generally
    discouraged. Are there any alternatives to this design?

    Hi Joost,
    This all seems to be pretty complicated. Not to mention that you can not
    guarantee that members of a cluster will be notified simultaneously.
    Why don't you want using the database?
    "Joost Ouwerkerk" <[email protected]> wrote in message
    news:[email protected]..
    I am designing an EJB component (MessageDrivenBean) that requires
    dynamic ("hot") configuration changes. As such, the bean must be
    notified somehow of configuration changes in the DB (rather than have
    to poll the DB for changes at every method call).
    I'm thinking of implementing this functionality using a static class
    instance (singleton) that is shared between the multiple instances of
    the bean. This static instance would listen on a JMS topic for
    configuration change events and update its internal cache accordingly
    (by getting the configuration information from the DB). The beans
    would then access this in-memory static instance everytime they need
    configuration info instead of polling the database. By using the JMS
    topic, I guarantee that clustered instances of Weblogic will all be
    notified of the database changes (each instance would have its own
    "cache" singleton).
    I'm pretty sure all of this will work, but I'm equally sure that I'm
    violating some EJB rules. Singletons and JMS listeners are generally
    discouraged. Are there any alternatives to this design?Regards,
    Slava Imeshev

  • SOAP-RPC-MESSAGE-question

    Hi all, i already posted this in "performance" group also. I have 3
    question.
    1. What will be the stability or what will happen if thousands of Client
    request hits the Soap-Servlet(that parses the client's soap xml message) at
    one point of time in both RPC(Remote Procedure call) and Message-style
    weblogic web-service structure? Is it going to create thousands of
    Soap-servlets(One soap-servlet per call)? If one soap-servlet handles
    everything, then what will be its scalability and performance?
    2. How will be the response or what will be the response send back to the
    client in Message-style webservices when the soap-servlet finds an error in
    the XML message comming from a client? Because Message-style is one-way. If
    we need response, then we have to create a seperate webservice call using
    seperate client, soap-servlet, jms queue. So, how come the response client
    waiting for the message get the response if any error happens on the
    soap_servlet of the client request?
    3. Should always the StatelessSessionBean be the entry point in RPC style?
    Why not an entitybean directly? Why statelessSessionbean only?
    4. Is there more details about this in the documentation other than this
    "http://e-docs.bea.com/wls/docs61/index.html" site?
    Thanks in Advance
    Elangovan

    Yes I think your app will perform better using remote objects, there's 
    a great app to test that named Census you can get it and do your own 
    tests or play with it on James Ward's blog.
    Sincerely,
    Michael
    El 22/04/2009, a las 12:24, ijmarrero <[email protected]> escribió:
    >
    We are developing a middle sized application using Flex and Axis 
    Webservices. On the client side we AS code generated using Flex 
    Builder 3.0 and the WSDL. On the server side we have Java  code 
    generated with Axis 1.3 using the same WSDL. The problems occurs 
    when the server sends a 290Kb response to the Client. Flex spends 10 
    seconds (obtained from mx.rpc.* log facility) in deserialing this 
    SOAP message. My question is:
    >
    ¿Could I improve the performance of the deserialization?
    >
    Due to the fact that this is an unaceptable delay and that we have a 
    code of 70.000 lines ¿what choices we have? ¿Should we use remote ob
    jects?
    >
    Thank you
    >

  • Memory Leak with Weblogic 6.1

    Hello everyone.
    I need some help with a problem we are having with our application. It consists on Servlets, JMS with MDBs, Xml parsing...
    Our application dequeues messages from an Oracle Queue and sends xml-text message to a servlet. It also receives xml-text and enqueues objects in an Oracle Queue.
    And it also has access to Oracle Database (context tables, etc).
    We are doing everything on Tru64 Unix (and our tests on Win 2000) and we are using WebLogic 6.1.
    Our problem is that we have found that it seems that the garbage collector is not running well. I mean, with the time our system is degrading. The memory use increases. It seems to be a memory leak.
    We have used a testing tool, OptimizeIt, and we have found that there are
    objects that are increasing the use of memory. If we use the option 'java -verbose' we find that it seems to be Hash objects (HashMap, Hashtable) which are increasing the use of memory. In our code we are not using any hashtable nor any class that extends from it (we have deleted everyone).
    Can it be due to a problem with WebLogic? A problem with JMS, queues, etc? A problem with JNDI?
    Could anybody please help us?
    Thanks in advanced.

    Yes, we see that there are some entries of the type:
    java/util/Hahstable$Entry
    java/util/Hahstable
    weblogic/jndi/Environment
    This entries keep growing and growing with the time.
    We have deleted all the Hashtable, Properties and all the kind of Collection objects. I guess WebLogic is using this objects in order to arrange our application runs.
    Am I right? Do you know if we can do anything?
    Thank you.

  • Monitoring WebLogic

    I am trying to write a quick shell script that will monitor the number of connections in a connection pool along with the amount of available memory to a WL server.
    The weblogic.Admin commands are very limited and I was hoping someone could tell me there was a way to find out the information I need from a shell script.

    SNMP? But you'll have to write some code...
    "Cathy" <[email protected]> wrote:
    >
    I checked the serverinfo utility and found it worked well with weblogic
    51sp10. However,
    this utility only can pull data from server and JDBC connection. I need
    some more,
    for example, Servlet, JMS, EJB... I tried to find each id that need to pass
    to the
    getSubObject from the top level managed object to get the properties, since
    there
    is no public API for the weblogic51 about how to get that, any suggestions?
    Thanks,
    Cathy
    Dimitri Rakitine <[email protected]> wrote:
    You can use serverinfo utility from http://developer.bea.com :
    working documented version of a couple of utilities that allow you to get
    Connection Pool information and basic Server Info (such as execute queue
    length and execute queue throughput) from a remote WLS server via a java
    API in your own program or from the command line.
    Jack D <[email protected]> wrote:
    I am trying to write a quick shell script that will monitor the numberof connections in a connection pool along with the amount of available
    memory to a WL server. > The weblogic.Admin commands are very limitedand
    I was hoping someone could tell me there was a way to find out the
    information I need from a shell script.
    Dimitri

  • JBuilder 8 and J2EE, what adjustments do I make?

    I have JBuilder 8 SE and I am trying to dabble in Servlets and eventually EJB. I was told that I need to add the location of the servlet.jar to my CLASSPATH environment variable to allow JBuilder to compile Servlets, is this correct and do I have to do anything else with evironmental variables to achieve full IDE functionality with J2EE?
    thanks,
    Rob

    it depends on what you mean by "full functionality"...
    Instead of using servlet.jar, use the j2ee.jar. This will allow you to compile any classes that make use of J2EE classes (ejb, servlet, jms, jca, etc.)
    However, your ejb/servlets will not run as they need a container to run in. Generally this container is implemented by an app-server. To actually deploy your code and have it work you'll need to use an app-server.
    A few app-servers are:
    Weblogic (www.bea.com)
    Websphere (www.ibm.com)
    JBoss (www.jboss.org)
    Tomcat (go to the j2ee tutorials on this site)
    You'll have to download, install, and configure an app-server. Then you'll have to deploy your code in the app-server (the steps vary significantly by app-server). Finally you'll be able to run your code.

  • 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!!!

  • Servlets design - use singletons??

    I am building a servlet to handle incoming POST connections. The user can send information to be added to the database. I have a servlet to handle the HTTP connection and a seperate class to handle the database interaction.
    Currently the database class is a normal class and a new one is created in the init() method of the servlet. What is the best way to do this? Should the db class be a singleton or what should happen?
    Also I have a seperate servlet to handle a different type of request, this one is required to handle a request to send an automatic text message. It needs to access the database as well but it will have to create a new db object to do so...
    What are the advantages/disadvantages of using singletons in a servlet context? I understand that garbage collection is quite a serious overhead in a server environment so its best to reduce it.
    thanks for your time.

    Thanks for the reply. What are the performance considerations with using just one instance of a class? Lets say 10 requests come in at the same time that need to use the same methods in the singleton. Will they just sit and wait for it to become free?
    just be careful when using multithreadingCan this problem not be avoided my adding the synchronised keyword to the methods in the singleton class?

  • Confused about singletons in servlets

    Hello,
    A DatabaseManager object is to be created within my RegistrationServlet. I wish to implement this DatabaseManager class as a singleton. I understand how the first client that invokes the RegistrationServlet will be able to create an instance of the DatabaseManager. However, what happens when a second client invokes the RegistrationServlet while the first client is still using the DatabaseManager instance? What is the best way to deal with this? Is an exception thrown?
    Thanks.

    Depends on how you implement the Singleton, of course.
    A Singleton might be a bad idea. Sounds like a bottleneck waiting to happen.
    That's a database isolation issue. It doesn't belong in a servlet. It belongs in a persistence layer.

  • 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.

  • Clustering and Application/Servlet Singletons...Replicated?

    Are static servlet and instance attributes replicated to servlet instances
              in cluster?
              We have seen some behavior which suggest no?
              Assuming all instance and static variables are serializable or atomic types,
              are they replicated?
              If not, how is application/servlet level state replicated? servletcontext?
              -phil ([email protected])
              [Phillip A. Lindsay.vcf]
              

    "Phillip A. Lindsay" wrote:
              > Are static servlet and instance attributes replicated to servlet instances
              > in cluster?
              Each node will have its own class/classloader tuple and therefore its own set
              of static and instance attributes. The singleton effect can be achieved by
              binding
              an object into a namespace at a well-known point. It can be argued that a
              singleton
              should be replicated but then it wouldn't be a "single" singleton.
              Cheers
              Alex
              mailto:[email protected] // Consulting services available
              

  • 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

Maybe you are looking for