JBoss EJB3 MDB config - jboss

I am trying to understand some EJB 3 code running in JBoss 4.3.
We've got an ejb3-interceptors-aop.xml file configured in JBoss with some MDB configuration and then we've got the MDB Java class.
What I'd like to understand is when and how does the MDB get "bound" to the MQ? That is, when/how does the MDB start listening to the MQ queue?
Does JBoss at startup read the ejb3-interceptors-aop.xml file and then find the class with the AspectDomain annotation equal to "GatewayMDB" and "bind" to the MQ queue at startup?
XML in ejb3-interceptors-aop.xml:
<domain name="GatewayMDB">
<bind pointcut="execution(public * #javax.annotation.security.RunAs->*(..))">
<interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
</bind>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
</bind>
<annotation expr="!class(#org.jboss.annotation.ejb.PoolClass)">
#org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=30, timeout=10000)
</annotation>
<annotation expr="!class(#org.jboss.annotation.ejb.DefaultActivationSpecs)">
#org.jboss.annotation.ejb.DefaultActivationSpecs ({#javax.ejb.ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"), #javax.ejb.ActivationConfigProperty(propertyName = "hostName", propertyValue = "10.10.10.10"), #javax.ejb.ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QM"), #javax.ejb.ActivationConfigProperty(propertyName = "port", propertyValue = "1419"),#javax.ejb.ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")})
</annotation>
</domain>
MDB class:
#MessageDriven(name = "BridgeMDB", activationConfig = {
#ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
#ActivationConfigProperty(propertyName = "destination", propertyValue = "TO.WLS.LQUEUE.BG"),
#ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "maxPoolDepth", propertyValue = "1") })
#ResourceAdapter("wmq.jmsra.rar")
#AspectDomain("GatewayMDB")
#Interceptors(SpringBeanAutowiringInterceptor.class)
#TransactionManagement(TransactionManagementType.CONTAINER)
public class BridgeMDB implements MessageListener {
private static Logger logger = Logger.getLogger(BridgeMDB.class);
#Autowired
private MessageProcessor messageProcessor;
#Autowired
private MessageTranslator messageTranslator;
#TransactionAttribute(TransactionAttributeType.REQUIRED)
public void onMessage(Message message) {
...
}
}

Disclaimer: this is a supposition, since I don't know the jboss code.
The common way of processing class files in java is to read them through the class path (in this case it would be at load-time) and construct some sort of metadata for each class.
Then, when the application bootstraps the container will read the class's metadatada to wire/inject/configure the appropriate attributes that were defined within the class.
As for the xml, most of the jboss configuration is static AFAIK, ie, you have to restart the app server in order for changes to take effect.
So all in all, I would say that your observation is correct.

For a clear understanding of this process, your best bet would be to read the JCA specification. It is a clearly and easily understandable spec.
IBM provides their JCA adapter which is deployed to JBoss. When JBoss deploys your MDB, an "activation specification" is passed to the IBM JCA. The IBM JCA then creates a managed connection factory for the MDB instances. Note that this is separate and distinct from any connection factories as configured in the JBoss server configuration.
Part of the activation spec is the number of JMS sessions. The IBM JCA creates and manages these sessions. The IBM JCA also create JMS message listeners on these sessions.
When a message is received, the IBM JCA creates a message driven context, requests an MDB instance from the JBoss managed instance pool, provides the message driven context to the MDB instance and calls the MDB onMessage() method.

Related

Deploying an MDB to listen to Kafka on Wildfly erros: WFLYEJB0383: No message listener of type fish.pay....KafkaListener found in resource adapter

