Skip to main content

Pls HELP - jxme & jxta relay connection

15 replies [Last post]
goeastgowest
Offline
Joined: 2005-01-16

I am developing an mobile application to access jxta network (using jxta v.2.3.5) for chat, search resources, etc. however, i encounter a problem when connecting jxta relay url from a j2me program running on WTK default emulator. Below are some of my codings:

In connectThread,

public void run() {
HttpConnection conn = null;
InputStream is = null;
try {
String urlString = "http://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint.servlethttp.HttpMessageServlet";
pNetwork = PeerNetwork.createInstance("ConnectionTest");
state = pNetwork.connect(urlString, state); // problem here, could you help on it?
int listenQueryId = pNetwork.listen("ConnectionTest_pipe");
int pipeSearchQueryId = pNetwork.search(PeerNetwork.PIPE, "ConnectionTest_pipe", "jxta", 10);
System.out.println("listenQueryId: " + listenQueryId);
System.out.println("pipeSearchQueryId: " + pipeSearchQueryId);
} catch (IOException ioe) {
Alert alert = new Alert("Connection", "Could not connect (due to: " + ioe + ")", null, AlertType.CONFIRMATION);
alert.setTimeout(Alert.FOREVER);
display.setCurrent(alert);
} catch (Exception e) {
Alert alert = new Alert("Connection", "Could not connect (due to: " + e + ")", null,
AlertType.CONFIRMATION);
alert.setTimeout(Alert.FOREVER);
display.setCurrent(alert);
}
Alert alert = new Alert("Connection", "You are now connected!", null,
AlertType.CONFIRMATION);
alert.setTimeout(Alert.FOREVER);
display.setCurrent(alert);
}

Then, the debug screen in WTK shown this:
relay: http://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint.servlethttp.HttpMe...

is it due to following reason?
- wrong jxta relay url?
- what should be the Servlet to get the jxme message? any sample?

Please advice. Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
adeladanam
Offline
Joined: 2007-10-21

Hi,
Did you manage to get over this error?I have the same problem.Please write back if you know how this can be fixed.
Thanks.

davjoh
Offline
Joined: 2007-07-18

When you get an error: javax.microedition.io.ConnectionNotFoundException: TCP open

