powered by Jive Software

Can't send message to Spark client from Java simple client

Hi, on a Spark 2.5.2 client I can’t receive a message sent from a simple Java client.

I’ve the Java client realized with Smack 3.0.4 (same problem with 3.0.2) on a Win XP sp2 (ip address=10.229.7.14, no firewall).

And OpenFire 3.3.1 + Spark 2.5.2 on another Win XP sp2 (ip address=10.10.7.27, computer name=HPI15000).

Both boxes have in the hosts file: 10.10.7.27 HPI15000

Tried OpenFire 3.3.2 as well, but reised SASLAuthentication errors in addition, so downgraded.

Java client doesn’t show XMPP exceptions, source follows:

public void send() {

XMPPConnection conn1;

try {

// Create a connection to the jabber.org server on a specific port.

ConnectionConfiguration cc = new ConnectionConfiguration(“10.10.7.27”, 5222);

cc.setSASLAuthenticationEnabled(false);

conn1 = new XMPPConnection(cc);

conn1.connect();

System.out.println(“Connection with server established”);

// Login as a user

conn1.login(“myadmin”, “myadmin”);

System.out.println(“Login ok”);

Message message = new Message();

message.setTo(("user_2@10.10.7.27"));

message.setSubject(“Test”);

message.setBody(“Test”);

System.out.println("Message = "+message.toXML());

message.setType(Message.Type.normal);

conn1.sendPacket(message);

System.out.println(“Message sent”);

conn1.disconnect();

System.out.println(“Client - server disconnected”);

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

OpenFire debug log reports what follows:

2007.08.24 16:48:53 OS - Trying to connect to 10.10.7.27:5269(DNS lookup: 10.10.7.27:5269)

2007.08.24 16:48:53 Connect Socket[http://addr=/10.10.7.27,port=1246,localport=5269|http://addr=/10.10.7.27,port=12 46,localport=5269]

2007.08.24 16:48:53 OS - Plain connection to 10.10.7.27:5269 successful

2007.08.24 16:48:53 OS - Error,

java.lang.Exception: Failed to create connection to remote server

at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.sendPa cket(OutgoingSessionPromise.java:212)

at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(Ou tgoingSessionPromise.java:184)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Any thought ?

Thanks

Rob

This is all in a LAN? I’d suggest adjust your IP adressing scheme to the standards (something like 168.192.x.x).

Try using the host name in all cases, since you went and put it in the hosts file already - don’t use the IP adress. I think Openfire goes to look for it on the internet (see about IP adressing schema above). Also put that host name as the name for the OpenFire server, and in your jids.

Thanks a lot, it helped solving the problem.

I’ve plugged the box with OpenFire on another subnet and adjusted hosts file accordingly. The weird thing is that the Spark client on the same box has to address the server with the ip address and not with the computer name that could be solved with “nslookup”; mabe a bug in java.net.* classes? I heard about a bug some time ago.

Anyway my tests can proceed.

Thanks

Rob