本文介绍了网络不可达?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想运行一个Cyc(opencyc)Java类,但是当我运行这个类时,我得到一个错误,提到网络是不可达到的。我正在使用NetBeans 7.0和opencyc 2.0 win 32版本。我正在使用localhost(127.0.0.1)进行测试。错误在下面。

 网络无法连接:connect 
java.net.SocketException:网络无法连接:连接
在java .net.PlainSocketImpl.socketConnect(Native Method)
在java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
在java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
在java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
在java.net.Socket.connect(Socket .java:519)
在java.net.Socket.connect(Socket.java:469)
在java.net.Socket。< init>(Socket.java:366)
在java.net.Socket。< init>(Socket.java:180)
在org.opencyc.api.CycConnection.initializeApiConnections(CycConnection.java:223)
在org.opencyc.api。 CycConnection。< init>(CycConnection.java:199)
在org.opencyc.api.CycAccess。< init>(CycAccess.java:121)
在org.opencyc.api.CycAccess。 < init>(CycAccess.java:61)
在org.opencyc.api.ApiDemo。< ; init>(ApiDemo.java:50)
在org.opencyc.api.ApiDemo.main(ApiDemo.java:147)
线程main中的异常java.lang.NullPointerException
在org.opencyc.api.ApiDemo。< init>(ApiDemo.java:56)
在org.opencyc.api.ApiDemo.main(ApiDemo.java:147)
等待循环连接中断建立,关闭套接字
线程Thread-1中的异常java.lang.NullPointerException
在org.opencyc.api.CycConnection $ TaskProcessorBinaryResponseHandler.access $ 002(CycConnection.java:988)
at org.opencyc.api.CycConnection.close(CycConnection.java:268)
在org.opencyc.api.CycConnection $ ConnectionTimer.run(CycConnection.java:1351)

为什么会发生这种情况?如何连接到cyc cyc?

解决方案

如果您有相同的版本,则尝试与定义的主机名和端口建立与Cyc图像的连接通过



CycConnection.DEFAULT_HOSTNAME

CycConnection.DEFAULT_BASE_PORT



您可以找到正确的值通过在Cyc图像中评估以下内容来使用:

 
(get-machine-name)
* BASE-TCP-PORT *

希望对您有用。


I want to run a cyc (opencyc) Java class, but when I run this class I got an error mentioning that the network is unreachable. I am working on NetBeans 7.0 and opencyc 2.0 win 32 version. I am using localhost (127.0.0.1) to test. The error is below.

Network is unreachable: connect
java.net.SocketException: Network is unreachable: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at org.opencyc.api.CycConnection.initializeApiConnections(CycConnection.java:223)
at org.opencyc.api.CycConnection.<init>(CycConnection.java:199)
at org.opencyc.api.CycAccess.<init>(CycAccess.java:121)
at org.opencyc.api.CycAccess.<init>(CycAccess.java:61)
at org.opencyc.api.ApiDemo.<init>(ApiDemo.java:50)
at org.opencyc.api.ApiDemo.main(ApiDemo.java:147)
Exception in thread "main" java.lang.NullPointerException
at org.opencyc.api.ApiDemo.<init>(ApiDemo.java:56)
at org.opencyc.api.ApiDemo.main(ApiDemo.java:147)
Interruption while waiting Cyc connection establishment, closing sockets
Exception in thread "Thread-1" java.lang.NullPointerException
at org.opencyc.api.CycConnection$TaskProcessorBinaryResponseHandler.access$002(CycConnection.java:988)
at org.opencyc.api.CycConnection.close(CycConnection.java:268)
at org.opencyc.api.CycConnection$ConnectionTimer.run(CycConnection.java:1351)

Why is this happening? How can I connect to the cyc?

解决方案

If you have the same version I have, it's trying to establish a connection to a Cyc image with the hostname and port defined by

CycConnection.DEFAULT_HOSTNAME
CycConnection.DEFAULT_BASE_PORT

You can find the proper values to use by evaluating the following in your Cyc image:

(get-machine-name)
*BASE-TCP-PORT*

Hope this works for you.

这篇关于网络不可达?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 06:14