尝试启动 XMPP 服务器时出现“地址已被使用”

尝试启动 XMPP 服务器时出现“地址已被使用”

我一直试图启动一个预编译的可执行文件来启动 XMPP 服务,但无济于事。这是可执行文件来自的项目http://sourceforge.net/projects/androidpn/

我的设置是一台机器(ubuntu 服务器操作系统),有两个 IP 地址(我们称之为 IP1 和 IP2)。每次我尝试启动 XMPP 服务器时,都会收到来自 Java 可执行文件的错误“地址已在使用中”。XMPP使用的端口是空闲的,为了确保万无一失,我确保 Apache 只监听 IP1 上的端口。但是,我仍然无法启动 XMPP 服务器。

是不是我的 2 个 IP 地址设置方式有问题?还是我遗漏了其他什么?

提前致谢。

编辑: 感谢 Paul, netstat -pant显示了这一行(5222 是 XMPP 服务器使用的端口):

tcp 0 0 0.0.0.0:5222 0.0.0.0:* LISTEN 14085/citserver

我假设 0.0.0.0 指的是所有 IP。由于我在这个盒子上有两个 IP 地址,有没有办法让 citserver/webcit/citadel 只监听第一个 IP,为第二个 IP 上的预编译 XMPP 释放相同的端口?

ps 描述错误的日志块:

{INFO } [2012-06-13 11:23:22,578] <org.hibernate.impl.SessionFactoryImpl> : closing
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ioAcceptor' defined in class path resource [spring-config.xml]: Invocation of init method failed; nested exception is java.net.BindException: Address already in use
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
        at org.androidpn.server.xmpp.XmppServer.start(XmppServer.java:91)
        at org.androidpn.server.xmpp.XmppServer.<init>(XmppServer.java:76)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at java.lang.Class.newInstance0(Class.java:372)
        at java.lang.Class.newInstance(Class.java:325)
        at org.androidpn.server.starter.ServerStarter.start(ServerStarter.java:82)
        at org.androidpn.server.starter.ServerStarter.main(ServerStarter.java:48)
Caused by: java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:137)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:77)
        at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:251)
        at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:48)
        at org.apache.mina.core.polling.AbstractPollingIoAcceptor.registerHandles(AbstractPollingIoAcceptor.java:523)
        at org.apache.mina.core.polling.AbstractPollingIoAcceptor.access$200(AbstractPollingIoAcceptor.java:65)
        at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:407)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)
{INFO } [2012-06-13 11:23:22,596] <org.androidpn.server.xmpp.XmppServer> : XmppServer stopped

相关内容