it means the URL you are connecting to (assume it's a locally set up relay/proxy maybe, so let say http://127.0.0.1:9700) is not configured properly - as in your local relay/proxy peer ain't listening for HTTP requests on 127.0.0.1 port 9700.

To get it to work, you need a properly configured JXME proxy running. So whatever your proxy peer is, make sure it's listening on 9700, accepting incoming HTTP, and is configured as a JXME proxy.

If you're unsure you've set up your proxy properly, just try going to it with your browser. e.g. go to 127.0.0.1:9700 if you've set it up locally to see if you can connect at all.

Message was edited by: davjoh

anand3
Offline
Joined: 2006-06-19

hi friend,

currently i'm working for jxme mobile chat project.

but i'm running these project then WTK given following error :-

"Error connecting to relay :

The requested protocol does not exist"

&&

elay: http://192.18.37.36:9700/unknown-unknown?0,-1,http://192.18.37.36:9700/E...

plz suggest me immediatly what should i do ?

thks
Anand

tra
Offline
Joined: 2003-06-16

> hi friend,
>
> currently i'm working for jxme mobile chat project.
>
> but i'm running these project then WTK given
> following error :-
>
> "Error connecting to relay :
>
> The requested protocol does not exist"
>
> &&
>
> elay:
> http://192.18.37.36:9700/unknown-unknown?0,-1,http://1
> 92.18.37.36:9700/EndpointService:jxta-NetGroup/uuid-DE
> ADBEEFDEAFBABAFEEDBABE0000000F05/pid
>
>
> plz suggest me immediatly what should i do ?
We fixed a relay compatibility issue in the latest JXTA-J2ME and JXTA-JavaSE releases. You should update
to the latest releases.

hth,

B.

>
> thks
> Anand

anand3
Offline
Joined: 2006-06-19

hi friend,

currently i'm working for jxme mobile chat project.

but i'm running these project then WTK given following error :-

"Error connecting to relay :

The requested protocol does not exist"

plz suggest me immediatly what should i do ?

thks
Anand

tra
Offline
Joined: 2003-06-16

> I am developing an mobile application to access jxta
> network (using jxta v.2.3.5) for chat, search
> resources, etc. however, i encounter a problem when
> connecting jxta relay url from a j2me program running
> on WTK default emulator. Below are some of my
> codings:
>
> In connectThread,
>
> public void run() {
> HttpConnection conn = null;
> InputStream is = null;
> try {
> String urlString =
> =
> "http://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint
> .servlethttp.HttpMessageServlet";
The URLString should only be

"http://192.168.0.146:9700"

Hth,

B.

> pNetwork =
> = PeerNetwork.createInstance("ConnectionTest");
> state = pNetwork.connect(urlString, state); //
> // problem here, could you help on it?
> int listenQueryId =
> = pNetwork.listen("ConnectionTest_pipe");
> int pipeSearchQueryId =
> = pNetwork.search(PeerNetwork.PIPE,
> "ConnectionTest_pipe", "jxta", 10);
> System.out.println("listenQueryId: " +
> + listenQueryId);
> System.out.println("pipeSearchQueryId: " +
> + pipeSearchQueryId);
> } catch (IOException ioe) {
> Alert alert = new Alert("Connection", "Could not
> ot connect (due to: " + ioe + ")", null,
> AlertType.CONFIRMATION);
> alert.setTimeout(Alert.FOREVER);
> display.setCurrent(alert);
> } catch (Exception e) {
> Alert alert = new Alert("Connection", "Could not
> ot connect (due to: " + e + ")", null,
> AlertType.CONFIRMATION);
> alert.setTimeout(Alert.FOREVER);
> display.setCurrent(alert);
> }
> Alert alert = new Alert("Connection", "You are now
> w connected!", null,
> AlertType.CONFIRMATION);
> alert.setTimeout(Alert.FOREVER);
> display.setCurrent(alert);
> }
>
> Then, the debug screen in WTK shown this:
> relay:
> http://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint.
> servlethttp.HttpMessageServlet/unknown-unknown?0,-1,ht
> tp://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint.se
> rvlethttp.HttpMessageServlet/EndpointService:jxta-NetG
> roup/uuid-DEADBEEFDEAFBABAFEEDBABE0000000F05/pid
>
> is it due to following reason?
> - wrong jxta relay url?
> - what should be the Servlet to get the jxme message?
> any sample?
>
> Please advice. Thanks!

tra
Offline
Joined: 2003-06-16

>
> String urlString =
> =
> "http://192.168.0.146:9700
The URL should only be

http://192.168.0.146:9700

Hth,

B.

/mP2P/net.jxta.impl.endpoint
> .servlethttp.HttpMessageServlet";
> pNetwork =
> = PeerNetwork.createInstance("ConnectionTest");
> state = pNetwork.connect(urlString, state); //
> // problem here, could you help on it?
> int listenQueryId =
> = pNetwork.listen("ConnectionTest_pipe");
> int pipeSearchQueryId =
> = pNetwork.search(PeerNetwork.PIPE,
> "ConnectionTest_pipe", "jxta", 10);
> System.out.println("listenQueryId: " +
> + listenQueryId);
> System.out.println("pipeSearchQueryId: " +
> + pipeSearchQueryId);
> } catch (IOException ioe) {
> Alert alert = new Alert("Connection", "Could not
> ot connect (due to: " + ioe + ")", null,
> AlertType.CONFIRMATION);
> alert.setTimeout(Alert.FOREVER);
> display.setCurrent(alert);
> } catch (Exception e) {
> Alert alert = new Alert("Connection", "Could not
> ot connect (due to: " + e + ")", null,
> AlertType.CONFIRMATION);
> alert.setTimeout(Alert.FOREVER);
> display.setCurrent(alert);
> }
> Alert alert = new Alert("Connection", "You are now
> w connected!", null,
> AlertType.CONFIRMATION);
> alert.setTimeout(Alert.FOREVER);
> display.setCurrent(alert);
> }
>
> Then, the debug screen in WTK shown this:
> relay:
> http://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint.
> servlethttp.HttpMessageServlet/unknown-unknown?0,-1,ht
> tp://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint.se
> rvlethttp.HttpMessageServlet/EndpointService:jxta-NetG
> roup/uuid-DEADBEEFDEAFBABAFEEDBABE0000000F05/pid
>
> is it due to following reason?
> - wrong jxta relay url?
> - what should be the Servlet to get the jxme message?
> any sample?
>
> Please advice. Thanks!

