当前位置: 代码迷 >> Java相关 >> muleESB使用smack包连接ejabberd的问题
  详细解决方案

muleESB使用smack包连接ejabberd的问题

热度:440   发布时间:2013-05-02 15:36:00.0
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.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-3.0.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="XXX.com"
        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@aXXX.com" />
            </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.mulesoft.org/docs/site/current3/apidocs/org/mule/retry/RetryPolicyExhaustedException)
     --------------------------------------------------------------------------------
     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)

现在没招了。不知道有童鞋有这段经历没?
搜索更多相关的解决方案: version  操作系统  

----------------解决方案--------------------------------------------------------
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.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-3.0.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="XXX.com"
        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@aXXX.com" />
            </processor-chain>
        </all>
    </flow>        
     
</mule>
额,额,xingxi114.com新人来看看,共同学习进步,顶楼主
----------------解决方案--------------------------------------------------------
  相关解决方案