Spring应用程序对Tomcat 7的问题

时间:2014-06-16 13:23:32

标签: java spring tomcat

当我使用嵌入式tomcat 7启动我的应用程序localy时一切正常。但是当我使用tomcat7:redeploy(maven插件)部署到远程计算机时,我遇到了应用程序部分的问题。应用程序启动正常,部分工作正常,但是当我将XML包发送到应用程序时,它会抛出此异常:

 ERROR o.s.i.handler.LoggingHandler - org.springframework.integration.transformer.MessageTransformationException: org.springframework.messaging.MessageHandlingException: java.lang.IllegalStateException: Cannot process message
        at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:74)
        at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:170)
        at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
        at org.springframework.integration.endpoint.PollingConsumer.handleMessage(PollingConsumer.java:74)
        at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:202)
        at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:52)
        at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
        at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:143)
        at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:278)
        at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
        at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
        at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:272)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
        at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.messaging.MessageHandlingException: java.lang.IllegalStateException: Cannot process message
        at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:78)
        at org.springframework.integration.transformer.AbstractMessageProcessingTransformer.transform(AbstractMessageProcessingTransformer.java:64)
        at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:68)
        ... 22 more
Caused by: java.lang.IllegalStateException: Cannot process message
        at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:284)
        at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:142)
        at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:75)
        ... 24 more
Caused by: java.lang.NoSuchMethodError: org.springframework.xml.transform.TraxUtils.isStaxSource(Ljavax/xml/transform/Source;)Z
        at org.springframework.oxm.AbstractMarshaller.unmarshal(AbstractMarshaller.java:124)
        at com.mozzartbet.joker.api.udp.UDPTransformer.transform(UDPTransformer.java:31)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:63)
        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:84)
        at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:114)
        at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:111)
        at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:159)
        at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:268)
        ... 26 more

两台机器上java的版本是相同的1.6.45,并且远程tomcat实例上只有这个webapp。我试着和赞同的目录一起玩,但没有成功。

1 个答案:

答案 0 :(得分:0)

这是根本原因:

Caused by: java.lang.NoSuchMethodError: org.springframework.xml.transform.TraxUtils.isStaxSource(Ljavax/xml/transform/Source;)Z
        at org.springframework.oxm.AbstractMarshaller.unmarshal(AbstractMarshaller.java:124)

我猜测JAR的Spring版本和Tomcat附带的版本之间存在冲突。 Tomcat的服务器类加载器首先找到它们的版本,并且没有Spring需要的方法。