当我为其中一个频道启用了WireTap拦截器时,我收到了以下错误。 OotB WireTap拦截器未加载,并在服务器启动期间抛出以下异常。弹簧集成版本为3.x
org.springframework.web.context.ContextLoader(ContextLoader.java:319) - 上下文初始化失败 [java] org.springframework.beans.factory.BeanCreationException:创建名称为' exporter'的bean时出错。在从字节数组加载的资源中定义:init方法的调用失败;嵌套异常是org.springframework.jmx.export.UnableToRegisterMBeanException:无法使用key' org.springframework.integration.channel.interceptor.WireTap#注册MBean [org.springframework.integration.channel.interceptor.WireTap@5596e217] 0&#39 ;;嵌套异常是javax.management.MalformedObjectNameException:键属性不能为空 [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1488) [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) [java] at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:295) [java] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [java] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [java] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [java] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626) [java] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) [java] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) [java] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [java] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [java] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [java] at org.broadleafcommerce.common.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListener.java:50) [java] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779) [java] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273) [java] org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [java] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895) [java] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871) [java] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615) [java] at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649) [java] at org.apache.catalina.startup.HostConfig $ DeployDescriptor.run(HostConfig.java:1585) java.util.concurrent.Executors中的[java] $ RunnableAdapter.call(Executors.java:471) [java] java.util.concurrent.FutureTask.run(FutureTask.java:262) [java] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [java] at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615) [java] java.lang.Thread.run(Thread.java:745) [java]引起:org.springframework.jmx.export.UnableToRegisterMBeanException:无法使用密钥&org.springframework.integration.channel.interceptor注册MBean [org.springframework.integration.channel.interceptor.WireTap@5596e217] .WireTap#0&#39 ;;嵌套异常是javax.management.MalformedObjectNameException:键属性不能为空 [java] at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:602) [java] at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:527) [java] org.springframework.jmx.export.MBeanExporter.afterPropertiesSet(MBeanExporter.java:413) [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1547) [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1485) [java] ... 26更多
答案 0 :(得分:0)
我认为这个错误发生在spring-integration v3中。以下是我如何解决它。
发布此消息后,我能够成功点击该频道。
您不需要覆盖自定义类中的任何方法,只需添加类似于WireTap类的构造函数。简单来说,我创建了自己的拦截器类并用它来点击频道。
@ManagedResource(objectName = "com.xyz.channel.interceptor:name=wireTapExtended") public class WireTapExtended extends WireTap
<int:channel id="channelIdToTap">
<int:interceptors>
<int:ref bean="wireTapExtended" />
</int:interceptors>
</int:channel>
<bean id="wireTapExtended" name="wireTapExtended" class="com.xyz.channel.interceptor.WireTapExtended">
<constructor-arg name="channel" ref="channelIdToTap" />
</bean>
我看到这只是MBean config
<bean id="jmxExporterSite" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false"> <property name="server" ref="mbeanServer" /> <property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING"/> <property name="beans"> <map> <entry key="SpringBeans:name=hibernateStatisticsMBeanSite" value-ref="hibernateStatisticsMBeanSite" /> <entry key="SpringBeans:name=ehCacheManagerMBean" value-ref="cacheManager" /> </map> </property> </bean>