为什么Mule应用程序在Linux服务器中表现奇怪?

时间:2014-12-18 13:20:26

标签: linux tomcat mule

我和骡子一起工作,我有一些问题。

我的mainflow.xml:

<?xml version="1.0" encoding="UTF-8"?><mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:management="http://www.mulesoft.org/schema/mule/management"
version="CE-3.3.0"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd 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://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/current/mule-management.xsd">

<!-- For show MX4J -->
<management:jmx-default-config port="1098"
    registerMx4jAdapter="true">
</management:jmx-default-config>
<management:jmx-mx4j-adaptor jmxAdaptorUrl="http://localhost:9999"
    login="admin" password="admin">
</management:jmx-mx4j-adaptor>
<management:jmx-server enableStatistics="true">
    <management:connector-server
        url="service:jmx:rmi:///jndi/rmi://localhost:1099/server" rebind="false" />
</management:jmx-server>
<management:rmi-server createRegistry="true" />

<!-- For get statistics -->
<notifications>
    <notification event="EXCEPTION" />
    <notification event="ENDPOINT-MESSAGE" />
    <notification-listener ref="endpointNotificationLogger" />
    <notification-listener ref="statesModuleExceptionNotificationListener" />
</notifications>

<spring:beans>

    <!-- For show MX4J -->
    <spring:bean id="exporter"
        class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
        <spring:property name="beans">
            <spring:map>
                <spring:entry key="bean:name=MBean1"
                    value-ref="MBean1" />
                <spring:entry key="bean:name=MBean2"
                    value-ref="MBean2" />
            </spring:map>
        </spring:property>
    </spring:bean>
    <spring:bean id="MBean1" name="MBean1"
        class="MBean1"></spring:bean>
    <spring:bean id="MBean2" name="MBean2"
        class="MBean2"></spring:bean>

    <!-- For get statistics -->
    <spring:bean name="endpointNotificationLogger"
        class="MyEndpointNotificationListener" />
    <spring:bean name="myExceptionNotificationListener"
        class="MyExceptionNotificationListener" />

    <spring:bean id="MyBean" name="MyBean"
        class="MyBean">
    </spring:bean>
</spring:beans>
<!-- <file:connector name="input" autoDelete="true" doc:name="File" />-->
<file:connector name="inputFileConnector" autoDelete="true" doc:name="File" >
    <service-overrides messageReceiver="myFileMessageReceiver"/>
</file:connector>
<flow name="UnpackHandler" doc:name="UnpackHandler">
    ...
</flow>
<flow name="XmlToCsvTransformHandler" doc:name="XmlToCsvTransformHandler">
    ...
</flow>

Tomcat中的一切正常。但之后我提交了对SVN的更改,检查了所有内容,包没有更改并在Tomcat中部署应用程序我的应用程序不起作用!

我的应用程序的Tomcat日志中的最新文本:

DEBUG 18.12.2014 15:12:08 997 - DisposableBeanAdapter.invokeCustomDestroyMethod - Invoking destroy method 'dispose' on bean with name '_muleSystemModel'
INFO 18.12.2014 15:12:08 997 - ModelLifecycleManager.fireDisposePhase - Disposing model: _muleSystemModel

并且没有任何关于错误的日志...... 当应用程序工作正常时,在这行后我看到

DEBUG 18.12.2014 10:59:53 765 - MuleXmlBuilderContextListener.initialize - Mule config file(s): WEB-INF/classes/mainflow.xml

如果我有此错误并从mx4jnotifications的mainflow.xml部分删除,则所有内容都会重复:

<?xml version="1.0" encoding="UTF-8"?><mule xmlns="http://www.mulesoft.org/schema/mule/core" mlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.3.0" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd 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 ">
</spring:beans>
<file:connector name="input" autoDelete="true" doc:name="File" />
<flow name="UnpackHandler" doc:name="UnpackHandler">
    ...
</flow>
<flow name="XmlToCsvTransformHandler" doc:name="XmlToCsvTransformHandler">
    ...
</flow>

在我逐步编写mx4jnotifications的部分后,不要粘贴我从SVN获取的文件的所有文本,它再次起作用!因此,当应用程序工作且不起作用时,mainflow.xml之间没有区别。

此行为在Linux服务器中。在Windows服务器和我的本地计算机中一切正常。我想到了斜杠之间的差异,但我不写斜线......

为什么应用程序表现得如此奇怪?

1 个答案:

答案 0 :(得分:0)

根据您提供的信息,我只能猜测,如果它们所依赖的某些内容尚未以某种方式初始化,那么挂起它们的通知中就会有一些逻辑。

以后它确实起作用的事实会以某种方式表明这一点。我建议你在bean中使用属性依赖,以确保它在你的bean依赖之后被初始化,以防万一。