我尝试将 Ejabberd 服务器放在 Mule ESB 社区版的后面,这意味着所有发往 Ejabberd 服务器的消息都必须首先发送到 ESB。
我在文档中使用了 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="whh@whh.com" password="password"/>
<flow name="stdio2xmpp">
<stdio:inbound-endpoint system="IN"/>
<xmpp:outbound-endpoint type="CHAT" recipient="sjc@whh.com"/>
</flow>
<flow name="xmpp2stdio">
<xmpp:inbound-endpoint type="CHAT" from="sjc@whh.com"/>
<xmpp:xmpp-to-object-transformer/>
<stdio:outbound-endpoint system="OUT"/>
</flow>
</mule>
我确定用户名和密码是正确的,因为我可以使用 Pidgin 登录服务器。当我尝试在工作室中运行此流程时,它总是抛出“未连接到服务器”异常。
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
有人对这个问题有想法吗?谢谢。