I am trying to use the [JCA resoruce-adapters][1] to use an MDB to connect to kafka.
Following are the entries in the standalone-full.xml to configure the kafka resoruce adapter and the related ejb-mdb definition :
Note that the i have deploying the mdb as part of an ejbModule which is embeded in an ear
While deploying the application i get the below error
22:43:53,073 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.subunit."kafkatemplatereceiver.ear"."kafkatemplatereceiverEJB.jar".component.KafkaMDB.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."kafkatemplatereceiver.ear"."kafkatemplatereceiverEJB.jar".component.KafkaMDB.CREATE: Failed to start service
at org.jboss.msc#1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
at org.jboss.msc#1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: WFLYEJB0383: No message listener of type fish.payara.cloud.connectors.kafka.api.KafkaListener found in resource adapter kafka
at org.jboss.as.ejb3#21.0.2.Final//org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createActivationSpecs(MessageDrivenComponentCreateService.java:142)
at org.jboss.as.ejb3#21.0.2.Final//org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:105)
at org.jboss.as.ee#21.0.2.Final//org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:86)
at org.jboss.as.ejb3#21.0.2.Final//org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.start(MessageDrivenComponentCreateService.java:93)
at org.jboss.msc#1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc#1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
... 6 more
22:43:53,076 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "kafkatemplatereceiver.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"kafkatemplatereceiver.ear\".\"kafkatemplatereceiverEJB.jar\".component.KafkaMDB.CREATE" => "Failed to start service
Caused by: java.lang.IllegalStateException: WFLYEJB0383: No message listener of type fish.payara.cloud.connectors.kafka.api.KafkaListener found in resource adapter kafka"}}
22:43:53,077 ERROR [org.jboss.as.server] (External Management Request Threads -- 1) WFLYSRV0021: Deploy of deployment "kafkatemplatereceiver.ear" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"kafkatemplatereceiver.ear\".\"kafkatemplatereceiverEJB.jar\".component.KafkaMDB.CREATE" => "Failed to start service
Caused by: java.lang.IllegalStateException: WFLYEJB0383: No message listener of type fish.payara.cloud.connectors.kafka.api.KafkaListener found in resource adapter kafka"}}
**standalone-full.xml**
<subsystem xmlns="urn:jboss:domain:ejb3:8.0">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<!--<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:kafka-rar-0.6.0.rar}"/>-->
<resource-adapter-ref resource-adapter-name="kafka"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb> ...
standalone-full.xml resource adapter configuration
<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0">
<resource-adapters>
<resource-adapter id="kafka">
<archive>
kafka-rar-0.6.0.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="fish.payara.cloud.connectors.kafka.outbound.KafkaManagedConnectionFactory" jndi-name="java:/KafkaConnectionFactory" enabled="true" pool-name="ConnectionFactory">
<xa-pool>
<min-pool-size>1</min-pool-size>
<initial-pool-size>1</initial-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>false</prefill>
<is-same-rm-override>false</is-same-rm-override>
</xa-pool>
</connection-definition>
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
MDB Class:
package com.zhun.euon.service;
import java.util.Date;
import javax.ejb.MessageDriven;
import javax.ejb.ActivationConfigProperty;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.jboss.ejb3.annotation.ResourceAdapter;
//import com.zhun.euon.service.serializer.Stringo;
import fish.payara.cloud.connectors.kafka.api.KafkaListener;
import fish.payara.cloud.connectors.kafka.api.OnRecord;
#MessageDriven(activationConfig = {
#ActivationConfigProperty(propertyName = "clientId", propertyValue = "testClient"),
#ActivationConfigProperty(propertyName = "groupIdConfig", propertyValue = "test-consumer-group"),
#ActivationConfigProperty(propertyName = "topics", propertyValue = "zhun_core_data_service_topic"),
#ActivationConfigProperty(propertyName = "bootstrapServersConfig", propertyValue = "192.168.0.105:9092"),
#ActivationConfigProperty(propertyName = "autoCommitInterval", propertyValue = "100"),
#ActivationConfigProperty(propertyName = "retryBackoff", propertyValue = "1000"),
#ActivationConfigProperty(propertyName = "pollInterval", propertyValue = "1000") ,
// #ActivationConfigProperty(propertyName="resourceAdapterName",propertyValue="kafka-rar-0.6.0.rar"),
// #ActivationConfigProperty(propertyName="resourceAdapterMid",propertyValue="kafka-rar-0.6.0.rar"),
#ActivationConfigProperty(propertyName = "keyDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"),
#ActivationConfigProperty(propertyName = "valueDeserializer", propertyValue = "org.apache.kafka.common.serialization.StringDeserializer"),
})
#ResourceAdapter(value="kafka")
public class KafkaMDB implements KafkaListener {
#OnRecord( topics={"zhun_core_data_service_topic"})
public void getMessageTest(ConsumerRecord<String,String> record) {
System.out.println("Got record on topic testing " + record + "at time"+ new Date());
}
}
I am not sure if I am missing something, however i am unable to figure out why the server will look for the Listener's Interface implementation in the rar file itself and not in my EJB- Jar which is withing rth
[1]: https://github.com/payara/Cloud-Connectors/tree/master/Kafka/KafkaRAR
I was facing a similar issue. What ended up fixing this problem was by adding a jboss-deployment-structure.xml file under webapp/WEB-INF/. This pointed to the Kafka RAR that had been deployed with the JBoss Server:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.kafka-rar-0.6.1-SNAPSHOT.rar" export="TRUE"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
This was the tutorial I was following -> http://www.mastertheboss.com/other/jboss-stuff/apache-kafka/getting-started-with-apache-kafka-and-wildfly

