Skip to main content

publish adv

18 replies [Last post]
somkumar155
Offline
Joined: 2007-11-16
Points: 0

i m unable to publishing pipe adv from rendzvous to edge peers remotely to all (dis.publish(adv))

Message was edited by: somkumar155

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zorion
Offline
Joined: 2007-11-06
Points: 0

Currently, I have tried to adapt the CHATDEMO from CDC to JXME CLDC/MIDP 2.x.

I have the following error:
[code]
Loaded privileged module : Reference Implementation of the Discovery Service (net.jxta.impl.discovery.DiscoveryServiceImpl)
Unhandled Attribute: type
Unhandled Attribute: xmlns:jxta
Could not load group implementation
java.lang.ArrayIndexOutOfBoundsException
at net.jxta.impl.rendezvous.RendezVousServiceImpl.init(+275)
at net.jxta.impl.peergroup.GenericPeerGroup.loadModule(+382)
at net.jxta.impl.peergroup.StdPeerGroup.loadAllModules(+225)
at net.jxta.impl.peergroup.StdPeerGroup.initFirst(+344)
at net.jxta.impl.peergroup.ShadowPeerGroup.initFirst(+17)
at net.jxta.impl.peergroup.GenericPeerGroup.init(+7)
at net.jxta.impl.peergroup.GenericPeerGroup.loadModule(+382)
at net.jxta.impl.peergroup.GenericPeerGroup.newGroup(+32)
at net.jxta.impl.peergroup.PeerGroupInterface.newGroup(+14)
at net.jxta.peergroup.PeerGroupFactory.newNetPeerGroup(+30)
at net.jxta.peergroup.PeerGroupFactory.newNetPeerGroup(+8)
at ChatDemo.startJxta(+26)
at ChatDemo.main(+12)
at ChatTest.startApp(+59)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
newNetPeerGroup failed
java.lang.NullPointerException
at net.jxta.impl.peergroup.GenericPeerGroup.newGroup(+70)
at net.jxta.impl.peergroup.PeerGroupInterface.newGroup(+14)
at net.jxta.peergroup.PeerGroupFactory.newNetPeerGroup(+30)
at net.jxta.peergroup.PeerGroupFactory.newNetPeerGroup(+8)
at ChatDemo.startJxta(+26)
at ChatDemo.main(+12)
at ChatTest.startApp(+59)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
[urn:jxta:jxta-WorldGroup] GROUP REF COUNT DECCREMENTED TO: 1
[/code]

FYI: the unhandled attributes are both in the constructor RdvConfigAdv(Element root) for net.jxta.impl.protocol.RdvConfigAdv(285)

Please, help!

zorion
Offline
Joined: 2007-11-06
Points: 0

I will try the two DAVJOH solutions to this issue:
http://forums.java.net/jive/thread.jspa?messageID=268252&#268252

Could someone amend the JXME (midp2) source?

Thanks and regards

Message was edited by: zorion

hamada
Offline
Joined: 2003-06-12
Points: 0

publish() is a local cache publish, other peers must invoke discovery to find it

zorion
Offline
Joined: 2007-11-06
Points: 0

I use publish and remotepublish.
Other peers use discovery (remote and local).
PeerAdvertisements are found, but PipeAdvertisements are not.

Which is the difference?

adamman71
Offline
Joined: 2007-01-31
Points: 0

Make sure that you set the right parameters when calling the getRemoteAdvertisements method.

J.

zorion
Offline
Joined: 2007-11-06
Points: 0

Thanks for your quick reply Adamman71 :D
I use the following call:

[code]
discovery.getRemoteAdvertisements(null, DiscoveryService.ADV,null, null, 100, this);
[/code]

this = class implementing the DiscoveryListener

Should this call get my pipes?
Thanks in advance

adamman71
Offline
Joined: 2007-01-31
Points: 0

It looks fine to me. The problem must be elsewhere.

a) When you publish your PipeAdvertisement on peer A for example, do you give it enough lifetime?

