Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 函数上下文的参数与spring xml不兼容_Java_Spring_Apache Camel - Fatal编程技术网

Java 函数上下文的参数与spring xml不兼容

Java 函数上下文的参数与spring xml不兼容,java,spring,apache-camel,Java,Spring,Apache Camel,您好,请原谅我的知识不多,但我是一个使用弹簧和骆驼的初学者。我试图创建一个简单的camelcontextbean,将消息从端点路由到另一个名为smartlighting的springbean。问题是,每当我初始化xml中的camelContext(甚至是空的)时,就会出现这种奇怪的“函数参数不兼容”异常 我使用的是Spring3.0、Camel2.10.3和tomcat服务器v7.0 我的spring xml如下所示: <?xml version="1.0" encoding="UTF-8

您好,请原谅我的知识不多,但我是一个使用弹簧和骆驼的初学者。我试图创建一个简单的camelcontextbean,将消息从端点路由到另一个名为smartlighting的springbean。问题是,每当我初始化xml中的camelContext(甚至是空的)时,就会出现这种奇怪的“函数参数不兼容”异常

我使用的是Spring3.0、Camel2.10.3和tomcat服务器v7.0

我的spring xml如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    "> 

<camelContext id="camelcontext" xmlns="http://camel.apache.org/schema/spring">
<route streamCache="true">
   <from uri="jetty:http://192.168.1.99:1989/sample/endpoint"/>
   <bean ref="smartlighting" method="test"/>
</route>   
</camelContext>


<bean id="smartlighting" class="com.example.smartlighting.SmartLightingApp" init-method="init"/>

</beans>

您可以将camel名称空间作为上下文文件中的默认名称空间,并使用beansaliasname引用springbean。
例如:











SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.VerifyError: (class: org/apache/camel/spring/CamelContextFactoryBean, method: initThreadPoolProfiles signature: (Lorg/apache/camel/CamelContext;)V) Incompatible argument to function
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.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:458)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:388)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://camel.apache.org/schema/spring" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<beans:bean id="smartlighting" class="com.example.smartlighting.SmartLightingApp" init-method="init"/>

<camelContext id="camelcontext" xmlns="http://camel.apache.org/schema/spring">
<route streamCache="true">
<from uri="{{your}}"/>
<bean ref="smartlighting" method="test"/>
</route>
</camelContext>
</beans:beans>