在简单的JXTA 2.7应用程序中获得异常

时间:2012-02-28 09:47:42

标签: java p2p jxta

我正在JXTA 2.7中开发一个简单的程序,它向我显示以下错误。

public static void main(String[] args) throws IOException, PeerGroupException {
        System.setProperty(Logging.JXTA_LOGGING_PROPERTY, Level.OFF.toString());
        NetworkManager manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, "Test");
        System.out.println(" S t a r t ing JXTA");
        manager.startNetwork();
        System.out.println(" JXTA St a r t ed ");            
}

错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/channel/socket/httptunnel/HttpTunnelClientChannelFactory
    at net.jxta.impl.endpoint.netty.http.NettyHttpTunnelTransport.createClientSocketChannelFactory(NettyHttpTunnelTransport.java:27)
    at net.jxta.impl.endpoint.netty.NettyTransport.initClient(NettyTransport.java:124)
    at net.jxta.impl.endpoint.netty.NettyTransport.init(NettyTransport.java:76)
    at net.jxta.impl.peergroup.GenericPeerGroup.loadModule(GenericPeerGroup.java:677)
    at net.jxta.impl.peergroup.GenericPeerGroup.loadModule(GenericPeerGroup.java:801)
    at net.jxta.impl.peergroup.StdPeerGroup.loadAllModules(StdPeerGroup.java:295)
    at net.jxta.impl.peergroup.StdPeerGroup.initFirst(StdPeerGroup.java:842)
    at net.jxta.impl.peergroup.Platform.initFirst(Platform.java:214)
    at net.jxta.impl.peergroup.GenericPeerGroup.init(GenericPeerGroup.java:907)
    at net.jxta.peergroup.WorldPeerGroupFactory.newWorldPeerGroup(WorldPeerGroupFactory.java:312)
    at net.jxta.peergroup.WorldPeerGroupFactory.<init>(WorldPeerGroupFactory.java:182)
    at net.jxta.peergroup.NetPeerGroupFactory.<init>(NetPeerGroupFactory.java:203)
    at net.jxta.platform.NetworkManager.startNetwork(NetworkManager.java:408)
    at jxta_my.JXTA_My.main(JXTA_My.java:36)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.socket.httptunnel.HttpTunnelClientChannelFactory
......

我无法弄清楚这里出了什么问题。我已经下载了缺少的库jetty并将其放入库路径(netbeans 7.0.1)。有人请帮帮我。

1 个答案:

答案 0 :(得分:1)

您需要将netty包含在类路径中。你可以从netty.io网站上获取它。