Hi all!
I read about JMS and MDB inside "Mastering. EJB.4th.Edtion" (chapter 7). I use
jboss-4.0.5.GA and EJB 3.0
I writed a Message Driver Bean, look like:
public class LogBean implements MessageListener {
public LogBean() {
System.out.println("LogBean created");
}
public void onMessage(Message msg) {
if (msg instanceof TextMessage) {
TextMessage tm = (TextMessage) msg;
try {
String text = tm.getText();
System.out.println("Received new message : " + text);
} catch (JMSException e) {
e.printStackTrace();
}
}
}
public void remove() {
System.out.println("LogBean destroyed.");
}
}
And, I have ejb-jar.xml:
...
<enterprise-beans>
<message-driven>
<ejb-name>LogBean</ejb-name>
<ejb-class>mdb.com.LogBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<message-destination-type>javax.jms.Topic</message-destination-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
But when I deploy it on JBoss server, I received some errors:
org.jboss.deployment.DeploymentException: Required configproperty RequiredConfigPropertyMetaData@19238ad[name=destination descriptions=[DescriptionMetaData@147ff11[language=en]]] for messagingType 'javax.jms.MessageListener' not found in activation config [ActivationConfigProperty(destinationType=javax.jms.Topic)] ra=jboss.jca:service=RARDeployment,name='jms-ra.rar'
....
I think that I must configure JBoss but I don't know where I do this ? Please guide to me or show me some documents about this problem.
Thanks very much.