jxta-P2P学习


JXTA <wbr>- <wbr>P2P开发平台基本API使用
1. 安装配置JDK:
jdk-6u33-windows-i586

2. 安装配置Eclipse:
eclipse-java-indigo-SR2-win32

3. 下载JXTA开发包:
jxse-src-2.5.zip
jxse-lib-2.5.zip
jxse-tutorials-src-2.5.zip
jxse-doc-2.5.zip

4. 解压缩得到jar文件:
将jxse-lib-2.5.zip中解压得到的4个文件:
bcprov-jdk14.jar
javax.servlet.jar
jxta.jar
org.mortbay.jetty.jar
复制到任意目录,我放在eclipse安装目录下新建的目录3rd\jxta中。

5. 创建Eclipse工程:
【文件】->【新建】->【Java项目】->【项目名:jxta_helloworld】->【下一步】->【库标签】->【添加外部JAR】->【选择解压缩得到的4个jar文件】->【完成】

6. 新建package包:
【jxta_helloworld工程右键】->【新建】->【包】->【名称:tutorial.helloworld】->【完成】

7. 新建java源文件:
【tutorial.helloworld包右键】->【新建】->【类】->【名称:HelloWorld】->【完成】

8. 编辑源代码:
注意:此源代码来源于jxse-tutorials-src-2.5.zip解压缩得到的src/tutorial/helloworld/HelloWorld.java文件,其他工程也都可用来运行测试。
package tutorial.helloworld;

import net.jxta.platform.NetworkManager;
import java.text.MessageFormat;
import java.io.File;

