0

启动我的 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 和 Authentication 提供程序类的包名称从 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>
4

1 回答 1

2

检查嵌入到WEB-INF/lib您的 Web 应用程序目录中的依赖项:Spring JAR 的版本必须全部3.1.1.RELEASE适用于 Mule 3.3.0。还要确保您实际上嵌入了 Spring Beans JAR 本身。

于 2013-05-20T17:17:43.543 回答