2 Replies Latest reply on Dec 21, 2018 5:25 AM by Bhavesh Kharwa

    Wildfly-14 : ClassCastException while marshalling/unmarshalling

    Bhavesh Kharwa Newbie

      I have configured wildfly-14 in domain mode and configured one profile "full-ha-socket" in domain.xml. Now I have deployed ear in wildfly.The application having functionality of marshalling/unmarshalling of content. Also I have provided jaxb dependency in maven as scope provided.

       

      So the issue is when I process the file the it throws classcastexception. Please refer below stackstrace.

      Note: Sometimes it is working but sometimes giving exception

       

      Unhandled exception while procesing file 'testing.xml': java.lang.ClassCastException: com.commons.impl.NewsMessageImpl cannot be cast to com.commons.NewsMessage

              at com.common.transform.MessageTransformationService.transform(MessageTransformationService.java:521)

              at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96cproceed(AbstractTransactionAspect.aj:59)

              at org.springframework.transaction.aspectj.AbstractTransactionAspect$AbstractTransactionAspect$1.proceedWithInvocation(AbstractTransactionAspect.aj:65)

              at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)

              at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:63)

              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.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:69)

              at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:122)

              at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:44)

              at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:258)

              at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)

              at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102)

              at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:103)

              at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:126)

              at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:227)

              at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:127)

              at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:73)

              at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:67)

              at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134)

              at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)

              at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)

              at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)

              at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)

              at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:134)

              at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)

              at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)

              at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)

              at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)

              at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:134)

              at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)

              at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)

              at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)

              at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)

              at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:134)

              at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)

              at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)

              at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)

              at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)

              at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)

              at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:216)

              at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:200)

              at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:165)

              at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:159)

              at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:141)

              at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)

              at org.springframework.integration.dispatcher.UnicastingDispatcher.access$000(UnicastingDispatcher.java:52)

              at org.springframework.integration.dispatcher.UnicastingDispatcher$1.run(UnicastingDispatcher.java:97)

              at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)

              at org.jboss.as.ee.concurrent.ControlPointUtils$ControlledRunnable.run(ControlPointUtils.java:105)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

              at java.util.concurrent.FutureTask.run(FutureTask.java:266)

              at org.glassfish.enterprise.concurrent.internal.ManagedFutureTask.run(ManagedFutureTask.java:141)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

              at java.lang.Thread.run(Thread.java:748)

              at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250)

              at org.jboss.as.ee.concurrent.service.ElytronManagedThreadFactory$ElytronManagedThread.run(ElytronManagedThreadFactory.java:78)

       

      Also i have added following dependencies in jboss-deployment-structure.xml

      - javax.mail.api

      - org.hibernate (slot=main)

      - javax.validation.api

      - com.sun.xml.bind (slot=main)

      - org.wildfly.clustering.singleton(slot=main)

       

      Can you please suggest what is wrong in this.