IllegalStateException "No pool annotation" - jboss

Tying to launch my .ear on a Local JBoss 6.1.0 Final with local ActiveMQ. As I'm starting the Jboss. I get:
09:56:52,300 INFO [org.jboss.ejb3.deployers.JBossASKernel] Created KernelDeployment for: message-service-ejb-1.0-SNAPSHOT.jar
09:56:52,304 INFO [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:ear=message-service-ear-1.0-SNAPSHOT,jar=message-service-ejb-1.0-SNAPSHOT.jar,name=MedhjalparService,service=EJB3
09:56:52,304 INFO [org.jboss.ejb3.deployers.JBossASKernel] with dependencies:
09:56:52,304 INFO [org.jboss.ejb3.deployers.JBossASKernel] and demands:
09:56:52,304 INFO [org.jboss.ejb3.deployers.JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
09:56:52,304 INFO [org.jboss.ejb3.deployers.JBossASKernel] jboss-switchboard:appName=message-service-ear-1,module=message-service-ejb-1.0-SNAPSHOT,name=MedhjalparService; Required: Create
09:56:52,304 INFO [org.jboss.ejb3.deployers.JBossASKernel] and supplies:
09:56:52,305 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:null
09:56:52,305 INFO [org.jboss.ejb3.deployers.JBossASKernel] Class:javax.jms.MessageListener
09:56:52,307 INFO [org.jboss.ejb3.deployers.JBossASKernel] Added bean(jboss.j2ee:ear=message-service-ear-1.0-SNAPSHOT,jar=message-service-ejb-1.0-SNAPSHOT.jar,name=MedhjalparService,service=EJB3) to KernelDeployment of: message-service-ejb-1.0-SNAPSHOT.jar
09:56:52,347 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=jboss.j2ee:ear=message-service-ear-1.0-SNAPSHOT,jar=message-service-ejb-1.0-SNAPSHOT.jar,name=MedhjalparService,service=EJB3 state=Create: java.lang.IllegalStateException: No pool annotation
at org.jboss.ejb3.EJBContainer.initializePool(EJBContainer.java:1325) [:1.7.21]
at org.jboss.ejb3.mdb.MessagingContainer.initializePool(MessagingContainer.java:357) [:1.7.21]
And heres the code:
#MessageDriven(name = "MessageMDBSample", activationConfig = {
#ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/MyQueue"),
#ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}
public class ExampleMDBean implements MessageListener{
private static final long serialVersionUID = 1L;
public void onMessage

I was using the wrong activeMQ-rar.rar. the one int deployment had a versionnumber in the filename and the configuration I was using did not..

Related

NoClassDefFoundError on creating IgniteSinkConnector

I am trying to get a distributed setup for the ignite-connector to run. Sadly, it does not work. I was able to grab the log on creation of the connector via the api.
API POST payload to /connectors
{
"name": "ignite-connector",
"config": {
"connector.class": "org.apache.ignite.stream.kafka.connect.IgniteSinkConnector",
"tasks.max": "2",
"topics": "someTopic1",
"cacheName": "myCache",
"cacheAllowOverwrite": true,
"igniteCfg":"/opt/ignite/examples/config/example-cache.xml"}
}
}
I set up the ignite-connector as a plugin. I built an uber-jar from the repo and put it to a separate direcotry and included it as plugin in the .properties file I am using to start connect-distributed.sh.
I set the classpath for the jobs for both the connetor and kafka I am managing with systemd:
Environment=CLASSPATH=/opt/kafka/ignite-connector/*
Following the full error log:
[2022-11-17 19:49:30,268] INFO [ignite-connector|worker] SinkConnectorConfig values:
config.action.reload = restart
connector.class = org.apache.ignite.stream.kafka.connect.IgniteSinkConnector
errors.deadletterqueue.context.headers.enable = false
errors.deadletterqueue.topic.name =
errors.deadletterqueue.topic.replication.factor = 3
errors.log.enable = false
errors.log.include.messages = false
errors.retry.delay.max.ms = 60000
errors.retry.timeout = 0
errors.tolerance = none
header.converter = null
key.converter = null
name = ignite-connector
predicates = []
tasks.max = 2
topics = [someTopic1]
topics.regex =
transforms = []
value.converter = null
(org.apache.kafka.connect.runtime.SinkConnectorConfig:376)
[2022-11-17 19:49:30,272] INFO [ignite-connector|worker] EnrichedConnectorConfig values:
config.action.reload = restart
connector.class = org.apache.ignite.stream.kafka.connect.IgniteSinkConnector
errors.deadletterqueue.context.headers.enable = false
errors.deadletterqueue.topic.name =
errors.deadletterqueue.topic.replication.factor = 3
errors.log.enable = false
errors.log.include.messages = false
errors.retry.delay.max.ms = 60000
errors.retry.timeout = 0
errors.tolerance = none
header.converter = null
key.converter = null
name = ignite-connector
predicates = []
tasks.max = 2
topics = [someTopic1]
topics.regex =
transforms = []
value.converter = null
(org.apache.kafka.connect.runtime.ConnectorConfig$EnrichedConnectorConfig:376)
[2022-11-17 19:49:30,276] INFO [ignite-connector|worker] Instantiated connector ignite-connector with version 3.3.1 of type class org.apache.ignite.stream.kafka.connect.IgniteSinkConnector (org.apache.kafka.connect.runtime.Worker:322)
[2022-11-17 19:49:30,276] INFO [ignite-connector|worker] Finished creating connector ignite-connector (org.apache.kafka.connect.runtime.Worker:347)
[2022-11-17 19:49:30,277] ERROR [ignite-connector|worker] WorkerConnector{id=ignite-connector} Error while starting connector (org.apache.kafka.connect.runtime.WorkerConnector:201)
java.lang.NoClassDefFoundError: org/apache/ignite/internal/util/typedef/internal/A
at org.apache.ignite.stream.kafka.connect.IgniteSinkConnector.start(IgniteSinkConnector.java:55)
at org.apache.kafka.connect.runtime.WorkerConnector.doStart(WorkerConnector.java:193)
at org.apache.kafka.connect.runtime.WorkerConnector.start(WorkerConnector.java:218)
at org.apache.kafka.connect.runtime.WorkerConnector.doTransitionTo(WorkerConnector.java:363)
at org.apache.kafka.connect.runtime.WorkerConnector.doTransitionTo(WorkerConnector.java:346)
at org.apache.kafka.connect.runtime.WorkerConnector.doRun(WorkerConnector.java:146)
at org.apache.kafka.connect.runtime.WorkerConnector.run(WorkerConnector.java:123)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
[2022-11-17 19:49:30,277] INFO [Worker clientId=connect-1, groupId=connect-cluster] Finished starting connectors and tasks (org.apache.kafka.connect.runtime.distributed.DistributedHerder:1687)
[2022-11-17 19:49:30,280] ERROR [ignite-connector|worker] [Worker clientId=connect-1, groupId=connect-cluster] Failed to start connector 'ignite-connector' (org.apache.kafka.connect.runtime.distributed.DistributedHerder:1811)
org.apache.kafka.connect.errors.ConnectException: Failed to start connector: ignite-connector
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.lambda$startConnector$35(DistributedHerder.java:1782)
at org.apache.kafka.connect.runtime.WorkerConnector.doTransitionTo(WorkerConnector.java:349)
at org.apache.kafka.connect.runtime.WorkerConnector.doRun(WorkerConnector.java:146)
at org.apache.kafka.connect.runtime.WorkerConnector.run(WorkerConnector.java:123)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.kafka.connect.errors.ConnectException: Failed to transition connector ignite-connector to state STARTED
... 8 more
Caused by: java.lang.NoClassDefFoundError: org/apache/ignite/internal/util/typedef/internal/A
at org.apache.ignite.stream.kafka.connect.IgniteSinkConnector.start(IgniteSinkConnector.java:55)
at org.apache.kafka.connect.runtime.WorkerConnector.doStart(WorkerConnector.java:193)
at org.apache.kafka.connect.runtime.WorkerConnector.start(WorkerConnector.java:218)
at org.apache.kafka.connect.runtime.WorkerConnector.doTransitionTo(WorkerConnector.java:363)
at org.apache.kafka.connect.runtime.WorkerConnector.doTransitionTo(WorkerConnector.java:346)
... 7 more
The mentioned class (A) is included in the ignite-core-2.9.1.jar that is bundeld in the uberJar in the Plugin directory.
Any pointers are appreciated
There seems to be a misunderstanding what "plugins" are. Those only are classes defined as implementations of Converters, Transforms, and Connectors.
Internal Ignite classes are none of these, so they wouldn't be loaded into the plugin.path classloader.
To fix this, you'll need to ensure you export CLASSPATH=/path/to/ignite-files/*.jar and you can use jar -tf commands to validate the class exists in any specific JAR before running Connect process.
It is not a hack; that's just how Java Classloader works.

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

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.

JBoss EJB3 MDB config

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.