Set maxsession for MDB through ejb-jar.xml in JBoss

I want to configure maxsession for MDB
So there is a below annotation on the MDB class
#ActivationConfigProperty(propertyName="maxSession",propertyValue="6")
Snippet
#MessageDriven
(activationConfig =
{
#ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
#ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "destination",
propertyValue = "queue/MyQueue"),
#ActivationConfigProperty(propertyName = "reconnectAttempts",
propertyValue = "-1"),
#ActivationConfigProperty(propertyName = "setupAttempts",
propertyValue = "-1"),
#ActivationConfigProperty(propertyName="maxSession",propertyValue="6")
},
mappedName = "MyQueue"
)
and also I have configured the maxsession in ejb-jar.xml
<?xml version='1.0' encoding='UTF-8'?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>MDBBean</ejb-name>
<ejb-class>com.mybean.MDBBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>maxSession</activation-config-property-name>
<activation-config-property-value>20</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>queue/MyQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
AFAIK precedence show be given to ejb-jar.xml and then to annotation.
But when I check "ConsumerCount" through jmx-console it shows 26.
That means it adds both the values.
And if I remove #ActivationConfigProperty(propertyName="maxSession",propertyValue="6") form cclass file , it shows 35 (i.e. default 15 and then it adds 20 from ejb-jar.xml)
My requirement is , it should pick the value only from ejb-jar.xml.
Note: I dont want to remove the annotation from class as the same code is used on the other AS.
AFAIK precedence show be given to ejb-jar.xml and then to annotation.
This is expected behavior. File descriptor value takes precedence over annotation.
But when I check "ConsumerCount" through jmx-console it shows 26....
May I know which JMS broker and container you are using ? I tried with EAP 6.4.x with hornetQ. And I am getting correct consumer count via Jconsole:

Jboss EAP 5.1 - MDB Integration with IBM Websphere MQ - Too few concurrent messages processed

