powered by Jive Software

Smack over http

Just I have downloaded the following jars from this thread

smack.jar, xlightweb.jar, xlightweb-2.13.2-jar-with-dependencies.jar, xpp3.jar, xSocket.jar, smack-bosh-backport.jar

and the remaining jars from Google(Smack 3.2.1)

smackx.jar, smackx-debug.jar, smackx-jingle.jar, dom4j-1.6.1.jar

Added all these jars to Build path and after that I have tried with 5222 / 5333 / 7070 still getting the same error.

Can you please let me know is there any code changes are required other than BOSHClient.java

Thanks

I am using default openfire HTTP Binding port 7070 and enabled in Admin Console.

Getting NullPointerException in XLightWebResponse.java (line number :188)

httpResp = future.getResponse();

System.out.println(“httpResp:”+httpResp);

byte[] data = httpResp.getBlockingBody().readBytes(); ------> getting error here

and after that getting Timeout Reached Exception.

Output in java console

httpResp:HTTP/1.1 302 Found
Server: Jetty(7.0.2-SNAPSHOT)
Content-Length: 0
Location: http://myipaddress:7070/http-bind/

Exception in thread “BOSHClient[32389396]: Receive thread” java.lang.NullPointerException
at com.kenai.jbosh.XLightWebResponse.awaitResponse(XLightWebResponse.java:188)
at com.kenai.jbosh.XLightWebResponse.getBody(XLightWebResponse.java:166)
at com.kenai.jbosh.BOSHClient.processExchange(BOSHClient.java:1056)
at com.kenai.jbosh.BOSHClient.processMessages(BOSHClient.java:1000)
at com.kenai.jbosh.BOSHClient.access$0(BOSHClient.java:970)
at com.kenai.jbosh.BOSHClient$1.run(BOSHClient.java:211)
at java.lang.Thread.run(Unknown Source)

Thanks

Thank you so much for your help.

Finally I am able to connect with Openfire using BOSH after I added the trailing slash.

BOSHConfiguration config = new BOSHConfiguration(false,

“myipaddress”, 7070, **"/http-bind/", **“myservicename”);

Without trailing slash I was getting Null pointer exception.

Thanks,

1 Like

For anyone else attempting to use the smack-bosh branch above: it worked for me, but there are all sorts of NPE bugs you might encounter because it’s built against 3.2.0. You might try using the following libs instead:

Latest SMACK API 3.2.1 version doesn’t have support for BOSH. Thus, I have merged their code base

http://svn.igniterealtime.org/svn/repos/smack/branches/bosh/

and

http://svn.igniterealtime.org/svn/repos/smack/tags/smack_3_2_1/

to produce custom jars which has got support for BOSH connection. These jars can be found at https://github.com/rajesh-kumar/amqp-xmpp-bosh/tree/master/lib/

Did you ever get the BOSHConnection working with PubSub? I am trying it and I notice that in the debugger the connection continually stops and restarts when it sends out a request to get a node. Then eventually, it will work and it seems that the connection is fine from that point on. Didn’t know if you had any experience with this.

Hi Brian,

I tried something a long time back. Please find my blog at -

http://rajlondonboy.wordpress.com/2011/11/13/pubsub-demo-xmpp-and-bosh-with-amqp /

Raj

Thanks for the info. I am currently using smack 3.2.2 with a version of BOSHConnection that I found on github . I will try again with 3.2.1 and your version of the jar. One difference I see is that I am using Openfire for my server where you are using EJabberd. Thanks for the info. The issue I am seeing is weird - after my request for a a node, I am getting a “Client provided invalid session” error on the server. Regardless, I will give it a shot. Thanks again.

Anyone get PLAIN Sasl to work with this? I can’t seem to get this to work at all. I know the login stuff is correct, as I’ve tested it using XMPPConnection class, I just change this and the port, and using BOSH I get “No response from the server.:”. Watching the this in wireshark, it looks like it get’s the challenge and does nothing with it.

Thanks.