This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes MDB(Sorry for the last post .It was by mistake)This i want to ask Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "MDB(Sorry for the last post .It was by mistake)This i want to ask" Watch "MDB(Sorry for the last post .It was by mistake)This i want to ask" New topic
Author

MDB(Sorry for the last post .It was by mistake)This i want to ask

Devaki Nihar
Greenhorn

Joined: Apr 30, 2005
Posts: 20
I am new to MDB
I am using orion1.5 application server
I tried a simple MDB

import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.JMSException;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import com.sun.corba.se.internal.iiop.Message;

public class MDBExample implements MessageDrivenBean,MessageListener {
private MessageDrivenContext ctx = null;
public MDBExample() { }
public void setMessageDrivenContext(MessageDrivenContext ctx)throws EJBException {
this.ctx = ctx;
}
public void ejbCreate() {}
public void ejbRemove() {ctx=null;}
public void onMessage(javax.jms.Message message) {
try {
if (message instanceof TextMessage)
System.err.println("Text Message arrvied");

}catch (JMSException e) {
System.err.println("Communication Exception: " + e.getMessage());
}
}

}

and did the changes in deployment descriptor as
in <enterprise-bean> tag

<message-driven>
<description>Test MDB</description>
<ejb-name>MDBExample</ejb-name>
<ejb-class>MDBExample</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Topic</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
<resource-ref>
<description></description>
<res-ref-name>jms/theTopic</res-ref-name>
<res-type>javax.jms.Topic</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description></description>
<res-ref-name>jms/theTopicConnectionFactory</res-ref-name>
<res-type>javax.jms.TopicConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>

and in assembly-descriptor tag

<container-transaction>
<method>
<ejb-name>MDBExample</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>

in application.xml

<display-name>Message Driven Bean</display-name>
<module>
<ejb>MDBPack.jar</ejb>
</module>

I have not written client class yet ,but my server gives me error at start up as
----Unable to link resource MDBExample, no JMS server running ---
Have i done some wrong or yet it is incomplete???When i start Application Server isn't JMS server get started automatically??
Santosh Rathi
Greenhorn

Joined: May 12, 2005
Posts: 5
Your application server might not support JMS. Check it.
Shibu Raj
Greenhorn

Joined: Jan 24, 2005
Posts: 17
Hi there,

I am sure that Orion 2.x does support JMS; but I am not sure with the version 1.3. For me it looks like the Orion application server is not configured to start the JMS server during server startup. Make sure that you have the JMS Server configuration file supplied with hostname, address, JNDI resource name etc.

Also Orion website has an article for configuring SonicMQ. You can use that as the starting point.

Thanks
Shibu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MDB(Sorry for the last post .It was by mistake)This i want to ask