Wildfly 10 : JMS issue >cannot be cast to javax.resource.spi.endpoint.MessageEndpoint
ravic Jan 19, 2017 7:14 AMI am migrating an old application which is running on Jboss 6.1.0 currently to wildfly 10.1.0.
I have created all queue from old application to the default configuration of standalone-full.xml But while server start up i am getting issue "cannot be cast to javax.resource.spi.endpoint.MessageEndpoint".
I have also added code snippet which is throwing this error.
Any idea what i am doing wrong ?
standalone-full.xml
...
...
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<address-setting name="jms.queue.InboundNotificationResponseQueue" dead-letter-address="jms.queue.bblDeadLetterQueue" expiry-address="jms.queue.bblExpiryQueue"/>
<address-setting name="jms.queue.EventDispatchQueue" dead-letter-address="jms.queue.bblDeadLetterQueue" expiry-address="jms.queue.bblExpiryQueue"/>
<address-setting name="jms.queue.OutboundEmailQueue" dead-letter-address="jms.queue.bblDeadLetterQueue" expiry-address="jms.queue.bblExpiryQueue"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0"/>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="bblDeadLetterQueue" entries="java:/bbl/bblDeadLetterQueue"/>
<jms-queue name="OutboundEmailQueue" entries="java:/bbl/OutboundEmailQueue"/>
<jms-queue name="InboundNotificationResponseQueue" entries="java:/bbl/InboundNotificationResponseQueue"/>
<jms-queue name="EventDispatchQueue" entries="java:/bbl/EventDispatchQueue"/>
<jms-queue name="bblExpiryQueue" entries="java:/bbl/bblExpiryQueue"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
...
...
Code : EmailDispatchMDB.java
package com.mcg.bbl.email.dispatcher;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.EJB;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import org.apache.commons.lang.time.StopWatch;
import org.apache.log4j.Logger;
@MessageDriven(name = "EmailDispatchMDB", activationConfig = {
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination", propertyValue="java:/bbl/OutboundEmailQueue")
})
public class EmailDispatchMDB implements MessageListener {
private static final Logger LOG = Logger.getLogger(EmailDispatchMDB.class);
@Resource
private MessageDrivenContext context;
@EJB(mappedName="bbl-server/NotificationService/remote")
private NotificationService notificationService;
public EmailDispatchMDB(){
}
public void finalize() throws Throwable {
}
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void onMessage( Message message ) {
/* Custom Code */
}
Log Statements :
17:09:21,506 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=D:\projects\MCG\Software\wildfly-10.1.0.Final\standalone\data\activemq\journal,bindingsDirectory=D:\projects\MCG\Software\wildfly-10.1.0.Final\standalone\data\activemq\bindings,largeMessagesDirectory=D:\projects\MCG\Software\wildfly-10.1.0.Final\standalone\data\activemq\largemessages,pagingDirectory=D:\projects\MCG\Software\wildfly-10.1.0.Final\standalone\data\activemq\paging)
...
17:09:28,604 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 64) AMQ221001: Apache ActiveMQ Artemis Message Broker version 1.1.0.wildfly-017 [nodeID=a3b04b10-d656-11e6-8bd3-c391bfc23687]
...
17:09:28,888 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 72) WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
17:09:28,898 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 73) AMQ221003: trying to deploy queue jms.queue.OutboundEmailQueue
...
17:09:49,857 INFO [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0042: Started message driven bean 'EmailDispatchMDB' with 'activemq-ra.rar' resource adapter
...
17:09:56,420 WARN [org.apache.activemq.artemis.ra] (default-threads - 5) AMQ152005: Failure in broker activation org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.apache.activemq.artemis.ra.ActiveMQResourceAdapter@78712571 destination=java:/bbl/OutboundEmailQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15): java.lang.ClassCastException: com.MCG.bbl.email.dispatcher.EmailDispatchMDB$$$endpoint2 cannot be cast to javax.resource.spi.endpoint.MessageEndpoint
at org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:75)
at org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:63)
at org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.setup(ActiveMQMessageHandler.java:187)
at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:318)
at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation$SetupActivation.run(ActiveMQActivation.java:719)
at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)
at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:828)
at java.lang.Thread.run(Thread.java:744)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
...
17:09:58,488 INFO [org.apache.activemq.artemis.ra] (default-threads - 5) AMQ151001: Attempting to reconnect org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.apache.activemq.artemis.ra.ActiveMQResourceAdapter@78712571 destination=java:/bbl/OutboundEmailQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
...
17:09:58,693 ERROR [org.apache.activemq.artemis.ra] (default-threads - 5) AMQ154003: Unable to reconnect org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.apache.activemq.artemis.ra.ActiveMQResourceAdapter@78712571 destination=java:/bbl/OutboundEmailQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15): java.lang.ClassCastException: com.mcg.bbl.email.dispatcher.EmailDispatchMDB$$$endpoint2 cannot be cast to javax.resource.spi.endpoint.MessageEndpoint
at org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:75)
at org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:63)
at org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.setup(ActiveMQMessageHandler.java:187)
at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:318)
at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.reconnect(ActiveMQActivation.java:678)
at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation$SetupActivation.run(ActiveMQActivation.java:722)
at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)
at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:828)
at java.lang.Thread.run(Thread.java:744)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)