Wildfly 10 JMS:EmailDispatchMDB $$$ endpoint2无法强制转换为javax.resource.spi.endpoint.MessageEndpoint

时间:2017-01-19 16:48:00

标签: java jms activemq hornetq wildfly-10

我正在将目前在Jboss 6.1.0上运行的旧应用程序迁移到wildfly 10.1.0。

我已经创建了从旧应用程序到standalone-full.xml的默认配置的所有队列但是当服务器启动时我遇到问题"无法转换为javax.resource.spi.endpoint.MessageEndpoint" 。 我还添加了抛出此错误的代码段。

知道我做错了吗?

独立-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>
...
...

代码: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 */
  }
  }

日志声明:

  

17:09:21,506 INFO [org.apache.activemq.artemis.core.server](ServerService线程池 - 64)AMQ221000:实时Message Broker从配置代理配置开始(clustered = false,journalDirectory = D: \项目\ MCG \ SOFTWARE \ wildfly-10.1.0.Final \独立\ DATA \ ActiveMQ的\杂志,bindingsDirectory = d:\ PROJECTS \ MCG \ SOFTWARE \ wildfly-10.1.0.Final \独立\ DATA \ ActiveMQ的\绑定, largeMes​​sagesDirectory = d:\项目\ MCG \ SOFTWARE \ wildfly-10.1.0.Final \独立\数据\ ActiveMQ的\ largemessages,pagingDirectory = d:\项目\ MCG \ SOFTWARE \ wildfly-10.1.0.Final \独立\数据\ activemq \ paging)

...

17:09:28,604 INFO [org.apache.activemq.artemis.core.server](ServerService Thread Pool - 64) AMQ221001:Apache ActiveMQ Artemis Message Broker版本1.1.0.wildfly-017 [nodeID = a3b04b10-d656-11e6-8bd3-c391bfc23687]

...

17:09 :28,888 INFO [org.wildfly.extension.messaging-activemq](ServerService线程池 - 72)WFLYMSGAMQ0002:绑定消息传递对象到jndi n ame java:jboss / exported / jms / RemoteConnectionFactory   17:09:28,898 INFO [org.apache.activemq.artemis.core.server](ServerService线程池 - 73)AMQ221003:尝试部署队列jms.queue.OutboundEmailQueue

... < br />
17:09:49,857 INFO [org.jboss.as.ejb3](MSC服务主题1-5)WFLYEJB0042:启动消息驱动bean&#39; EmailDispatchMDB&#39;与&#39; activemq-ra.rar&#39;资源适配器

...

  17:09:54,620 WARN [org.apache.activemq.artemis.ra](default-threads - 5)AMQ152005:代理激活失败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无法强制转换为javax.resource.spi.endpoint.MessageEndpoint           在org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:75)           在org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:63)           在org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.setup(ActiveMQMessageHandler.java:187)           在org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:318)           在org.apache.activemq.artemis.ra.inflow.ActiveMQActivation $ SetupActivation.run(ActiveMQActivation.java:719)           在org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)           在org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)           在org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)           at org.jboss.threads.QueueExecutor.access $ 100(QueueExecutor.java:45)           在org.jboss.threads.QueueExecutor $ Worker.run(QueueExecutor.java:828)           在java.lang.Thread.run(Thread.java:744)           在org.jboss.threads.JBossThread.run(JBossThread.java:320)

  ...

  17:09:58,488 INFO [org.apache.activemq.artemis.ra](default-threads - 5)AMQ151001:尝试重新连接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:无法重新连接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无法强制转换为javax.resource.spi.endpoint.MessageEndpoint           在org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:75)           在org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory.createEndpoint(JBossMessageEndpointFactory.java:63)           在org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.setup(ActiveMQMessageHandler.java:187)           在org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:318)           在org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.reconnect(ActiveMQActivation.java:678)           在org.apache.activemq.artemis.ra.inflow.ActiveMQActivation $ SetupActivation.run(ActiveMQActivation.java:722)           在org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)           在org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)           在org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)           at org.jboss.threads.QueueExecutor.access $ 100(QueueExecutor.java:45)           在org.jboss.threads.QueueExecutor $ Worker.run(QueueExecutor.java:828)           在java.lang.Thread.run(Thread.java:744)           在org.jboss.threads.JBossThread.run(JBossThread.java:320)

1 个答案:

答案 0 :(得分:0)

此问题已解决,这是与jar相关的问题。由于我从jboss 6升级到wildfly 10,不知何故该项目引用jar“jboss-connector-api_1.5_spec-1.0.0.Final.jar”这是特定于jboss 6.我纠正了这种依赖并配置了正确的模块“ javax.resource.api“哪个有最新的jar”jboss-connector-api_1.7_spec-1.0.0.Final.jar“,错误得到解决。

所以结论是项目是指需要纠正的旧版jar。

希望这会有所帮助!!