gpt4 book ai didi

java - 启动时解析camelContext.xml文件时出现空指针

转载 作者:行者123 更新时间:2023-11-29 10:06:06 26 4
gpt4 key购买 nike

这是一个间歇性问题,大约 4/5 开始命中空指针。 Camel-Context.xml 如下。

  • 错误:

    2011-10-18 08:31:25,245 [main           ] INFO  MainSupport                    -   Apache Camel 2.8.0 stopping
    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [D:\Users\michaelb\workspace\camel-example-spring-eda\target\classes\META-INF\spring\camel-context-NERD.xml]; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
    at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:185)
    at org.apache.camel.spring.Main.doStart(Main.java:139)
    at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
    at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
    at org.apache.camel.impl.MainSupport.run(MainSupport.java:136)
    at org.apache.camel.impl.MainSupport.run(MainSupport.java:322)
    at com.softwareag.eda.NERD.main(NERD.java:39)
    Caused by: java.lang.NullPointerException
    at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:190)
    at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:171)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:494)
  • Camel 上下文.xml

    http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> org.apache.camel.example.spring.eda

            <!-- Announce route -->
<route id="Announcer" startupOrder="3">
<from uri="file:src/data?noop=true" />
<choice>
<when>
<xpath>$eventtype = 'shipment'</xpath>
<to uri="jmsEDA:topic:orderMgmt" />
</when>
<otherwise>
<to uri="jmsEDA:topic:orderMgmt" />
</otherwise>
</choice>
</route>

<!-- Listen route -->
<route id="Listener" startupOrder="2">
<from uri="jmsEDA:topic:orderMgmt" />
<to uri="file://target/test?noop=true" />
<to uri="outputToScreen" />
<log message="done" />
</route>

</camelContext>

<!-- EDA JMS endpoint URL -->
<bean id="jmsEDA" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL"
value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false" />
</bean>
</property>
</bean>

<!-- Screen output endpoint -->
<bean id="outputToScreen"
class="com.softwareag.eda.NERD.outputToScreen">
</bean>

</beans>

最佳答案

由于遇到同样的问题,我遇到了你的问题。 2012 年 2 月 18 日发布了 JAXB 的 2.2.5 版本。升级到2.2.5后,问题好像解决了。到目前为止,在测试中没有再次发生。

参见 http://jaxb.java.net/了解详情。

作为引用,我的配置使用 Camel 2.8.4 和 Spring 3.0.5。

关于java - 启动时解析camelContext.xml文件时出现空指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7810599/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com