muleESB使用smack包连接ejabberd的问题
1.环境:muleESB版本3.3.1。里面集成了smack包,smack包版本为3.1.0;操作系统:windows.2.mule-config.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www. xmlns:xsi="http://www.
xmlns:spring="http://www. xmlns:xmpp="http://www.
xmlns:stdio="http://www.
xsi:schemaLocation="http://www.
http://www.
http://www. http://www.
http://www. http://www.
http://www. http://www.
<xmpp:connector name="xmppConnector" host="
user="admin" password="admin" />
<stdio:connector name="stdioConnector"
messageDelayTime="1234" outputMessage="" promptMessage="please Enter:"
promptMessageCode="456" />
<flow name="flow">
<stdio:inbound-endpoint system="IN"
connector-ref="stdioConnector" />
<all>
<processor-chain>
<stdio:outbound-endpoint system="OUT"
connector-ref="stdioConnector" />
<xmpp:outbound-endpoint type="CHAT" recipient="XXX@ />
</processor-chain>
</all>
</flow>
</mule>
最开始报错
java.lang.NullPointerException
at org.jivesoftware.smack.util.Base64.encodeBytes(Base64.java:636)
at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java:152)
at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication.java:492)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:338)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)
方法:修改SASLMechanism.java:152的源码,重新编译,将原来的class做替换,重新build
String authenticationText = null;
if(null != response) {
authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
}
if((null == authenticationText) || (authenticationText.equals(""))) {
authenticationText = "=";
}
虽然空指针异常没有了。但是重启mule-server
Exception stack is:
1. No response from the server. (org.jivesoftware.smack.XMPPException)
org.jivesoftware.smack.SASLAuthentication:430 (null)
2. No response from the server. (org.mule.retry.RetryPolicyExhaustedException)
org.mule.retry.policies.AbstractPolicyTemplate:105 (http://www.)
--------------------------------------------------------------------------------
Root Exception stack trace:
No response from the server.:
at org.jivesoftware.smack.SASLAuthentication.bindResourceAndEstablishSession(SASLAuthentication.java:430)
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:331)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
现在没招了。不知道有童鞋有这段经历没?