在调用ejb方法以及javax.jms.Message对象时出现以下错误NonSerializable

如何解决在调用ejb方法以及javax.jms.Message对象时出现以下错误NonSerializable

我们正在使用MessageListener方法onMeassage(javax.jms.Message msg)来调用后面的ejb方法,如下面的示例所示,但它显示错误java.io.NotSerializableException。这是从weblogic到JBOSS的源代码迁移,并且在Weblogic服务器上运行良好。

当我们查看调用类时,似乎已经实现了消息侦听器,甚至试图添加可序列化的接口,但没有成功。

        6:21:00,033 ERROR [M2MProcess] (Thread-127 (ActiveMQ-client-global-threads)) A=15 C=1 S=4 Class=uk.co.softwright.iframe.helper.BeanHelper Context=null (Unexpected_Problem: triggerListener() call failed with exception) : java.lang.RuntimeException: WFLYEJB0054: Failed to marshal EJB parameters
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:592)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
                at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:56)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
                at org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocationResult(TransactionPostDiscoveryInterceptor.java:133)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
                at org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocationResult(DiscoveryEJBClientInterceptor.java:115)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
                at org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocationResult(NamingEJBClientInterceptor.java:79)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
                at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:172)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
                at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:938)
                at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:177)
                at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
                at com.sun.proxy.$Proxy102.triggerListener(Unknown Source)
                at uk.co.softwright.iframe.helper.BeanHelper.triggerListener(BeanHelper.java:137)
                at uk.co.softwright.iframe.processor.ProcessorJMSListener.onMessage(ProcessorJMSListener.java:74)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:40)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
                at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:185)
                at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:364)
                at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:144)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.deployment.processors.EjbSuspendInterceptor.processInvocation(EjbSuspendInterceptor.java:57)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:245)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:438)
                at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:619)
                at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:57)
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)
                at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
                at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:81)
                at uk.co.softwright.iframe.processor.ProcessorJMSListener$$$view123.onMessage(Unknown Source)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:139)
                at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73)
                at uk.co.softwright.iframe.processor.ProcessorJMSListener$$$endpoint6.onMessage(Unknown Source)
                at org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.onMessage(ActiveMQMessageHandler.java:308)
                at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1011)
                at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:50)
                at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1134)
                at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42)
                at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31)
                at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:66)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
        Caused by: java.io.NotSerializableException: org.apache.activemq.artemis.jms.client.ActiveMQObjectMessage
                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:256)
                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:130)
                at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:378)
                at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:360)
                at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:122)
                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:479)
                at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocation(RemotingEJBClientInterceptor.java:51)
                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:491)
                at org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocation(TransactionPostDiscoveryInterceptor.java:79)
                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:491)
                at org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocation(DiscoveryEJBClientInterceptor.java:92)
                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:491)
                at org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocation(NamingEJBClientInterceptor.java:64)
                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:491)
                at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:165)
                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:491)
                at org.wildfly.common.context.Contextual.runExConsumer(Contextual.java:203)
                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequestInitial(EJBClientInvocationContext.java:327)
                at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:173)

