Several JXTA peers within one VM
I just want to ask whether it is possible to run several jxta peers within one java virtual machine. I've tried following thing:
<br /> System.setProperty("JXTA_HOME", ".jxta/client1");<br /> NetPeerGroupFactory factory = new NetPeerGroupFactory();<br /> PeerGroup netPeerGroup = factory.getInterface();</p> <p> System.setProperty("JXTA_HOME", ".jxta/client2");<br /> NetPeerGroupFactory factory2 = new NetPeerGroupFactory();<br /> PeerGroup netPeerGroup2 = factory2.getInterface();<br />
This piece of code ends up to the following error message:
<br /> Exception in thread "main" net.jxta.exception.PeerGroupException: Only a single instance of the World Peer Group may be instantiated at a single time.<br /> at net.jxta.peergroup.WorldPeerGroupFactory.newWorldPeerGroup(WorldPeerGroupFactory.java:258)<br /> at net.jxta.peergroup.WorldPeerGroupFactory.(WorldPeerGroupFactory.java:140)<br /> at net.jxta.peergroup.NetPeerGroupFactory.(NetPeerGroupFactory.java:122)<br />
Has anyone a clue how to solve this problem? I don't want to start another VM for an additional peer.
Thanks in advance