• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

can I integrate JMS with Servlets???

 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys. I implemented an application using OpenJMS. I have a servlet that connects to the OpenJMS server and publishes the message(s). So it is basically integration with JMS + Tomcat.
Now I'm using J2EE reference implementation and i'm facing a bunch of problems. I'm planning to use MDB to handle my business logic when a message is published to the J2EE JMS server.
but... I have only seen examples of standalone applications. There's no example of how to integrate tomcat+servlets+JMS using J2EE. In fact, haven't found examples of this using any other application server..
has anyone experienced this?? any suggestion..?
thanks
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, integrating all of these things is possible.
One of the client projects that I've just worked on used BEA WebLogic 6.1 and utilised JSP/Servlets for the presentation and EJBs for business logic. There were certain parts of the application where messages were received by MDBs, and certain parts where session beans sent JMS messages in response to user actions from the presentation tier.
With the J2EE reference implementation, you get everything that you need to start building complete J2EE systems - including a copy of Tomcat that is a part of the server.
What sort of problems are you having?
Simon
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Simon Brown:
Yes, integrating all of these things is possible.
One of the client projects that I've just worked on used BEA WebLogic 6.1 and utilised JSP/Servlets for the presentation and EJBs for business logic. There were certain parts of the application where messages were received by MDBs, and certain parts where session beans sent JMS messages in response to user actions from the presentation tier.
With the J2EE reference implementation, you get everything that you need to start building complete J2EE systems - including a copy of Tomcat that is a part of the server.
What sort of problems are you having?
Simon


Is it possible for an individual developer to download and use BEA Weblogic 6.1 without having to buy a license. That is, is there a personal copy for development purposes only (no commercial usage) that is free (non-expiring)?
Laurie
 
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doesn't the problem you're having stem from the fact that Tomcat doesn't support MDB (Message Driven Beans) or EJB at all for that matter?
Apache does however have something (...I haven't used it or seen it used) to provide similar functionality in a servlet.
{begin cut/paste}
Package org.apache.commons.messagelet Description
This package provides the mechansim to deploy MessageListener beans in a servlet application server which are intialized and destroyed with a web-application as well as introducing MessageDrivenObjects which are MessageListeners which receive servlet-style lifecycle events and Messagelets which are servlets that process Messages.
So this package introduces the interface MessageDrivenObject which is a servlet equivalent of a Message Driven EJB which is part of the EJB 2.0 spec.
In addition this package provides support for Messagelets which are servlets used to process JMS messages. They reuse the same message listener beans infrastructure but dispatch JMS Messages to a servlet for further processing.
2 new interfaces are introduced, MessageletRequest which extends ServletRequest and MessageletResponse which extends ServletResponse which adds some extra JMS based semantics such as access to the Messenger which was used to receive the JMS Message..
{end cut/paste}
Link to Apache API
Let me know if this helps/how it works out.
Regards,
Byron Estes
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you guys...


Doesn't the problem you're having stem from the fact that Tomcat doesn't support MDB (Message Driven Beans) or EJB at all for that matter?


nope. As a matter of fact, i evaluated different app servers. tried to download weblogic but with no luck, always got corrupt files.
now I'm using forte for java EE, which supports EJB 2.0 (so it supports MDB).
I haven't done anything complex. I have a JSP form in which you can select a topic and publish a message. So my servlet only fetches the parameter topic (request.getParameter("topic")), connects to JMS and publish the message to that topic. It was working pretty ok with OpenJMS; but now that I'm using Forte for Java EE it doesn't even connect to JMS.
I think the problem is with the JNDI, because I was getting something like:
name JMS is not bound in this context.
Unfortunately, I was so yesterday that I deleted the whole servlet and started over again. I'm still not sure if you invoke JNDI this way.

I was able to run the MDB examples using the deploytool. but those are only standalone clients. No examples of servlets at all.
I'll try to recover my servlet and post it here..
thanks again
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried to reconstruct my servlet and it looks like this:

I'm just checking if I can connect to jms and send a message to my queue (jms/MyQueue).
the error is:
Marking servlet Publisher as unavailable
2002-07-10 16:07:00 StandardWrapperValve[Publisher]: Servlet Publisher is currently unavailable
why does this happen??
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can use JBoss. Servlets/JMS/MDB works fine in JBoss.
JBoss comes with its own message Queue implementation. I havent tried it with external queue. Full Documentation on the latest version is not available as yet, so you would need some help from people who have done it before.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your suggestion... I know these guys at JBoss get more than 100.000 downloads per month, but I wonder how many of those downloads are really used. I have downloaded it many times but it really lacks of documentation, so the learning curve gets even worst..
and yeah, you can buy the documentation, I'd do it, but I heard that it is aimed for people that can look at the JBoss source code and understand it in couple of minutes... I'm not that good yet , time is what I need to become a guru.
So, why is this
Servlet Publisher is currently unavailable
happening ?? ...
thankkksssss
 
Byron Estes
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Food for thought...
It doesn't matter if the IDE your using supports MDB if the application server you are running in doesn't...
Maybe I'm way off on this one, I use WebSphere most of the time, but to my knowledge Tomcat will not support what you want to do using MDB at this time.
Byron Estes
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic