启动我的mule应用程序时遇到以下异常:
SEVERE: Line 6 in XML document from mule-spring-config.xml is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 41; cvc-elt.1: Cannot find the declaration of element 'beans'. (org.mule.api.lifecycle.InitialisationException)
org.mule.api.config.ConfigurationException: Line 6 in XML document from mule-spring-config.xml is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 41; cvc-elt.1: Cannot find the declaration of element 'beans'. (org.mule.api.lifecycle.InitialisationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:97)
at org.mule.config.builders.MuleXmlBuilderContextListener.createMuleContext(MuleXmlBuilderContextListener.java:169)
at org.mule.config.builders.MuleXmlBuilderContextListener.initialize(MuleXmlBuilderContextListener.java:98)
at org.mule.config.builders.MuleXmlBuilderContextListener.contextInitialized(MuleXmlBuilderContextListener.java:74)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
以下XML是我的mule xml配置文件的开头。显然指定了spring bean的模式。更糟糕的是,完全相同的标题适用于另一个类似的应用程序。有没有人知道这里可能出现什么问题呢?
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/jersey http://www.mulesoft.org/schema/mule/jersey/current/mule-jersey.xsd
http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd">
<endpoint name="REST" address="http://localhost:8082/system" />
<!-- Otds connector -->
<spring:bean id="tokenProvider"
class="com.is.TokenProvider">
<spring:property name="location"
value="http://sampleLocation.com" />
</spring:bean>
<spring:bean id="credentialStoreClient"
class="com.is.CredentialStoreClient">
<!-- Integration services protocol -->
<spring:constructor-arg index="0"
type="java.lang.String" value="http" />
<!-- Integration services host -->
<spring:constructor-arg index="1"
type="java.lang.String" value="sample.com" />
<!-- Integration services port -->
<spring:constructor-arg index="2"
type="java.lang.String" value="8080" />
<!-- Integration services context -->
<spring:constructor-arg index="3"
type="java.lang.String" value="/server" />
</spring:bean>
<!-- Authentication provider web service class -->
<spring:bean id="authenticationProvider"
class="com.api.system.AuthenticationProvider">
<spring:property name="tokenProvider"
ref="tokenProvider" />
<spring:property name="credentialStoreClient" ref="credentialStoreClient" />
</spring:bean>
<flow name="API">
<inbound-endpoint ref="REST" />
<jersey:resources>
<component class="com.api.system.VersionSender" />
<component>
<spring-object bean="authenticationProvider" />
</component>
</jersey:resources>
</flow>
</mule>
在我将VersionSender和身份验证提供程序类的包名从admin更改为system之前,这可能会有所帮助!
修改
Web.xml api-config.xml是上面的mule配置文件。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>org.mule.config</param-name>
<param-value>api-config.xml</param-value>
</context-param>
<!-- To use a Mule XML configuration file use this context listener -->
<listener>
<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>
</web-app>
答案 0 :(得分:2)
检查嵌入在Web应用程序的WEB-INF/lib
目录中的依赖项:对于Mule 3.3.0,Spring JAR的版本必须都是3.1.1.RELEASE
。还要确保您实际上嵌入了Spring Beans JAR。