TransactionManagement

    @MessageDriven(mappedName = "jms/queue/MNP",name = "ProcessMessageListener")
    public class ProcessorJMSListener implements MessageListener,Serializable {
        @Resource
        private MessageDrivenContext context;
        
        static final long serialversionUID = 129348938L;
        
    //  private static final String QUEUE_CONNECTION_FACTORY = "jms.QueueConnectionFactory";
    //  private static final String LONG_PROCESS_QUEUE = "jms.testqueue";
    //  public static int count=0;
        
        /** Singleton class for ErrorHelper */
    //  private static ErrorHelper m_ErrorHelper=null;
        /** Singleton class for SPFollowUpHelper */
    //  private static JMSSPFollowUpHelper m_ForwardHelper=null;
        /** Source identifier to update to database */
    //  private String sourceId;
        public static class MessageHolder {
            private QueueSession m_QueueSession;
            private QueueReceiver m_QueueReceiver;
            public String m_Message;
            public ObjectMessage m_ObjectMessage;
            public BytesMessage m_BytesMessage;     // 2013-10-08: to accommodate our BytesMessage-ized NPOType
            public Map m_Properties;
        }
    
        public ProcessorJMSListener() throws Exception {
            OperatorLoader.getInstance();
    /*      Context ctx=Cache.getInstance().getM_InitialContext();
            ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup(QUEUE_CONNECTION_FACTORY);
            Connection connection = connectionFactory.createConnection();
            Destination destination=(Destination) ctx.lookup(LONG_PROCESS_QUEUE);
            Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
            MessageConsumer messageConsumer=session.createConsumer(destination);
            messageConsumer.setMessageListener(this);
            connection.start();
    */
        }
        
        @PostConstruct
        public void init() {
            LogFactory.getInstance().log(LogFactory.s_AREA_M2M_PROCESSOR,LogFactory.s_CODE_M2M_PROCESSOR_MESSAGE_RECEIVER,LogFactory.s_INFO,this.getClass(),"init()","Success.");
        }
        
        @PreDestroy
        public void destory() {
        }
        
        public void onMessage(final Message message) {
            long startTime = 0;
            long endTime = 0;
            startTime = System.currentTimeMillis();
        
                try {
    
                    LogFactory.getInstance().log(LogFactory.s_AREA_ACTION_LISTENER,LogFactory.s_CODE_ACTION_LISTENER_EJB,LogFactory.s_DEBUG_HIGH,null,"processMessage(): msg:["+message+"]");
    
            
        
                // 2013-10-08: trace: off to ActionListnerEJB for a trip. Will be back at uk.co.softwright.iframe.processor.ActionListener
                if (!BeanHelper.getInstance().triggerListener(message)) {
                    LogFactory.getInstance().log(LogFactory.s_AREA_M2M_PROCESSOR,"process()","Success.");
                } else {
                    LogFactory.getInstance().log(LogFactory.s_AREA_M2M_PROCESSOR,LogFactory.s_ERROR,"Unexpected_Problem: Rollback Message to JMS InBound Queue by Application itself.");
                    throw new RuntimeException("Rollback Message to JMS InBound Queue by Application itself.");
                }
            } catch (RuntimeException re) {
                throw re;
            } catch (Throwable t) {
                t.printStackTrace();
                LogFactory.getInstance().log(LogFactory.s_AREA_M2M_PROCESSOR,getClass(),"Unexpected_Problem: JMS Rollback. "+t.getStackTrace().toString());
                context.setRollbackOnly();
            }
            endTime = System.currentTimeMillis();
            
            if(LogFactory.getInstance().isLoggingEnabled(LogFactory.s_AREA_TIMER,LogFactory.s_DEBUG_HIGH))
            {
                LogFactory.getInstance().log(LogFactory.s_AREA_TIMER,"ProcessSPRunner with Request[JMSOnmessage] Time:["+(endTime-startTime)+"ms]");
            }
        }   
    
                  
                
                  public boolean triggerListener(javax.jms.Message msg) {
                            boolean result=false;
                            try {
                                
                        
                                if(m_ActionListener==null) {
                                 // System.out.println("MyTest********New******"+context.list("java:global/").next().getName());
                                //  ActionListenerHome alh = (ActionListenerHome)Cache.getInstance().getHome(ActionListenerHome.class,ActionListener.class);
                            
                                     try {
                                         System.out.println("POC things");
                                            context = new InitialContext();
                                            m_ActionListener = (ActionListener) context.lookup(StringJNDI.selectJNDI(JNDI_ALERT_BEAN_REMOTE,context.list("java:global/").next().getName()));
                                            m_ActionListener.ejbCreate();
                                            
                                        } catch (NamingException e) {
                                            // TODO Auto-generated catch block
                                            e.printStackTrace();
                                        }
                                    
                                }
                    
                           
                                        result=m_ActionListener.triggerListener(msg);
    
    Ejb class
    
    public boolean triggerListener(javax.jms.Message msg) {
            boolean result=true;
            System.out.println("test123");
            LogFactory.getInstance().log(LogFactory.s_AREA_ACTION_LISTENER,"New triggerListener() call");
    
            TriggerAction ah=new TriggerAction(m_FatalDelay,m_NonFatalDelay);
            result=ah.trigger(msg,m_ActionListenerInstance);
    
            LogFactory.getInstance().log(LogFactory.s_AREA_ACTION_LISTENER,LogFactory.s_DEBUG_LOW,"New triggerListener() returns "+result);
            return result;
        }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-