I have been playing with a lot of Jboss parameters but I have been unsuccessful in getting my MDB to process more than 10 concurrent messages at a time. This is not adequate for my needs - I need a lot more concurrent message processing. I've completely run out of ideas. Does anyone have any suggestions?
My MDB (Had everything defined as a aspect domain but moved it):
#MessageDriven(name = "Incoming Task MDB", activationConfig = {
#ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"),
#ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "destination", propertyValue = "TaskQueue"),
#ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false") })
#TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
#TransactionManagement(value = TransactionManagementType.BEAN)
// #AspectDomain("Task Queue MDB") JBOSS Specific annotation to inject the MQ server session at runtime
#ResourceAdapter("wmq.jmsra.rar")
#org.jboss.ejb3.annotation.DefaultActivationSpecs ({
#javax.ejb.ActivationConfigProperty(propertyName = "channel", propertyValue = "..."),
#javax.ejb.ActivationConfigProperty(propertyName = "hostName", propertyValue = "..."),
#javax.ejb.ActivationConfigProperty(propertyName = "queueManager", propertyValue = "..."),
#javax.ejb.ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),
#javax.ejb.ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT"),
#javax.ejb.ActivationConfigProperty(propertyName = "pollingInterval", propertyValue = "250"),
#javax.ejb.ActivationConfigProperty(propertyName = "rescanInterval", propertyValue = "250"),
#ActivationConfigProperty(propertyName="minSession",propertyValue="100"),
#ActivationConfigProperty(propertyName="maxSession",propertyValue="100") })
#org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=100, timeout=10000)
public final class IncomingTaskMDB extends TaskCompletionReportable implements MessageListener {
The wmq.jmsra.rar version:
Specification-Title: J2EE Connector Architecture
Specification-Version: 1.5
Implementation-Title: WebSphere MQ Resource Adapter
Implementation-Version: 7.0.1.3-k701-103-100812
Implementation-Vendor: IBM Corporation
In my wmq.jmsra.rar - I modified the ra.xml:
<resourceadapter>
<resourceadapter-class>
com.ibm.mq.connector.ResourceAdapterImpl
</resourceadapter-class>
<config-property>
<config-property-name>connectionConcurrency</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>100</config-property-value>
</config-property>
<config-property>
<config-property-name>maxConnections</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>100</config-property-value>
</config-property>
In my ejb3-interceptors-aop.xml:
<domain name="Message Driven Bean" extends="Intercepted Bean" inheritBindings="true">
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
</bind>
<!-- TODO: Authorization? -->
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
<!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
<stack-ref name="EJBInterceptors"/>
</bind>
<annotation expr="class(*) AND !class(#org.jboss.ejb3.annotation.Pool)">
#org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=100, timeout=10000)
</annotation>
In standardjboss.xml:
<invoker-proxy-binding>
<name>message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
<proxy-factory-config>
<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
<CreateJBossMQDestination>false</CreateJBossMQDestination>
<!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
<MinimumSize>1</MinimumSize>
<MaximumSize>100</MaximumSize>
<KeepAliveMillis>30000</KeepAliveMillis>
<MaxMessages>1</MaxMessages>
<MDBConfig>
<ReconnectIntervalSec>10</ReconnectIntervalSec>
<DLQConfig>
<DestinationQueue>queue/DLQ</DestinationQueue>
<MaxTimesRedelivered>10</MaxTimesRedelivered>
<TimeToLive>0</TimeToLive>
</DLQConfig>
</MDBConfig>
</proxy-factory-config>
</invoker-proxy-binding>
Use the annotation to increase the sessions generated from wsmq libraries. Default is 10.
#ActivationConfigProperty(propertyName = "maxPoolDepth", propertyValue = "100"),

How to handle RunTimeExceptions in MDB control before going to onMessage()

I was written a simple MessageListener(MDB) it is working fine.How to handle runtime exceptions in this.
[Ex: if was try to deploy this listener with a wrong queue name like "XXXX" instead of right one that time it is showing Exceptions and moreover deployment failure also coming.]
So how to avoid this type of Exceptions is there any Annotations are available.
And I tried to handle inside the below Class(ORANGE_QUEUE_MDB). But the control is not coming to inside .
Please help me how to solve this type of Errors.
#MessageDriven(name="WEBSPHERE_MDB",
activationConfig = {
#ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"),
#ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "destination", propertyValue = "ORANGE.QUEUE"),
#ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),
#ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.CONN"),
#ActivationConfigProperty(propertyName = "hostName", propertyValue = "192.168.22.29"),
#ActivationConfigProperty(propertyName = "queueManager", propertyValue = "manager"),
#ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),
#ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT"),
#ActivationConfigProperty(propertyName = "username", propertyValue = "mqm"),
#ActivationConfigProperty(propertyName = "password", propertyValue = "password")
},
mappedName = "ORANGE.QUEUE",
messageListenerInterface = MessageListener.class)
#ResourceAdapter(value = "wmq.jmsra.rar")
#TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
#ApplicationException(rollback = true)
public class ORANGE_QUEUE_MDB extends RuntimeException implements MessageListener
{
public void onMessage(Message message) {
try{
TextMessage textMessage=(TextMessage) message;
}
catch(Exception e)
{
e.printStackTrace();
}
When I deploy above listener(with wrong queue name) in Jboss it is showing below exception
The Exception is like below :
11:17:14,630 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."WEBSPHERE_MDB.jar".component.WEBSPHERE_MDB.START:
org.jboss.msc.service.StartException in service jboss.deployment.unit."WEBSPHERE_MDB.jar".component.WEBSPHERE_MDB.START: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
Caused by: java.lang.RuntimeException: com.ibm.mq.connector.DetailedResourceException: MQJCA0001: An exception occurred in the JMS layer.
See the linked exception for details., error code: MQJCA0001 A call to WebSphere MQ classes for JMS caused an exception to be thrown.
See the linked exception for details of the failure.
at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.start(MessageDrivenComponent.java:171)
at org.jboss.as.ee.component.ComponentStartService.start(ComponentStartService.java:44)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
**Caused by: com.ibm.mq.connector.DetailedResourceException:** MQJCA0001: An exception occurred in the JMS layer. See the linked exception for details.,
error code: MQJCA0001 A call to WebSphere MQ classes for JMS caused an exception to be thrown. See the linked exception for details of the failure.
at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:124)
at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:100)
at com.ibm.mq.connector.inbound.MessageEndpointDeployment.start(MessageEndpointDeployment.java:351)
at com.ibm.mq.connector.inbound.MessageEndpointDeployment.<init>(MessageEndpointDeployment.java:301)
at com.ibm.mq.connector.ResourceAdapterImpl.endpointActivation(ResourceAdapterImpl.java:463)
at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:164)
at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.start(MessageDrivenComponent.java:169)
... 6 more
**Caused by: com.ibm.msg.client.jms.DetailedInvalidDestinationException: JMSWMQ2008: Failed to open MQ queue 'OORANGE.QUEUE'.**
JMS attempted to perform an MQOPEN, but WebSphere MQ reported an error. Use the linked exception to determine the cause of this error.
Check that the specified queue and queue manager are defined correctly.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:520)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:236)
at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:128)
at com.ibm.msg.client.wmq.internal.WMQConsumerShadow.initialize(WMQConsumerShadow.java:856)
at com.ibm.msg.client.wmq.internal.WMQAsyncConsumerShadow.initialize(WMQAsyncConsumerShadow.java:724)
at com.ibm.msg.client.wmq.internal.WMQConnectionBrowser.<init>(WMQConnectionBrowser.java:1230)
at com.ibm.msg.client.wmq.internal.WMQConnection.createConnectionBrowser(WMQConnection.java:872)
at com.ibm.msg.client.jms.internal.JmsConnectionImpl.createConnectionBrowser(JmsConnectionImpl.java:922)
at com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.createConnectionBrowser(JmsConnectionConsumerImpl.java:238)
at com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.<init>(JmsConnectionConsumerImpl.java:166)
at com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.<init>(JmsConnectionConsumerImpl.java:116)
at com.ibm.msg.client.jms.internal.JmsConnectionImpl.createConnectionConsumer(JmsConnectionImpl.java:415)
at com.ibm.mq.jms.MQConnection.createConnectionConsumer(MQConnection.java:215)
at com.ibm.mq.connector.inbound.MessageEndpointDeployment.createConnectionConsumer(MessageEndpointDeployment.java:486)
at com.ibm.mq.connector.inbound.MessageEndpointDeployment.start(MessageEndpointDeployment.java:331)
... 10 more
**Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2085' ('MQRC_UNKNOWN_OBJECT_NAME').**
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:223)
... 23 more
How to handle these exceptions and replace with Userdefind custom error message. Like (Queue Configuration error please check) etc.

