无法在FreeBSD上运行java文件(java.net.SocketException无效参数)

时间:2012-09-14 09:53:06

标签: java freebsd

我想在freeBSD Server上启动我的java文件。这就是他告诉我的:

    ossnode2# java Telnet_MSS_Sub
    java.net.SocketException: Invalid argument
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:316)
    at                   java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:177)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:164)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:354)
    at java.net.Socket.connect(Socket.java:574)
    at java.net.Socket.connect(Socket.java:524)
    at java.net.Socket.<init>(Socket.java:421)
    at java.net.Socket.<init>(Socket.java:204)
    at  org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:53)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
    at Telnet_MSS_Sub.<init>(Telnet_MSS_Sub.java:32)
    at Telnet_MSS_Sub.main(Telnet_MSS_Sub.java:221)
       End of telnet
      java.lang.NullPointerException
    at org.apache.commons.net.telnet.TelnetClient.disconnect(TelnetClient.java:125)
    at Telnet_MSS_Sub.disconnect(Telnet_MSS_Sub.java:200)
    at Telnet_MSS_Sub.main(Telnet_MSS_Sub.java:223)
     com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

     ** BEGIN NESTED EXCEPTION **

     java.net.SocketException
      MESSAGE: Invalid argument

     STACKTRACE:

     java.net.SocketException: Invalid argument
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:316)
    at              java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:177)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:164)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:354)
    at java.net.Socket.connect(Socket.java:574)
    at java.net.Socket.connect(Socket.java:524)
    at java.net.Socket.<init>(Socket.java:421)
    at java.net.Socket.<init>(Socket.java:237)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
    at java.sql.DriverManager.getConnection(DriverManager.java:620)
    at java.sql.DriverManager.getConnection(DriverManager.java:200)
    at Telnet_MSS_Sub.main(Telnet_MSS_Sub.java:293)


    ** END NESTED EXCEPTION **



        Last packet sent to the server was 4 ms ago.

我在运行freeBSD之前编译它。我认为JVM安装正常。 同一个文件在Windows上运行。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

java -Djava.net.preferIPv4Stack=true Telnet_MSS_Sub