goeastgowest
Offline
Joined: 2005-01-16

um...then how the j2me (jxme) client talk with the jxta relay? as j2me using http to connect... so should i need to setup a web server and make a servlet/jsp to receive the http request from client? and how to deal with the jxta relay when receiving the request?

goeastgowest
Offline
Joined: 2005-01-16

i can connect JXTA relay via a simple java program (with jxme API)... but i cant connect via WTK with the error of "Error connecting to relay: TCP open... anyone know how can it be solved?.. thx!

tra
Offline
Joined: 2003-06-16

Did you enable the "proxy" service when configuring
your relay/rendezvous. Check the advanced RDV/Relay setting
of the GUI configurator. You will see the "Enable Proxy"
option.

Hth,

B.

goeastgowest
Offline
Joined: 2005-01-16

yeah... i enabled proxy service already.

My program code:
public void run() {
try {
System.out.println("Relay URL: "+ relayURL);
pNetwork = PeerNetwork.createInstance(PEER_NAME);
System.out.println("pNetwork: "+ pNetwork);
persistentState = pNetwork.connect(relayURL, null);
System.out.println("Peer Name: "+ PEER_NAME);
System.out.println("Peer Id: "+ new String(persistentState));
createQueryId = peer.create(PeerNetwork.PIPE, PIPE_NAME, null, PIPE_TYPE);
System.out.println("create request id: "+ createQueryId);
String pipeID = findMyPipe();
System.out.println("Pipe Id: "+ pipeID);
} catch(Exception e) {
e.printStackTrace();
}

when program try to connect to jxta relay, it shows the following in console:

relay: http://192.168.0.163:9700/unknown-unknown?0,-1,http://192.168.0.163:9700...

javax.microedition.io.ConnectionNotFoundException: TCP open
at com.sun.midp.io.j2me.socket.Protocol.connect(+99)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+52)
at com.sun.midp.io.j2me.socket.Protocol.openPrim(+108)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+14)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+8)
at com.sun.midp.io.j2me.http.Protocol.connect(+110)
at com.sun.midp.io.j2me.http.Protocol.streamConnect(+57)
at com.sun.midp.io.j2me.http.Protocol.startRequest(+12)
at com.sun.midp.io.j2me.http.Protocol.sendRequest(+38)
at com.sun.midp.io.j2me.http.Protocol.sendRequest(+6)
at com.sun.midp.io.j2me.http.Protocol.getResponseCode(+8)
at net.jxta.j2me.HttpMessenger.connect(+114)
at net.jxta.j2me.PeerNetwork.connect(+35)
at test.ConnectionTestMIDlet.run(+56)

do u know how to deal with it?

gefrey
Offline
Joined: 2006-04-04

i have the same error as you. but i don't know why. I think it come from your relay because when I shut down my relay i still have the same error. Maybe you can send me your relay code to compare with my realy code.

Geoffrey

tra
Offline
Joined: 2003-06-16

>InputStream is = null;
>> try {
>> String urlString =
>> "//http://192.168.0.146:9700/mP2P/net.jxta.impl.endpoint.servlethttp.HttpMessageServlet//";
>> /

The URL Should only be //http://192.168.0.146:9700/
/

>>
>> - wrong jxta relay url?
>> - what should be the Servlet to get the jxme message? any sample?

Check the CVS jxme/midp/demo/chat

Chat application as an example.

B.

goeastgowest
Offline
Joined: 2005-01-16

i knew how to work on jxme side.. but for server side, what should be configured in order to get the request from jxme chat client?

goeastgowest
Offline
Joined: 2005-01-16

my problem is dunno how to setup jxta relay to accept jxme client.. i did setup jxta shell as a rendezvous peer in my desktop computer connected to the internet. What should be the servlet invoked by the jxme client? any sample for that?