2012-04-12 2 views
0

openCyc 기술 자료에 연결하기 위해 cycAccess 객체를 만들고 싶지만이 객체를 만들 수 없습니다. 나는이 코드에서 NoClassDefFoundError를 얻었습니다 ... Plz 아무도 나를 도울 수 있습니까? 다음은NoClassDefFoundError OpenCyc을 사용하려고하는데 무슨 문제가 있습니까?

public static void exampleConnectingToCyc() { 
System.out.println("Starting Cyc connection examples."); 
CycAccess access = null; 
try { 
    access = new CycAccess("localhost", 3602); 
    System.out.println("Successfully established CYC access " + access); 

    // The following code should only be called if you will be modifying the KB 
    // and one should typically use a real user and more specific KE purpose. 
    // This information is used for accurately maintaining KB content 
    // bookkeeping information. 
    CycConstant cycAdministrator = access.getKnownConstantByName("CycAdministrator"); 
    CycConstant generalCycKE = access.getKnownConstantByName("GeneralCycKE"); 
    access.setCyclist(cycAdministrator); 
    access.setKePurpose(generalCycKE); 

    // Do stuff with the connection here. 

    // Note: The class CycAccess contains many of the 
    // useful public methods for interacting with Cyc. 

    // Note: Establishing a connection with Cyc is relatively expensive. 
    // If you have a lot of work to do with Cyc over time, make a single 
    // CycAccess object and use that everywhere. 
} catch (UnknownHostException nohost) { 
    // if cyc server host not found on the network 
    nohost.printStackTrace(); 
} catch (IOException io) { 
    // if a data communication error occurs 
    io.printStackTrace(); 
} catch (CycApiException cyc_e) { 
    // if the api request results in a cyc server error 
    // example: cannot launch servicing thread; 
    // protocol errors, etc. 
} catch (Exception e) { 
} finally { 
    // ensure that the connection is closed when finished 
    if (access != null) { 
    access.close(); 
    } 
} 
System.out.println("Finished."); 

가}

+1

예외는 무엇입니까? –

+1

그리고 어떤 클래스가 발견되지 않습니까? 오류의 전체 로그를 게시하십시오. – Jules

답변

0

NoClassDefFoundError를 보통 컴파일시에 가능했던 클래스가 런타임에 사용할 수없는 것을 의미합니다 .... 내 코드입니다. 필요한 모든 의존성이 클래스 경로에 있는지 확인하기 위해 애플리케이션의 클래스 경로를 확인하는 것이 좋습니다. 이 코드의 대부분은 JDK에서 제공하는 클래스를 사용하기 때문에 CycAccess 및 CycConstant 클래스에 필요한 종속성을 살펴 봐야합니다.

+0

고마워 .... 지금 일하고있어 .. – Rosh

관련 문제