Unable to deploy MDB in Jboss EAP 6
chithu21 Jun 20, 2012 7:45 AMI am trying to deploy an MDB (EJB 3.x) in Jboss 6 and I get the following error.
16:47:02,505 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found CatToXibMdbEAR.ear in deployment directory. To trigger deployment create a file called CatToXibMdbEAR.ear.dodeploy
16:47:02,524 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "CatToXibMdbEAR.ear"
16:47:02,548 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "CatToXibMdb.jar"
16:47:02,586 INFO [org.jboss.as.osgi] (MSC service thread 1-2) JBAS011941: Register module: Module "deployment.CatToXibMdbEAR.ear:main" from Service Module Loader
16:47:02,595 INFO [org.jboss.as.osgi] (MSC service thread 1-2) JBAS011941: Register module: Module "deployment.CatToXibMdbEAR.ear.CatToXibMdb.jar:main" from Service Module Loader
16:47:02,597 INFO [org.jboss.as.ejb3] (MSC service thread 1-8) JBAS014142: Started message driven bean 'CatToXibMdb' with 'hornetq-ra' resource adapter
16:47:02,802 INFO [org.jboss.as.osgi] (MSC service thread 1-2) JBAS011943: Unregister module: Module "deployment.CatToXibMdbEAR.ear:main" from Service Module Loader
16:47:02,802 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "CatToXibMdbEAR.ear" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.CatToXibMdbEAR.CatToXibMdb.CatToXibMdb.env.jms.QCFjboss.naming.context.java.jboss.resources.jms.QCFMissing[jboss.naming.context.java.comp.CatToXibMdbEAR.CatToXibMdb.CatToXibMdb.env.jms.QCFjboss.naming.context.java.jboss.resources.jms.QCF]"]}
16:47:02,803 INFO [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011943: Unregister module: Module "deployment.CatToXibMdbEAR.ear.CatToXibMdb.jar:main" from Service Module Loader
16:47:02,845 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment CatToXibMdb.jar in 43ms
16:47:02,849 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment CatToXibMdbEAR.ear in 47ms
16:47:02,852 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014776: Newly corrected services:
service jboss.naming.context.java.jboss.resources.jms.QCF (new available)
16:47:02,861 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.CatToXibMdbEAR.CatToXibMdb.CatToXibMdb.env.jms.QCFjboss.naming.context.java.jboss.resources.jms.QCFMissing[jboss.naming.context.java.comp.CatToXibMdbEAR.CatToXibMdb.CatToXibMdb.env.jms.QCFjboss.naming.context.java.jboss.resources.jms.QCF]"]}}}`
It says missing dependency for QCF. Am I doing something wrong?
MY ejb-jar.xml & jboss.xml are under META-INF
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1">
<enterprise-beans>
<message-driven>
<ejb-name>CatToXibMdb</ejb-name>
<ejb-class>com.dcat2.mdb.CatToXibMdb</ejb-class>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>
jboss.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>CatToXibMdb</ejb-name>
<destination-jndi-name>queue/CatToXibQueue</destination-jndi-name>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<jndi-name>ConnectionFactory</jndi-name>
</resource-ref>
</message-driven>
</enterprise-beans>
</jboss>
MDB:
import javax.ejb.ActivationConfigProperty;
import javax.ejb.EJBException;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.ejb.MessageDrivenBean;
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }, mappedName = "CatToXibQueue")
public class CatToXibMdb implements MessageListener, MessageDrivenBean {
private MessageDrivenContext ctx = null;
private QueueConnection conn;
private QueueSession session;
public CatToXibMdb() {
System.out.println("CatToXibMdb: Constructor");
}
public void setMessageDrivenContext(MessageDrivenContext ctx) {
this.ctx = ctx;
System.out.println("CatToXibMdb.setMessageDrivenContext, this=" + hashCode());
}
public void ejbCreate() {
System.out.println("CatToXibMdb.ejbCreate, this=" + hashCode());
try {
setupPTP();
} catch (Exception e) {
throw new EJBException("Failed to init CatToXibMdb", e);
}
}
public void ejbRemove() {
System.out.println("CatToXibMdb.ejbRemove, this=" + hashCode());
ctx = null;
try {
if (session != null) {
session.close();
}
if (conn != null) {
conn.close();
}
} catch (JMSException e) {
System.out.println("JMS Exception occured : " + e);
}
}
/
public void onMessage(Message msg) {
System.out.println("Received message : " + msg.toString());
try {
System.out.println("Msg id: " + msg.getJMSMessageID());
System.out.println(msg.getJMSRedelivered());
} catch (JMSException e) {
System.out.println("JMS Exception occured : " + e);
}
System.out.println("CatToXibMdb.onMessage, this=" + hashCode());
try {
TextMessage tm = (TextMessage) msg;
System.out.println("Message : " + tm.getText());
msg.clearBody();
} catch (Throwable t) {
System.out.println("Exception occured : " + t);
}
}
private void setupPTP() throws JMSException, NamingException {
InitialContext iniCtx = new InitialContext();
Object tmp = iniCtx.lookup("java:comp/env/jms/QCF");
QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
conn = qcf.createQueueConnection();
session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
conn.start();
}
}
I am deploying from eclipse itself.
Can anyone help please.