Java EE 6 + JPA - Exception: Message Driven Bean cant be managed bean

I create an Enterprise Application CustomerApp that also generated two projects CustomerApp-ejb and CustomerApp-war. In the CustomerApp-ejb, I create a SessionBean call CustomerSessionBean.java as below.
package com.customerapp.ejb;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
#Stateless
#LocalBean
public class CustomerSessionBean {
#PersistenceContext(unitName = "CustomerApp-ejbPU")
private EntityManager em;
public void persist(Object object) {
em.persist(object);
}
}
Now I can deploy CustomerApp-war just fine. But as soon as I create a Message Driven Bean, I cant deploy CustomerApp-war anymore. When I create NotificationBean.java (message driven bean), In the project destination option, I click add, and have NotificationQueue for the Destination Name and Destination Type is Queue. Below are the code
package com.customerapp.mdb;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;
#MessageDriven(mappedName = "jms/NotificationQueue", activationConfig = {
#ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
#ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
})
public class NotificationBean implements MessageListener {
public NotificationBean() {
}
public void onMessage(Message message) {
}
}
The server log said Message Driven Bean cant be managed bean. Well I did not mean it to be managed bean. I did not have #ManagedBean in the code????
EDIT: Here is the server log
[#|2010-06-03T10:02:08.172-0400|SEVERE|glassfishv3.0|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=24;_ThreadName=Thread-1;|Exception while loading the app org.glassfish.deployment.common.DeploymentException: Message Driven Beans can't be Managed Beans
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:169)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:637)
Caused by: org.jboss.weld.DefinitionException: Message Driven Beans can't be Managed Beans
at org.jboss.weld.bean.SessionBean.checkEJBTypeAllowed(SessionBean.java:313)
at org.jboss.weld.bean.SessionBean.initialize(SessionBean.java:122)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.deploy(AbstractBeanDeployer.java:111)
at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:151)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:367)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167)
... 30 more
The Exception is DeploymentException: Message Driven Beans can't be Managed Beans
This is a bug in GlassFish 3.0 which is fixed in 3.0.1.
workaround: remove the beans.xml (but this will disable CDI)
real solution: download a promoted build of GlassFish 3.0.1 (the problem is reported as being fixed in version 3.0.1-b9 so any superior version should work)
Below the initial answer:
Where is the MDB located? Did you put it in the CustomerApp-ejb?
What do you mean by Now I can deploy CustomerApp-war just fine? You're supposed to deploy the Enterprise application (CustomerApp).
What do you see in the GlassFish logs when the deployment fails?