b) Once you publish your PipeAdvertisement on A, can you retrieve it locally?

c) When you retrieve advertisements remotely from B, do you get responses from A?

d) Can you list the advertisements returned from A?

Just a couple of ideas to explore.

J.

zorion
Offline
Joined: 2007-11-06
Points: 0

a) I publish the advs with the default lifetime.
b) yes, I can retrieve the pipeadv locally on A (its own pipeadv).
I can check the cache and I see it there (in ".jxta\cm\jxta-NetGroup" folder).
c) for the ADV request I don't get anything
for the PEER request I have answers
d) The answers get in B from A are all the PeerAdvertisements known by A, but nothing else (no pipes).

Is it a problem that I request for different kind of advertisement at same time?
I execute periodically the following code:
[code]
void discoveryPeers(){
discovery.getRemoteAdvertisements(null, DiscoveryService.PEER ,null, null, 100,this);
discovery.getRemoteAdvertisements(null,DiscoveryService.GROUP,null,null,100,this);
discovery.getRemoteAdvertisements(null,DiscoveryService.ADV,null,null,100,this);
}
[/code]

And I keep the answers in local cache.
But I only get answers for the first of each three requests.

Any idea?
Take in account that I have no experience in JXTA, so I may be doing a lot of nonsenses :(
For instance, until you have mentioned it, I didn't know that I could check where are the answers coming from.

Thanks for your support, I appreciate your effort.

adamman71
Offline
Joined: 2007-01-31
Points: 0

The following line should be enough to retrieve peer advertisements:

discovery.getRemoteAdvertisements(null,DiscoveryService.ADV,null,null,100,this);

May be you should try with this line only.

You may also try by setting the attribute parameter to "Name" and the value parameter to the name of your pipe. You may also try with other parameter/value combinations.

J.

zorion
Offline
Joined: 2007-11-06
Points: 0

I think that the issue is my PC :_(

I have tried in other PC and I think that the advs are coming, but it seems that we don't keep them in local cache.

Which steps should we done for keeping the received answers to localcache?

We will try to publish each advertisement:
[code]
public void discoveryEvent(DiscoveryEvent event){
try {
DiscoveryResponseMsg res = event.getResponse();
Enumeration advertisements = res.getAdvertisements();
Object adv = null;
if (advertisements != null ) {
while (advertisements.hasMoreElements()) {
adv = advertisements.nextElement();
discovery.publish((Advertisement)adv);
}
}
}
catch (IOException err) {
err.printStackTrace();
}
}
[/code]

Would it be correct?

Thanks! We are trying it by now :) I will inform you!

adamman71
Offline
Joined: 2007-01-31
Points: 0

I don't know what is going on your PC... but I just got an idea of what might be happening while reading some documentation. When you publish an advertisement locally on an EDGE peer A, and that peer is connected to a rendezvous called R, the SRDI index of R is only updated by A after 30 seconds. If a peer B tries tries to retrieve your advertisement on A through B before the 30 seconds limit, this might be an issue. May be you can test this by setting a delay on B...

The way you publish advertisements is ok, but you may want to filter what you are publishing locally. Publishing everything might be overkill...

Cheers,

J.

zorion
Offline
Joined: 2007-11-06
Points: 0

Hey, an easy question (I hope),

The JXTA-Shell doesn't find the pipeadvertisement.
Why?

Some more information (topology, creation of pipeadvertisement and BiDiPipe):
===TOPOLOGY
-PeerA is RDV (so we don't need peer R here)
-PeerB is not RDV
-I connect JXTA-Shell to PeerA (peerA acts as Rendezvous for shell).

===CREATION
The pipeAdvertisement is created as follows:
[code]
pipeAdvertisement = (PipeAdvertisement)AdvertisementFactory.
newAdvertisement(PipeAdvertisement.getAdvertisementType());
pipeAdvertisement.setDescription(group.getPeerName());
pipeAdvertisement.setName(group.getPeerID().toString());
pipeAdvertisement.setType(PipeService.UnicastType);
//pipeAdvertisement.setPipeID(IDFactory.newPipeID(group.getPeerGroupID(),peerGroup.getPeerID().toString().getBytes()));
pipeAdvertisement.setPipeID(IDFactory.fromURI(new URI(PIPEID)));
[/code]

===BiDiPipe
We use this advertisement as a bidipipe:
[code]
public void run(){
try{
serverPipe = new JxtaServerPipe(peerGroup, pipeAdvertisement);
//no timeout
serverPipe.setPipeTimeout(0);
while (!stopThread) {
JxtaBiDiPipe bidipipe = serverPipe.accept();
bidipipe.setMessageListener(pipeMsgListener);
}
} catch(IOException err) {
err.printStackTrace();
}
}
[/code]

I suppose that I am doing something wrong :(

Now we can get in localcache the other peers :D
But I can not understand why JXTA-Shell doesn't have the pipeadv (I need it there).
[code]
JXTA>peers
peer0: name = d8867057@a5s101pc09
peer1: name = enric
peer2: name = yopp
peer3: name = enric
JXTA>search -r -p peer0
# search - JXTA Advertisement search message sent
JXTA>search
JXTA Advertisement adv0 [jxta:MIA]
JXTA Advertisement adv1 [jxta:MIA]
JXTA Advertisement adv2 [jxta:MIA]
JXTA Advertisement adv3 [jxta:RA]
JXTA Advertisement adv4 [jxta:RA]
JXTA Advertisement adv5 [jxta:RdvAdvertisement]
JXTA>
[/code]

Please, I still need help.

Thank you!
Zorion

FYI: in the past, we kept the response with advertisements with following code.
I think that it sometimes works as well.
[code]
public void discoveryEvent(DiscoveryEvent event){
try {
discovery.publish(peerGroup.getPeerAdvertisement());
[/code]

adamman71
Offline
Joined: 2007-01-31
Points: 0

Hi, in all honesty, I don't know. You my want to report this as an issue using the dev mailing list.

Cheers,

J.

zorion
Offline
Joined: 2007-11-06
Points: 0

Ok! I understand.
Many thanks for your support, adamman71! :D

On the other hand.
Anyone created a pipeadv visible from jxta-shell?
I need it in order to use a Jxta-Shell as proxy for JXME peer.

Thanks

rock4evr
Offline
Joined: 2008-06-06
Points: 0

Hi zorion,
I am having the same issue. I can not get any pipe advertisements from the rendezvous (jxta-shell or a self-written implementation). If you figure anything else, please post your findings/solutions. I also can't get peer advertisements from the rendezvous (except for the rendezvous' own peer advertisement) even though the rendezvous contains a peer advertisement for each connected client. I can get route advertisements for each connected client from the rendezvous though.

Kevin

hamada
Offline
Joined: 2003-06-12
Points: 0

On the rendezvous peer the discovery query must be a bit more specific, such as "Name", "A*" or similar. Keep in mind a JXME proxy based node is only capable of dealing with pipes and groups.

hamada
Offline
Joined: 2003-06-12
Points: 0

couple of more notes:

- JxtaBiDiPipes are not supported by the proxy version
- Any reason for using the proxy based JXME. You are strongly encouraged to use the recently released JXME CLDC/MIDP 2.x.

zorion
Offline
Joined: 2007-11-06
Points: 0

> - Any reason for using the proxy based JXME. You are
> strongly encouraged to use the recently released JXME
> CLDC/MIDP 2.x.
Dear Hamada,
Where can we find a demo using JXME CLDC/MIDP2.x?
We have seen the chat demo, but it is not adapted to J2ME at all.

We are specially interested in the platform configuration.

We have tried to configure but we are unable :(
It seems that the proxyless version of JXME needs to use files in the phone, isn't it?

We appreciate a lot your help :D
Thanks in advance.
Jordi & Zorion