Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Devaki Nihar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your application server might not support JMS. Check it.
 
Shibu Raj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic