GatewayProxyFactoryBean抛出的运行时异常

时间:2014-10-01 13:27:26

标签: spring-integration

迁移到Spring Integration 4.0.4 ,使用使用GatewayProxyFactoryBean创建的服务bean时会引发以下异常:

Sep 30, 2014 3:45:21 PM org.springframework.integration.expression.ExpressionUtils createStandardEvaluationContext
WARNING: Creating EvaluationContext with no beanFactory
java.lang.RuntimeException: No beanfactory
    at org.springframework.integration.expression.ExpressionUtils.createStandardEvaluationContext(ExpressionUtils.java:79)
    at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.createMethodInvocationEvaluationContext(GatewayMethodInboundMessageMapper.java:182)
    at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.access$000(GatewayMethodInboundMessageMapper.java:77)
    at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper$DefaultMethodArgsMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:279)
    at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper$DefaultMethodArgsMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:272)
    at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.mapArgumentsToMessage(GatewayMethodInboundMessageMapper.java:158)
    at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:153)
    at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:77)
    at org.springframework.integration.support.converter.SimpleMessageConverter.toMessage(SimpleMessageConverter.java:82)
    at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:112)
    at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:103)
    at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:241)
    at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:220)
    at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:341)
    at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:304)
    at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:295)

我们的设计广泛使用GatewayProxyFactoryBean,这个例外似乎是新的。在这种情况下,我们不使用任何SpEL表达式。如何避免这种异常?

2 个答案:

答案 0 :(得分:6)

实际上它并非Exception,而只是WARN

从一方面,您可以忽略它或降低org.springframework.integration.expression.ExpressionUtils类别的日志记录级别。

或者,当然,当您创建自己的GatewayProxyFactoryBean时,会更好甚至推荐什么,为其BeanFactory提供afterPropertiesSet()并调用GatewayProxyFactoryBean {{1}}

答案 1 :(得分:0)

有点晚了,但正如@Artem Bilan建议的那样,你可以在你的log4j.xml文件中做这样的事情,假设你正在处理一个名为console的appender

<logger name="org.springframework.integration.expression.ExpressionUtils">
    <appender-ref ref="console"/>
    <level value="ERROR"/>
</logger>