如何运行 apache 的 vysper xmpp 服务器

Posted

技术标签:

【中文标题】如何运行 apache 的 vysper xmpp 服务器【英文标题】:how to run apache's vysper xmpp server 【发布时间】:2013-09-17 23:17:50 【问题描述】:

我在运行 vysper 时遇到问题。

    从here(Apache Vysper 0.7 版本)下载/提取文件 修改了 spring-config.xml 以增加用户/密码

刚刚更新了这个部分:

 <bean id="addUsers" class="org.apache.vysper.spring.AddUserHelper">
        <constructor-arg index="0">
            <map>
                <entry key="admin@test" value="Password" />
                <entry key="darewreck@test" value="Password" />
                <!--<entry key="user2@vysper.org" value="CHOOSE A SECURE PASSWORD" />-->
                <!--<entry key="user3@vysper.org" value="CHOOSE A SECURE PASSWORD" />-->
            </map>
        </constructor-arg>
        <property name="storageProviderRegistry" ref="storageRegistry" />
    </bean>

我假设“test”是服务器运行时的注册域? 或者有没有你指定服务器域的地方?

    已执行 /bin/run.bat

16:16:22,415 |信息 | org.springframework.context.support.ClassPathXmlApplicationContext | 清爽 org.springframework.context.support.ClassPathXmlApplicationContext@625e068: 启动日期 [星期一九月 16 16:16:22 PDT 2013];上下文层次的根 16:16:22,457 |信息 | org.springframework.beans.factory.xml.XmlBeanDefinitionReader | 从类路径资源加载 XML bean 定义 [弹簧配置.xml] 16:16:22,514 |信息 | org.springframework.beans.factory.support.DefaultListableBeanFactory | 预实例化单例 org.springframework.beans.factory.support.DefaultListableBeanFactory@19f9e 414:定义bean [inmemoryStorageRegistry,jcrStorageRegistry,addUsers,tcpEndpoint,server]; 工厂层次结构的根 16:16:22,762 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |更换 存储提供程序注册表 org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry 16:16:22,821 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块...服务发现(1.0beta) 16:16:22,825 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块...名册(1.0beta) 16:16:22,877 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0092 软件版本 (1.0) 16:16:22,881 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0202 实体时间 (1.0) 16:16:22,883 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0054 Vcard-temp (1.0) 16:16:22,883 |错误 | org.apache.vysper.xmpp.modules.extension.xep0054_vcardtemp.VcardTempModule |未找到 VcardTempPersistenceManager 16:16:22,883 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0199 XMPP Ping (2.0) 16:16:22,883 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0049 私有数据 (1.2) 16:16:22,884 |错误 | org.apache.vysper.xmpp.modules.extension.xep0049_privatedata.PrivateDataModule |未找到 PrivateDataPersistenceManager 16:16:22,884 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0050 Ad-hoc 命令 (1.2) 16:16:22,885 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0133 服务管理 (1.1) 16:16:22,885 |信息 | org.apache.vysper.xmpp.server.DefaultServerRuntimeContext |添加 模块... XEP-0045 多用户聊天 (1.24) 16:16:22,891 |警告 | org.apache.vysper.xmpp.modules.extension.xep0045_muc.MUCModule |不 找到房间存储提供程序,使用默认值(在内存中) 16:16:22,891 |警告 | org.apache.vysper.xmpp.modules.extension.xep0045_muc.MUCModule |不 找到占用存储提供程序,使用默认值(在内存中)

    打开一个 XMPP 客户端 (Swift)(任何 XMPP 客户端都应该可以工作)

用户:darewreck@test 密码:密码

但是,Swift 客户端收到加密错误。我不确定自己做错了什么。

服务器打印出来:

16:18:49,571 | DEBUG | org.apache.vysper.xmpp.protocol.SessionStateHolder | session state changed to = INITIATED
16:18:56,582 | DEBUG | org.apache.vysper.xml.decoder.XMPPContentHandler | Decoder writing stanza: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" to="test" version="1.0"></stream:stream
>
16:18:56,584 | INFO  | stanza.client | stream
16:18:56,585 | DEBUG | org.apache.vysper.xmpp.protocol.SessionStateHolder | session state changed to = STARTED
16:18:56,588 | INFO  | stanza.server | stream.starttls[required]
16:18:56,590 | DEBUG | org.apache.vysper.xml.decoder.XMPPContentHandler | Decoder writing stanza: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls>
16:18:56,591 | INFO  | stanza.client | starttls
16:18:56,592 | DEBUG | org.apache.vysper.xmpp.protocol.SessionStateHolder | session state changed to = ENCRYPTION_STARTED
16:18:56,604 | DEBUG | org.apache.vysper.xmpp.protocol.SessionStateHolder | session state changed to = CLOSED