public class HelloWorld {

   
    public static void main(String args[]) {
        NetworkManager manager = null;

        try {
            manager = new NetworkManager(NetworkManager.ConfigMode.ADHOC, "HelloWorld", new File(new File(".cache"), "HelloWorld").toURI());
            System.out.println("Starting JXTA");
            manager.startNetwork();
            System.out.println("JXTA Started");
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
        System.out.println("Waiting for a rendezvous connection");
        boolean connected = manager.waitForRendezvousConnect ion(12000);

        System.out.println(MessageFormat.format("Connected :{0}", connected));
        System.out.println("Stopping JXTA");
        manager.stopNetwork();
    }
}

9. 运行程序:
【运行】->【运行方式】->【Java 应用程序】

10. 运行结果:
工程根目录将产生文件夹.cache,控制台输出:
Starting JXTA
2012-7-16 17:32:27 net.jxta.platform.NetworkManager configure
信息: Loading existing configuration. mode = ADHOC
2012-7-16 17:32:27 net.jxta.platform.NetworkManager startNetwork
信息: Starting JXTA Network! MODE = ADHOC,   HOME = file:/D:/eclipse/workspace/jxta_tutorial_helloworld/.cache/HelloWorld/
2012-7-16 17:32:27 net.jxta.impl.protocol.RelayConfigAdv <init>
警告: Unhandled Element: net.jxta.impl.document.LiteXMLElement@12498b5 / isOff = <<null value>>
2012-7-16 17:32:27 net.jxta.impl.loader.RefJxtaLoader findModuleImplAdvertisem ent
警告: No class for urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE 0000000C0206
2012-7-16 17:32:27 net.jxta.peergroup.WorldPeerGroupFactory newWorldPeerGroup
信息: Making a new World Peer Group instance using : net.jxta.impl.peergroup.Platform
2012-7-16 17:32:27 net.jxta.impl.cm.SrdiIndex clearSrdi
信息: Clearing SRDI for null
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Always Access Service (net.jxta.impl.access.always.AlwaysAccessService)
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.IncomingUnicastServer openServerSocket
信息: Server will accept connections at /0.0.0.0:9701
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the TCP Message Transport (net.jxta.impl.endpoint.tcp.TcpTransport)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Rendezvous Service (net.jxta.impl.rendezvous.RendezVousServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Peerinfo Service (net.jxta.impl.peer.PeerInfoServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Endpoint service (net.jxta.impl.endpoint.EndpointServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : None Membership Service (net.jxta.impl.membership.none.NoneMembershipService)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Resolver service (net.jxta.impl.resolver.ResolverServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Discovery service (net.jxta.impl.discovery.DiscoveryServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the IP Multicast Message Transport (net.jxta.impl.endpoint.mcast.McastTransport)
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:32:27 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:32:27 net.jxta.impl.peer.PeerInfoServiceImpl startApp
警告: Stalled until there is a resolver service
2012-7-16 17:32:27 net.jxta.impl.endpoint.EndpointServiceImpl startApp
信息: Endpoint Service started.
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
警告: Stalled until there is a rendezvous service
2012-7-16 17:32:27 net.jxta.impl.endpoint.mcast.McastTransport startApp
信息: IP Multicast Message Transport started.
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport$MessengerSelectorThread run
信息: MessengerSelectorThread polling started
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport startApp
信息: TCP Message Transport started.
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.IncomingUnicastServer run
信息: Server is ready to accept connections
2012-7-16 17:32:27 net.jxta.impl.rendezvous.adhoc.AdhocPeerRdvService <init>
信息: RendezVous Service is initialized for urn:jxta:jxta-WorldGroup as an ad hoc peer. 
2012-7-16 17:32:27 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
信息: Rendezvous Serivce started
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl beEdge
信息: Switched to a Edge peer role.
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
信息: Discovery service started
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup getInterface
信息: [urn:jxta:jxta-WorldGroup] GROUP REF COUNT INCREMENTED TO: 1 by
net.jxta.peergroup.NetPeerGroupFactory.<init>(NetPeerGroupFactory.java:206)
2012-7-16 17:32:27 net.jxta.peergroup.NetPeerGroupFactory newNetPeerGroup
信息: Instantiating net peer group : urn:jxta:jxta-NetGroup
Parent : urn:jxta:jxta-WorldGroup "World PeerGroup"[1]
ID : urn:jxta:jxta-NetGroup
Name : NetPeerGroup
impl : null
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup getInterface
信息: [urn:jxta:jxta-WorldGroup] GROUP REF COUNT INCREMENTED TO: 2 by
net.jxta.impl.peergroup.GenericPeerGroup.loadModule(GenericPeerGroup.java:652)
2012-7-16 17:32:27 net.jxta.impl.cm.SrdiIndex clearSrdi
信息: Clearing SRDI for NetPeerGroup
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the JXME Proxy Service (net.jxta.impl.proxy.ProxyService)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : PSE Membership Service (net.jxta.impl.membership.pse.PSEMembershipService)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Pipe Service (net.jxta.impl.pipe.PipeServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Router Message Transport (net.jxta.impl.endpoint.router.EndpointRouter)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Always Access Service (net.jxta.impl.access.always.AlwaysAccessService)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Rendezvous Service (net.jxta.impl.rendezvous.RendezVousServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Endpoint service (net.jxta.impl.endpoint.EndpointServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Peerinfo Service (net.jxta.impl.peer.PeerInfoServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Cryptobased-ID Message Transport (net.jxta.impl.endpoint.cbjx.CbJxTransport)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Resolver service (net.jxta.impl.resolver.ResolverServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.endpoint.tls.TlsTransport <init>
信息: Adjusting TLS connection idle timeout to 300000 millis.
2012-7-16 17:32:27 net.jxta.impl.endpoint.tls.TlsTransport <init>
信息: Adjusting TLS min reconnection idle to 60000 millis.
2012-7-16 17:32:27 net.jxta.impl.endpoint.tls.TlsTransport <init>
信息: Adjusting TLS maximum retry queue age to 120000 millis.
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the TLS Message Transport (net.jxta.impl.endpoint.tls.TlsTransport)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Discovery service (net.jxta.impl.discovery.DiscoveryServiceImpl)
2012-7-16 17:32:27 net.jxta.impl.proxy.ProxyService startApp
警告: Stalled until there is a endpoint service
2012-7-16 17:32:27 net.jxta.impl.membership.pse.PSEMembershipService startApp
信息: PSE Membmership Service started.
2012-7-16 17:32:27 net.jxta.impl.pipe.PipeServiceImpl startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:32:27 net.jxta.impl.endpoint.router.EndpointRouter startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:32:27 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:32:27 net.jxta.impl.endpoint.EndpointServiceImpl startApp
信息: Endpoint Service started.
2012-7-16 17:32:27 net.jxta.impl.peer.PeerInfoServiceImpl startApp
警告: Stalled until there is a resolver service
2012-7-16 17:32:27 net.jxta.impl.endpoint.cbjx.CbJxTransport startApp
信息: CbJxTransport started
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
警告: Stalled until there is a rendezvous service
2012-7-16 17:32:27 net.jxta.impl.proxy.ProxyService startApp
警告: Stalled until there is a discovery service
2012-7-16 17:32:27 net.jxta.impl.pipe.PipeServiceImpl startApp
警告: Stalled until there is a rendezvous service
2012-7-16 17:32:27 net.jxta.impl.endpoint.router.EndpointRouter startApp
警告: Endpoint Router start stalled until rendezvous service available
2012-7-16 17:32:27 net.jxta.impl.rendezvous.adhoc.AdhocPeerRdvService <init>
信息: RendezVous Service is initialized for urn:jxta:jxta-NetGroup as an ad hoc peer. 
2012-7-16 17:32:27 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
信息: Rendezvous Serivce started
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl beEdge
信息: Switched to a Edge peer role.
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
信息: Discovery service started
2012-7-16 17:32:27 net.jxta.impl.proxy.ProxyService startApp
警告: Stalled until there is a pipe service
2012-7-16 17:32:27 net.jxta.impl.cm.SrdiIndex <init>
信息: [urn:jxta:jxta-NetGroup "NetPeerGroup"[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2]] : Initialized pipeResolverSrdi
2012-7-16 17:32:27 net.jxta.impl.cm.SrdiIndex startGC
信息: [urn:jxta:jxta-NetGroup "NetPeerGroup"[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2]] : Starting SRDI GC Thread for pipeResolverSrdi
2012-7-16 17:32:27 net.jxta.impl.cm.SrdiIndex <init>
信息: [urn:jxta:jxta-NetGroup "NetPeerGroup"[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2]] : Initialized routerSrdi
2012-7-16 17:32:27 net.jxta.impl.endpoint.router.EndpointRouter startApp
信息: urn:jxta:jxta-NetGroup "NetPeerGroup"[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2] : Router Message Transport started.
2012-7-16 17:32:27 net.jxta.impl.proxy.ProxyService startApp
信息: JXME Proxy Service started.
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded module : Default Network PeerGroup reference implementation (net.jxta.impl.peergroup.ShadowPeerGroup)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup decRefCount
信息: [urn:jxta:jxta-WorldGroup] GROUP REF COUNT DECCREMENTED TO: 1 by
net.jxta.peergroup.NetPeerGroupFactory.<init>(NetPeerGroupFactory.java:220)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup getInterface
信息: [urn:jxta:jxta-NetGroup] GROUP REF COUNT INCREMENTED TO: 1 by
net.jxta.platform.NetworkManager.startNetwork(NetworkManager.java:412)
2012-7-16 17:32:27 net.jxta.impl.protocol.RelayConfigAdv <init>
警告: Unhandled Element: net.jxta.impl.document.LiteXMLElement@1301ed8 / isOff = <<null value>>
2012-7-16 17:32:27 net.jxta.platform.NetworkManager startNetwork
信息: Started JXTA Network!
2012-7-16 17:32:27 net.jxta.platform.NetworkManager stopNetwork
信息: Stopping JXTA Network!
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup decRefCount
信息: [urn:jxta:jxta-NetGroup] GROUP REF COUNT DECCREMENTED TO: 0 by
net.jxta.impl.peergroup.RefCountPeerGroupInterfa ce.stopApp(RefCountPeerGroupInterfa ce.java:140)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup decRefCount
信息: [urn:jxta:jxta-NetGroup] STOPPING UNREFERENCED GROUP
2012-7-16 17:32:27 net.jxta.impl.proxy.ProxyService stopApp
信息: JXME Proxy Service stopped.
JXTA Started
Waiting for a rendezvous connection
Connected :true
Stopping JXTA
2012-7-16 17:32:27 net.jxta.impl.cm.Indexer close
信息: Closing Indexer
2012-7-16 17:32:27 net.jxta.impl.endpoint.router.EndpointRouter stopApp
信息: urn:jxta:jxta-NetGroup "NetPeerGroup"[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[1] : Router Message Transport stopped.
2012-7-16 17:32:27 net.jxta.impl.cm.Indexer close
信息: Closing Indexer
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl stopApp
信息: Discovery service stopped.
2012-7-16 17:32:27 net.jxta.impl.rendezvous.RendezVousServiceImpl stopApp
信息: Rendezvous Serivce stopped
2012-7-16 17:32:27 net.jxta.impl.endpoint.tls.TlsManager close
信息: Shutting down all connections
2012-7-16 17:32:27 net.jxta.impl.endpoint.cbjx.CbJxTransport stopApp
信息: CbJxTransport stopped
2012-7-16 17:32:27 net.jxta.impl.endpoint.EndpointServiceImpl stopApp
信息: Endpoint Service stopped.
2012-7-16 17:32:27 net.jxta.impl.membership.pse.PSEMembershipService stopApp
信息: PSE Membmership Service stopped.
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup decRefCount
信息: [urn:jxta:jxta-WorldGroup] GROUP REF COUNT DECCREMENTED TO: 0 by
net.jxta.impl.peergroup.GenericPeerGroup.stopApp(GenericPeerGroup.java:1245)
2012-7-16 17:32:27 net.jxta.impl.peergroup.GenericPeerGroup decRefCount
信息: [urn:jxta:jxta-WorldGroup] STOPPING UNREFERENCED GROUP
2012-7-16 17:32:27 net.jxta.impl.discovery.DiscoveryServiceImpl stopApp
信息: Discovery service stopped.
2012-7-16 17:32:27 net.jxta.impl.rendezvous.RendezVousServiceImpl stopApp
信息: Rendezvous Serivce stopped
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.IncomingUnicastServer run
信息: Server has been shut down.
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport stopApp
信息: Total bytes sent : 0
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport stopApp
信息: Total Messages sent : 0
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport stopApp
信息: Total bytes received : 0
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport stopApp
信息: Total Messages received : 0
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport stopApp
信息: Total connections accepted : 0
2012-7-16 17:32:27 net.jxta.impl.endpoint.tcp.TcpTransport stopApp
信息: TCP Message Transport shut down.
2012-7-16 17:32:27 net.jxta.impl.endpoint.EndpointServiceImpl stopApp
信息: Endpoint Service stopped.
2012-7-16 17:32:27 net.jxta.impl.cm.Indexer close
信息: Closing Indexer
2012-7-16 17:32:27 net.jxta.impl.cm.Indexer close
信息: Closing Indexer
2012-7-16 17:32:27 net.jxta.platform.NetworkManager stopNetwork
信息: Stopped JXTA Network!

11. 另一个测试程序:
 
package p2p.jxta.helloworld;

import net.jxta.exception.PeerGroupException;
import net.jxta.peergroup.PeerGroup;
import net.jxta.peergroup.PeerGroupFactory;

public class HelloWorld_JXTA {

  public static void main(String args[]) {
    System.out.println("Start JXTA....");
    HelloWorld_JXTA myapp = new HelloWorld_JXTA();
    myapp.startJXTA();
    System.exit(0);
  }
 
  public void startJXTA(){
    PeerGroup pg = null;
    try {
      pg = PeerGroupFactory.newNetPeerGroup();
    }catch (PeerGroupException e) {
      System.out.println("Fatal error:group creation failure");
      e.printStackTrace();
      System.exit(1);
    }
    System.out.println("Hello JXTA!:)");
    System.out.println("Group name = "+pg.getPeerGroupName());
    System.out.println("Group ID = "+pg.getPeerGroupID().toString());
    System.out.println("Peer name = "+pg.getPeerName());
    System.out.println("Peer ID = "+pg.getPeerID().toString());
    System.out.println("Peer BaseClass = "+pg.refTcpProtoSpecID.getBaseClass());
  }

}

12. 测试运行:
任意输入用户名和长度大于8位的密码。
JXTA <wbr>- <wbr>P2P开发平台基本API使用

Relay seeding URIs:任意填写IP地址,并点击【+】添加。
JXTA <wbr>- <wbr>P2P开发平台基本API使用

控制台输出:
Start JXTA....
2012-7-16 17:33:43 net.jxta.impl.peergroup.NullConfigurator load
警告: Platform Config not found : file:/D:/eclipse/workspace/jxta_helloworld/.jxta/PlatformConfig
2012-7-16 17:34:03 net.jxta.impl.membership.pse.PSEUtils <init>
信息: Loaded Security Providers into system class loader
2012-7-16 17:34:04 net.jxta.impl.loader.RefJxtaLoader findModuleImplAdvertisem ent
警告: No class for urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE 0000000C0206
2012-7-16 17:34:04 net.jxta.peergroup.WorldPeerGroupFactory newWorldPeerGroup
信息: Making a new World Peer Group instance using : net.jxta.impl.peergroup.Platform
2012-7-16 17:34:04 net.jxta.impl.cm.SrdiIndex clearSrdi
信息: Clearing SRDI for null
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Always Access Service (net.jxta.impl.access.always.AlwaysAccessService)
2012-7-16 17:34:04 net.jxta.impl.endpoint.tcp.IncomingUnicastServer openServerSocket
信息: Server will accept connections at /0.0.0.0:14419
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the TCP Message Transport (net.jxta.impl.endpoint.tcp.TcpTransport)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Rendezvous Service (net.jxta.impl.rendezvous.RendezVousServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Peerinfo Service (net.jxta.impl.peer.PeerInfoServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Endpoint service (net.jxta.impl.endpoint.EndpointServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the HTTP Message Transport (net.jxta.impl.endpoint.servlethttp.ServletHttpTransport)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : None Membership Service (net.jxta.impl.membership.none.NoneMembershipService)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Resolver service (net.jxta.impl.resolver.ResolverServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Discovery service (net.jxta.impl.discovery.DiscoveryServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the IP Multicast Message Transport (net.jxta.impl.endpoint.mcast.McastTransport)
2012-7-16 17:34:04 net.jxta.impl.endpoint.tcp.TcpTransport startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:34:04 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:34:04 net.jxta.impl.peer.PeerInfoServiceImpl startApp
警告: Stalled until there is a resolver service
2012-7-16 17:34:04 net.jxta.impl.endpoint.EndpointServiceImpl startApp
信息: Endpoint Service started.
2012-7-16 17:34:04 net.jxta.impl.endpoint.servlethttp.HttpMessageSender start
信息: HTTP Client Transport started.
2012-7-16 17:34:04 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
警告: Stalled until there is a rendezvous service
2012-7-16 17:34:04 net.jxta.impl.endpoint.mcast.McastTransport startApp
信息: IP Multicast Message Transport started.
2012-7-16 17:34:04 net.jxta.impl.endpoint.tcp.TcpTransport$MessengerSelectorThread run
信息: MessengerSelectorThread polling started
2012-7-16 17:34:04 net.jxta.impl.endpoint.tcp.TcpTransport startApp
信息: TCP Message Transport started.
2012-7-16 17:34:04 net.jxta.impl.endpoint.tcp.IncomingUnicastServer run
信息: Server is ready to accept connections
2012-7-16 17:34:04 net.jxta.impl.rendezvous.adhoc.AdhocPeerRdvService <init>
信息: RendezVous Service is initialized for urn:jxta:jxta-WorldGroup as an ad hoc peer. 
2012-7-16 17:34:04 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
信息: Rendezvous Serivce started
2012-7-16 17:34:04 net.jxta.impl.discovery.DiscoveryServiceImpl beEdge
信息: Switched to a Edge peer role.
2012-7-16 17:34:04 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
信息: Discovery service started
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup getInterface
信息: [urn:jxta:jxta-WorldGroup] GROUP REF COUNT INCREMENTED TO: 1 by
net.jxta.peergroup.PeerGroupFactory.newPlatform(PeerGroupFactory.java:425)
2012-7-16 17:34:04 net.jxta.peergroup.NetPeerGroupFactory newNetPeerGroup
信息: Instantiating net peer group : urn:jxta:jxta-NetGroup
Parent : urn:jxta:jxta-WorldGroup "World PeerGroup"[1]
ID : urn:jxta:jxta-NetGroup
Name : NetPeerGroup
impl : null
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup getInterface
信息: [urn:jxta:jxta-WorldGroup] GROUP REF COUNT INCREMENTED TO: 2 by
net.jxta.impl.peergroup.GenericPeerGroup.loadModule(GenericPeerGroup.java:652)
2012-7-16 17:34:04 net.jxta.impl.cm.SrdiIndex clearSrdi
信息: Clearing SRDI for null
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Relay Message Transport (net.jxta.impl.endpoint.relay.RelayTransport)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : PSE Membership Service (net.jxta.impl.membership.pse.PSEMembershipService)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Pipe Service (net.jxta.impl.pipe.PipeServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Router Message Transport (net.jxta.impl.endpoint.router.EndpointRouter)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Always Access Service (net.jxta.impl.access.always.AlwaysAccessService)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Rendezvous Service (net.jxta.impl.rendezvous.RendezVousServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Endpoint service (net.jxta.impl.endpoint.EndpointServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Peerinfo Service (net.jxta.impl.peer.PeerInfoServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Cryptobased-ID Message Transport (net.jxta.impl.endpoint.cbjx.CbJxTransport)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Resolver service (net.jxta.impl.resolver.ResolverServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.endpoint.tls.TlsTransport <init>
信息: Adjusting TLS connection idle timeout to 300000 millis.
2012-7-16 17:34:04 net.jxta.impl.endpoint.tls.TlsTransport <init>
信息: Adjusting TLS min reconnection idle to 60000 millis.
2012-7-16 17:34:04 net.jxta.impl.endpoint.tls.TlsTransport <init>
信息: Adjusting TLS maximum retry queue age to 120000 millis.
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the TLS Message Transport (net.jxta.impl.endpoint.tls.TlsTransport)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded privileged module : Reference Implementation of the Discovery service (net.jxta.impl.discovery.DiscoveryServiceImpl)
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayTransport startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:34:04 net.jxta.impl.membership.pse.PSEMembershipService startApp
信息: PSE Membmership Service started.
2012-7-16 17:34:04 net.jxta.impl.pipe.PipeServiceImpl startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:34:04 net.jxta.impl.endpoint.router.EndpointRouter startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:34:04 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
警告: Stalled until there is an endpoint service
2012-7-16 17:34:04 net.jxta.impl.endpoint.EndpointServiceImpl startApp
信息: Endpoint Service started.
2012-7-16 17:34:04 net.jxta.impl.peer.PeerInfoServiceImpl startApp
警告: Stalled until there is a resolver service
2012-7-16 17:34:04 net.jxta.impl.endpoint.cbjx.CbJxTransport startApp
信息: CbJxTransport started
2012-7-16 17:34:04 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
警告: Stalled until there is a rendezvous service
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayTransport startApp
警告: Stalled until there is a discovery service
2012-7-16 17:34:04 net.jxta.impl.pipe.PipeServiceImpl startApp
警告: Stalled until there is a rendezvous service
2012-7-16 17:34:04 net.jxta.impl.endpoint.router.EndpointRouter startApp
警告: Endpoint Router start stalled until rendezvous service available
2012-7-16 17:34:04 net.jxta.impl.rendezvous.edge.EdgePeerRdvService <init>
信息: RendezVous Service is initialized for urn:jxta:jxta-NetGroup as an Edge peer.
2012-7-16 17:34:04 net.jxta.impl.rendezvous.RendezVousServiceImpl startApp
信息: Rendezvous Serivce started
2012-7-16 17:34:04 net.jxta.impl.discovery.DiscoveryServiceImpl beEdge
信息: Switched to a Edge peer role.
2012-7-16 17:34:04 net.jxta.impl.discovery.DiscoveryServiceImpl startApp
信息: Discovery service started
2012-7-16 17:34:04 net.jxta.impl.rendezvous.edge.EdgePeerRdvService$MonitorTask run
警告: Rendezvous connection stalled until router is started!
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayTransport startApp
警告: Stalled until there is a pipe service
2012-7-16 17:34:04 net.jxta.impl.cm.SrdiIndex <init>
信息: [urn:jxta:jxta-NetGroup[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2]] : Initialized pipeResolverSrdi
2012-7-16 17:34:04 net.jxta.impl.cm.SrdiIndex startGC
信息: [urn:jxta:jxta-NetGroup[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2]] : Starting SRDI GC Thread for pipeResolverSrdi
2012-7-16 17:34:04 net.jxta.impl.cm.SrdiIndex <init>
信息: [urn:jxta:jxta-NetGroup[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2]] : Initialized routerSrdi
2012-7-16 17:34:04 net.jxta.impl.endpoint.router.EndpointRouter startApp
信息: urn:jxta:jxta-NetGroup[0] / urn:jxta:jxta-WorldGroup "World PeerGroup"[2] : Router Message Transport started.
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayClient startClient
信息: Started client : relay://uuid-59616261646162614A787461 5032503390C03A49115B41F6 8165C478286CEE2303
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayClient run
信息: Start relay client thread
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayTransport startApp
信息: Relay Message Transport started
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayClient run
严重: Uncaught Throwable in thread :Relay Client Worker Thread for relay://uuid-59616261646162614A787461 5032503390C03A49115B41F6 8165C478286CEE2303
java.lang.IllegalArgumentException : URI is not absolute
at java.net.URI.toURL(Unknown Source)
at net.jxta.impl.util.URISeedingManager.loadSeeds(URISeedingManager.java:450)
at net.jxta.impl.util.URISeedingManager.refreshActiveSeeds(URISeedingManager.java:360)
at net.jxta.impl.util.URISeedingManager.getActiveSeedRoutes(URISeedingManager.java:283)
at net.jxta.impl.endpoint.relay.RelayClient.run(RelayClient.java:344)
at java.lang.Thread.run(Unknown Source)
2012-7-16 17:34:04 net.jxta.impl.endpoint.relay.RelayClient run
信息: stop client thread
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup loadModule
信息: Loaded module : Default Network PeerGroup reference implementation (net.jxta.impl.peergroup.ShadowPeerGroup)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup getInterface
信息: [urn:jxta:jxta-NetGroup] GROUP REF COUNT INCREMENTED TO: 1 by
net.jxta.peergroup.PeerGroupFactory.newNetPeerGroup(PeerGroupFactory.java:501)
2012-7-16 17:34:04 net.jxta.impl.peergroup.GenericPeerGroup decRefCount
信息: [urn:jxta:jxta-WorldGroup] GROUP REF COUNT DECCREMENTED TO: 1 by
net.jxta.peergroup.PeerGroupFactory.newNetPeerGroup(PeerGroupFactory.java:552)
Hello JXTA!:)
Group name = NetPeerGroup
Group ID = urn:jxta:jxta-NetGroup
Peer name = xsj
Peer ID = urn:jxta:uuid-59616261646162614A7874615032503390C03A49115B41F68165C478286CEE2303
Peer BaseClass = urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE0000000905

13. 注意事项:
(1)对于编码中用到Unicode中文,可能会报错,需要修改文本文件编码:
【窗口】->【首选项】->【常规】->【工作空间】->【文本文件编码】->【点选:其他】->【下拉选择:UTF-8】->【应用】->【确定】

(2)JXTA2.5,在创建一个类似HelloWorld程序的时候,可能出现一个异常,这个异常信息大致是:
警告: Failed to find class for urn:jxta:uuid-...
java.lang.ClassNotFoundException:...
出现这个异常是由于JXTA2.5的jar包引起的,在jxta.jar包的内部有一个bug,需要修正一下,具体解决方法是:
jxta.jar包里面的\META-INF\services\net.jxta.platform.Module后面加上一句:
urn:jxta:uuid-deadbeefdeafbabafeedbabe0000000C0206 net.jxta.impl.shell.ShellApp Reference Implementation of Shell

(3)第二个测试程序运行后将在工程根目录产生.settings文件夹,如果不删除则下次运行时将不会产生上述两个界面,删除后可以看到。

14. 参考资料:
[1] http://download.java.net/jxta/
[2] http://java.net/projects/jxta
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值