骡子:Queuemanager为空

时间:2015-03-12 10:51:59

标签: java mule web.xml mule-studio

我创建了一个java webproject,我试图将Mule嵌入其中。 所有必需的依赖项已添加到pom.xml中,而web.xml的代码段为:

<display-name>Mule App</display-name>

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<context-param>
    <param-name>org.mule.config</param-name>
    <param-value>
         WEB-INF\mule-config.xml
    </param-value>
</context-param>

<listener>
    <listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>

该项目已配置为在Tomcat 7上部署。 在运行项目时,它会给出以下异常:

SEVERE: Exception sending context initialized event to listener instance of class org.mule.config.builders.MuleXmlBuilderContextListener
org.mule.api.MuleRuntimeException: The required object/property "queueManager" is null
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:272)
    at org.mule.config.builders.MuleXmlBuilderContextListener.initialize(MuleXmlBuilderContextListener.java:96)
    at org.mule.config.builders.MuleXmlBuilderContextListener.contextInitialized(MuleXmlBuilderContextListener.java:70)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    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:745)

我尝试使用SpringXmlConfigurationBuilder通过Java进行,然后创建muleContext,并在尝试muleContext.start()时抛出相同的异常。没有一种方法可以工作。

这个mule-config.xml适用于Anypoint studio(它只是一个基本的)。我是Mule的新手,所以我不知道如何将内容添加到队列管理器中。

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0"
    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-current.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:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="9900" doc:name="HTTP Listener Configuration" />
    <flow name="myFirstMuleFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP" />
        <logger message="Hello I logged" level="INFO" doc:name="Logger" />
        <set-payload value="Payload set" doc:name="Set Payload" />
    </flow>
</mule>

我正在做这一切,因为如果我在tomcat上部署这个项目,它会打开另一个它所侦听的端口,因为使用了http侦听器。我想要的是能够在tomcat上部署项目,并且所有内容都在同一个tomcat端口上执行。

pom.xml看起来像:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.muleConnector.csi</groupId>
<artifactId>mule</artifactId>
<packaging>war</packaging>
<version>0.0.1-Alpha</version>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>mule-embedded</groupId>
        <artifactId>mule-embedded</artifactId>
        <scope>system</scope>
        <version>3.6.1</version>
        <systemPath>${basedir}\src\main\webapp\WEB-INF\lib\mule-embedded.jar</systemPath>
    </dependency>

    <dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>jtds</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId> org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.2.2</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.1.5.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.0.4.RELEASE</version>
    </dependency>


    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>

    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>
    <dependency>
        <groupId>javax.resource</groupId>
        <artifactId>javax.resource-api</artifactId>
        <version>1.7</version>
    </dependency>

    <dependency>
        <groupId>com.eaio.uuid</groupId>
        <artifactId>uuid</artifactId>
        <version>3.2</version>
    </dependency>
    <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>18.0</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.10</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>3.2.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.grizzly</groupId>
        <artifactId>grizzly-http-server</artifactId>
        <version>2.3.19</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>


    <finalName>mule</finalName>
</build>

1 个答案:

答案 0 :(得分:0)

您不需要手动定义队列管理器:Mule默认配置一个名为_muleQueueManager的队列管理器,位于:https://github.com/mulesoft/mule/blob/mule-3.6.1/modules/spring-config/src/main/resources/minimal-mule-config.xml#L37

默认情况下也会加载minimal-mule-config.xmlhttps://github.com/mulesoft/mule/blob/mule-3.6.1/modules/spring-config/src/main/java/org/mule/config/spring/SpringXmlConfigurationBuilder.java#L78

所以这里还有其他东西可以阻止加载你的Mule配置。

实际上,这可能就是这个奇怪的反斜杠:

WEB-INF\mule-config.xml

这应该是:

WEB-INF/mule-config.xml

编辑:此外,此依赖项很可能是问题的原因:

<dependency>
    <groupId>mule-embedded</groupId>
    <artifactId>mule-embedded</artifactId>
    <scope>system</scope>
    <version>3.6.1</version>
    <systemPath>${basedir}\src\main\webapp\WEB-INF\lib\mule-embedded.jar</systemPath>
</dependency>

您可以将其删除,移除${basedir}\src\main\webapp\WEB-INF\lib中的所有JAR,而是使用mule-coremule-module-spring-config以及您依赖的任何额外模块和传输的单独依赖项。

编辑2 我很快就将一个示例展示了如何在网络应用中运行Mule:https://github.com/ddossot/mule-webapp-example