2013-04-11 101 views
0

我試圖把Ejabberd服務器放在Mule ESB社區版的後面,這意味着所有到Ejabberd服務器的消息必須首先進入ESB。通過Mule ESB CE連接Ejabbered CE

我用了XMPP連接器在文件中如下XML配置:

<?xml version="1.0" encoding="UTF-8"?> 
<mule xmlns="http://www.mulesoft.org/schema/mule/core" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xmpp="http://www.mulesoft.org/schema/mule/xmpp" 
    xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio" 
    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/3.1/mule.xsd 
    http://www.mulesoft.org/schema/mule/xmpp http://www.mulesoft.org/schema/mule/xmpp/3.1/mule-xmpp.xsd 
    http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/3.1/mule-stdio.xsd"> 

    <xmpp:connector name="xmppConnector" host="192.168.1.132" port="5222" user="[email protected]" password="password"/> 

    <flow name="stdio2xmpp"> 
     <stdio:inbound-endpoint system="IN"/> 
     <xmpp:outbound-endpoint type="CHAT" recipient="[email protected]"/> 
    </flow> 

    <flow name="xmpp2stdio"> 
     <xmpp:inbound-endpoint type="CHAT" from="[email protected]"/> 
     <xmpp:xmpp-to-object-transformer/> 
     <stdio:outbound-endpoint system="OUT"/> 
    </flow> 
</mule> 

我敢肯定,用戶名和密碼是正確的,因爲我可以用洋涇浜用它登錄服務器。當我試圖在studio中運行這個流程時,它總是拋出異常「未連接到服務器」。

Exception in thread "main" org.mule.module.launcher.DeploymentStartException: IllegalStateException: Not connected to server. 
     at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:174) 
     at org.mule.module.launcher.application.ApplicationWrapper.start(ApplicationWrapper.java:107) 
     at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47) 
     at org.mule.tooling.server.application.ApplicationDeployer.run(ApplicationDeployer.java:56) 
     at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:88) 
     Caused by: org.mule.retry.RetryPolicyExhaustedException: Not connected to server. 
     at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:105) 
     at org.mule.transport.AbstractConnector.connect(AbstractConnector.java:1616) 
     at org.mule.transport.AbstractConnector.start(AbstractConnector.java:428) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
     at java.lang.reflect.Method.invoke(Unknown Source) 
     at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:225) 
     at org.mule.lifecycle.RegistryLifecycleManager$RegistryLifecycleCallback.onTransition(RegistryLifecycleManager.java:276) 
     at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:155) 
     at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:126) 
     at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:80) 
     at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:120) 
     at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:94) 
     at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:90) 
     at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:72) 
     at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:64) 
     at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:250) 
     at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:151) 
     ... 4 more 
     Caused by: java.lang.IllegalStateException: Not connected to server. 
     at org.jivesoftware.smack.XMPPConnection.addPacketListener(XMPPConnection.java:747) 
     at org.jivesoftware.smackx.ServiceDiscoveryManager.init(ServiceDiscoveryManager.java:270) 
     at org.jivesoftware.smackx.ServiceDiscoveryManager.(ServiceDiscoveryManager.java:80) 
     at org.jivesoftware.smackx.ServiceDiscoveryManager$1.connectionCreated(ServiceDiscoveryManager.java:66) 
     at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:957) 
     at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:904) 
     at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1415) 
     at org.mule.transport.xmpp.XmppConnector.connectToJabberServer(XmppConnector.java:137) 
     at org.mule.transport.xmpp.XmppConnector.doConnect(XmppConnector.java:84) 
     at org.mule.transport.AbstractConnector$5.doWork(AbstractConnector.java:1556) 
     at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:67) 
     ... 22 more 

任何人都有這個問題的想法?謝謝。

回答

0

mule它建立在Smack的頂部,可能會遇到建立連接的問題。

你能證實xmpp服務器啓動嗎?一旦你知道它繼續並調試Smack。 Smack連接init只捕獲可能拋出異常的子集。 例如它會忽略NPE並在OK中聲明連接。 它也不是線程安全的,所以只有一個連接到xmpp服務器的原型。

+0

我確定服務器已啓動。好吧,我會嘗試在mule esb中調試Smack。 – Tony 2013-04-15 04:26:53