Skip to main content

Problem to join into a group

1 reply [Last post]
amoragon
Offline
Joined: 2008-10-24

Hi!

I'm trying to join a group created and i'm not able to join the source code is this:

First I create the group:

ModuleImplAdvertisement implAdv = null;
PeerGroup newGroup = null;
try {
implAdv = theNetPeerGroup.getAllPurposePeerGroupImplAdvertisement();
newGroup = theNetPeerGroup.newGroup(IDFactory.newPeerGroupID(), implAdv, groupName, groupName);
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-1);
}

standardDiscoveryService.remotePublish(newGroup.getPeerGroupAdvertisement());
try {
standardDiscoveryService.publish(newGroup.getPeerGroupAdvertisement());
} catch (IOException ex) {
ex.printStackTrace();
}

Then, I try to join but "auth.isReadyForJoin()" is always false. I don't know if I'm doing something wrong.

MembershipService membershipService = peerGroup.getMembershipService();

AuthenticationCredential authCred = new AuthenticationCredential(peerGroup, null, null);

try {
Authenticator auth = membershipService.apply(authCred);

if (auth.isReadyForJoin()) {

membershipService.join(auth);

} else {
System.err.println("Unable to join the JXTA group.");
System.exit(-1);
}
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-1);
}

Someone has any idea?

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
adamman71
Offline
Joined: 2007-01-31

Hi,

Try Example 600, 610, Chandra and Dimitri available at www.practicaljxta.com.

Cheers,

J.