jboss的web程序中加socket监听程序报错?
最近在开发java接口,原来是http协议,结果和我对接的平台是C语言,支持tcp,但他们平台必须要求在开头把报文长度用字节告诉他们才行,所以http协议他们不能用,只能用tcp传字节过去。
没法为了方便我就在原来的web工程里面开了一个线程里面跑netty去监听另外一个端口,让他们到时候通过这个端口来访问服务器,同时还能兼容http。
现在开发已经完成,这个程序在tomcat上运行良好,但是一发布到jboss上就开始报连接端口被拒绝的错误。现在服务器上只能跑jboss做服务器不能跑tomcat。现在不知道怎么办才好。
下面是我测试客户端程序访问jboss里面工程socket端口时返回的错误:
Exception in thread "main" java.net.ConnectException: Connection refused: no further information: /127.0.0.1:8087
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:191)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:241)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:502)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:452)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:794)
at java.lang.Thread.run(Thread.java:745)