Hi all,
We are evaluating jboss, esp. its Message Driven Bean. I downloaded the
binary jboss and got the "interest bean" work
(in the "first steps" in the manual), however, can not get the "MDB bean"
work in chapter 7 (deploy error ). Then, I take the
suggestion in the chapter, use the test code in the sorce code suit
(http://www.jboss.org/zip_archives/jbosstest-cvs.zip),
extract the one of the mdb tests (QueueBean). Still, deployment error (see
below).
I plan to try the more complex example in chapter 7 ("WorkerBean" and
"ListenerBean"), hoping get some clues there.
Or, if time permit, get the source and junit/ant work all together.
Any suggeations? -- thanks in advance!!!
Kai Qu
**********************************************************************************************************
below are the code and deployment error message (I also attached the jar
and .java files):
**********************************************************************************************************
-------------------------------------------------------------------------------------------------------------
error message when I drop the queuebean.jar into the "deploy" directory:
-------------------------------------------------------------------------------------------------------------
[Auto deploy] Auto deploy of file:/C:/jboss/deploy/queuebean.jar
[J2EE Deployer Default] exception while searching deployment: C:
\jboss\tmp\deploy\Default\queuebean.jar\deployment.cfg (
The system cannot find the file specified)
[J2EE Deployer Default] Deploy J2EE application:
file:/C:/jboss/deploy/queuebean.jar
[J2EE Deployer Default] Create application queuebean.jar
[J2EE Deployer Default] install module queuebean.jar
[Container factory]
Deploying:file:/C:/jboss/tmp/deploy/Default/queuebean.jar/
[Verifier] Verifying
file:/C:/jboss/tmp/deploy/Default/queuebean.jar/ejb1010.jar
[Container factory] Deploying QueueBean
[Container factory] Serious error in init:
javax.naming.CommunicationException [Root exception is
java.net.MalformedURLE
xception: no protocol: of]
[Container factory] java.lang.Exception:
javax.naming.CommunicationException [Root exception is
java.net.MalformedURLExc
eption: no protocol: of]
[Container factory] at
org.jboss.ejb.MessageDrivenContainer.init(MessageDrivenContainer.java:156)
[Container factory] at
org.jboss.ejb.Application.init(Application.java:183)
[Container factory] at
org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:337)
[Container factory] at
org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:275)
[Container factory] at java.lang.reflect.Method.invoke(Native Method)
[Container factory] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
[Container factory] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[Container factory] at
org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:435)
[Container factory] at
org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:178)
[Container factory] at java.lang.reflect.Method.invoke(Native Method)
[Container factory] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
[Container factory] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[Container factory] at
org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:358)
[Container factory] at
org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:221)
[Container factory] at java.lang.Thread.run(Unknown Source)
[Container factory] Could not stop JMSContainerInvoker
consumer:java.lang.NullPointerException
[J2EE Deployer Default] Starting queuebean.jar failed!
[J2EE Deployer Default] Module queuebean.jar is not running
[J2EE Deployer Default] Destroying application queuebean.jar
[Auto deploy] Deployment failed:file:/C:/jboss/deploy/queuebean.jar
[Auto deploy] org.jboss.deployment.J2eeDeploymentException: Error while
starting queuebean.jar: Could not deploy file:/C
:/jboss/tmp/deploy/Default/queuebean.jar/
[Auto deploy] at
org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:441)
[Auto deploy] at
org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:178)
[Auto deploy] at java.lang.reflect.Method.invoke(Native Method)
[Auto deploy] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
[Auto deploy] at
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
[Auto deploy] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:358)
[Auto deploy] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:221)
[Auto deploy] at java.lang.Thread.run(Unknown Source)
--------------------------------------------------------------------------------------------------------------------------
the Queue.java:
--------------------------------------------------------------------------------------------------------------------------
package org.jboss.test.mdb.bean;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.ejb.EJBException;
import javax.jms.MessageListener;
import javax.jms.Message;
public class QueueBean implements MessageDrivenBean, MessageListener{
private MessageDrivenContext ctx = null;
public QueueBean() {
}
public void setMessageDrivenContext(MessageDrivenContext ctx)
throws EJBException {
this.ctx = ctx;
}
public void ejbCreate() {}
public void ejbRemove() {ctx=null;}
public void onMessage(Message message) {
System.err.println("DEBUG: QueueBean got message" + message.toString()
);
}
} // MessageBeanImpl
--------------------------------------------------------------------------------------------------------------------------
the ejb-jar.xml:
--------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE ejb-jar>
<!--
PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd"
-->
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>QueueBean</ejb-name>
<ejb-class>org.jboss.test.mdb.bean.QueueBean</ejb-class>
<!--
<message-selector>JMSType='activityCompletion'</message-selector>
-->
<message-selector></message-selector>
<!-- We also have the acknowledge-mode - AUTO_ACKNOWLEDGE |
DUPS_OK_AKNOWLEDGE - for bean managed transactions, and the
subscription-durability for topic destination types -->
<transaction-type>Bean</transaction-type>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
<!--
Only with topic
<subscription-durability>Durable</subscription-durability>
-->
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>
</message-driven>
</enterprise-beans>
</ejb-jar>
--------------------------------------------------------------------------------------------------------------------------
the jboss.xml:
--------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="Cp1252"?>
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>QueueBean</ejb-name>
<configuration-name>Standard Message Driven
Bean</configuration-name>
<destination-jndi-name>queue/testQueue</destination-jndi-name>
</message-driven>
<secure>false</secure>
</enterprise-beans>
</jboss>
(See attached file: queuebean.jar) (See attached file:
QueueBean.java)
queuebean.jar
QueueBean.java