是不是我没有正确配置 spring-config.xml 文件中提供的身份验证/密码?

【问题讨论】:

您是否将设置 相应地更改为“test”?您是否还确保服务器可以明确访问您的 SSL 证书?此设置在此处给出: 【参考方案1】:

<bean id="inmemoryStorageRegistry" class="org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry" />

<bean id="jcrStorageRegistry" class="org.apache.vysper.storage.jcr.JcrStorageProviderRegistry" />

<!-- choose one of the storage registries -->
<alias name="inmemoryStorageRegistry" alias="storageRegistry" />

<!-- default users; remove if you have persistently stored users
     NOTE: if passwords are empty, random passwords are generated and printed on the console
           So, your default install of Vysper is secure from the very beginning
-->
<bean id="addUsers" class="org.apache.vysper.spring.AddUserHelper">
    <constructor-arg index="0">
        <map>
            <entry key="admin@vysper.org" value="CHOOSE A SECURE PASSWORD" />
            <entry key="user1@localhost" value="user1" />
            <entry key="user2@localhost" value="user2" />
            <!--<entry key="user3@vysper.org" value="CHOOSE A SECURE PASSWORD" />-->
        </map>
    </constructor-arg>
    <property name="storageProviderRegistry" ref="storageRegistry" />
</bean>

<bean id="tcpEndpoint" class="org.apache.vysper.mina.TCPEndpoint">
</bean>

<!-- for making the server available over HTTP transport, configure the BOSH endpoint
     BOSH requires extension xep0124-xep0206-bosh to be on the classpath.
-->

<bean id="boshEndpoint" class="org.apache.vysper.xmpp.extension.xep0124.BoshEndpoint">
    <property name="accessControlAllowOrigin">
        <list><value>*</value></list>
    </property>
    <property name="port" value="8080" />
    <property name="contextPath" value="/bosh" />
</bean>


<bean id="server" class="org.apache.vysper.spring.SpringCompatibleXMPPServer"
      init-method="init" destroy-method="destroy">
    <!-- TODO change domain name to your domain -->
    <constructor-arg value="localhost"/>
    <property name="endpoints">
        <list>
            <ref bean="tcpEndpoint"/>
            <ref bean="boshEndpoint"/>
        </list>
    </property>
    <property name="storageProviderRegistry" ref="storageRegistry" />
    <property name="certificateFile" value="classpath:bogus_mina_tls.cert" />
    <property name="certificatePassword" value="boguspw" />
    <property name="modules" >
        <list>
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0092_software_version.SoftwareVersionModule"/>
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0202_entity_time.EntityTimeModule" />
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0054_vcardtemp.VcardTempModule" />
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0119_xmppping.XmppPingModule" />
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0049_privatedata.PrivateDataModule" />
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0050_adhoc_commands.AdhocCommandsModule" />
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0133_service_administration.ServiceAdministrationModule" >
                <property name="addAdmins">
                    <list><value>admin@vysper.org</value></list>
                </property>
            </bean>
            <!-- below some more modules which are available as separately-built jars. 
                 make sure they are on the classpath when enabling them or remove the beans below, 
                 depending on the features your server should expose -->
            <!--<bean class="org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.PublishSubscribeModule" />-->
            <bean class="org.apache.vysper.xmpp.modules.extension.xep0045_muc.MUCModule" />
        </list>
    </property>
</bean>

【讨论】:

我已经粘贴了我的 spring-config.xml 文件内容。比较您的 xml 文件并进行必要的更改。

以上是关于如何运行 apache 的 vysper xmpp 服务器的主要内容,如果未能解决你的问题,请参考以下文章

Apache Vysper 服务器配置?

Apache MINA Vysper 文档?

vysper 地址已被使用

Java EE 容器中的嵌入式 XMPP 服务器会因为线程而有害吗?

带有 Smack 4.1.8 客户端库的 Apache Vysper - 如何处理 TLS 证书?

通过 XMPP 进行 XML RPC