Cannot compile with wildfire.jar

I want to create a small java program in wildfire server, so I can get user presence

status without going to the web admin. Before is my just started code.

import org.jivesoftware.wildfire.*;

public class Test

{

public static void main(String args[])

{

XMPPServer l_xmppServer = new XMPPServer();

}

}

Below was what I got during compiling:

E:\Temp>javac Test.java

Test.java:7: cannot access org.jivesoftware.wildfire.XMPPServer

bad class file: E:\Program Files\Wildfire\lib\wildfire.jar(org/jivesoftware/wildfire/XMPPServer.class)

class file has wrong version 49.0, should be 48.0

Please remove or make sure it appears in the correct subdirectory of the classpath.

XMPPServer l_xmppServer = new XMPPServer();

^

1 error

Anything wrong with my very simple code ?

Hi Tancy,

class file has wrong version 49.0, should be 48.0

This error means that you’'re trying to run a Java 1.5 application (in this case Wildfire) using Java 1.4. Wildfire makes extensive use of Java 1.5 features so your test program will need to be run with 1.5.

As for getting user presence without going to the Admin Console, have you looked at the url=http://www.jivesoftware.org/wildfire/plugins.jspPresence Service Plugin[/url]?

Hope that helps,

Ryan

Tell me more about this Presence Plug-in. I don’'t want to get the user presence

from web.

Thanks !

I installed Jsdk1.5, now, I can compile, but error in run.

I used this command to run:

E:\Jabber\API\Smack 2.1.0\code>“E:\Program Files\Java\jdk1.5.0_06\bin\java” -classpath "E:\Program Files\Wildfire\lib\wildfire.jar;E:\Program Files\Wi

ldfire\lib\servlet.jar;./" TestSmack

Could not locate home

java.io.FileNotFoundException

at org.jivesoftware.wildfire.XMPPServer.locateWildfire(XMPPServer.java:703)

at org.jivesoftware.wildfire.XMPPServer.initialize(XMPPServer.java:253)

at org.jivesoftware.wildfire.XMPPServer.start(XMPPServer.java:336)

at org.jivesoftware.wildfire.XMPPServer.(XMPPServer.java:135)

at TestSmack.retrievePresence(TestSmack.java:157)

at TestSmack.main(TestSmack.java:169)

Critical Error! The home directory has not been configured,

which will prevent the application from working correctly.

ERROR 11404 ():

java.io.FileNotFoundException: XML properties file does not exist: wildfire.xml

at org.jivesoftware.util.XMLProperties.(XMPPServer.java:135)

at TestSmack.retrievePresence(TestSmack.java:157)

at TestSmack.main(TestSmack.java:169)

Error starting the server. Please check the log files for more information.

Look like it could not file the xml file. How to fix it ?

Thanks !

Hi Tan,

add -DwildfireHome=/pathto/wildfireHome to the java call.

You could set it to -DwildfireHome=“C:/program files/wildfire” if you have there a local Wildfire installation which is not running.

Btw, are you using Eclipse to compile and run Wifi or are you doing all this manually?

LG

[/nobr]Hi Tan,

the Presence Plug-in if a plugin to get it from web, but without the need to login the admin console. If you look at the gray/green XMPP presence in my profile then you see it already running. It supports displaying images or returns XML. Please read the readme if you need to know more about it.

LG[nobr][/nobr]

Here is the code:

import java.text.*;

import java.util.*;

import org.jivesoftware.wildfire.*;

public class Test

{

public void PrintLog(String p_strStatement)

{

Format l_fmtDate = new SimpleDateFormat("[hh:mm:ss a]");

System.out.println(l_fmtDate.format(new java.util.Date()) + " " + p_strStatement + “\n”);

}

public static void main(String args[])

{

Test l_test = new Test();

l_test.PrintLog(“Before”);

XMPPServer l_xmppServer = new XMPPServer();

l_test.PrintLog(“After”);

}

}

After ran, I got:

E:\Jabber\API\Smack 2.1.0\code>“E:\Program Files\Java\jdk1.5.0_06\bin\java” -DwildfireHome=“E:/Program Files/Wildfire” -classpath "E:\Program Files\Wi

ldfire\lib\wildfire.jar;E:\Program Files\Wildfire\lib\servlet.jar;E:\Jabber\API\Smack 2.1.0\smack.jar;E:\Jabber\API\Smack 2.1.0\smackx.jar;./" Test

Before

Database setup or configuration error: Please verify your database settings and check the logs/error.log file for detailed error messages.

java.lang.IllegalArgumentException: java.lang.NullPointerException

at org.jivesoftware.wildfire.XMPPServer.verifyDataSource(XMPPServer.java:582)

at org.jivesoftware.wildfire.XMPPServer.start(XMPPServer.java:340)

at org.jivesoftware.wildfire.XMPPServer.(XMPPServer.java:135)

at Test.main(Test.java:20)

Caused by: java.lang.NullPointerException

at org.jivesoftware.wildfire.XMPPServer.verifyDataSource(XMPPServer.java:571)

… 3 more

Error starting the server. Please check the log files for more information.

After

Log file:

2006.02.20 22:26:29 [org.jivesoftware.database.DefaultConnectionProvider.start(DefaultConnectionPro vider.java:88)

]

java.io.IOException

at org.jivesoftware.database.ConnectionPool.(XMPPServer.java:135)

at Test.main(Test.java:20)

Caused by: java.lang.NullPointerException

at org.jivesoftware.wildfire.XMPPServer.verifyDataSource(XMPPServer.java:571)

… 3 more

What’'s wrong ? This app and wildfire is on the same PC. Widlfire was running at that time.

Your help is really appreciated. Thanks !

Hi Tan,

you must stop Wildfire if you want to use this directory. Copy “C:/program files/wildfire” to C:/wildfire" and set -DwildfireHome=“C:/wildfire” if you want to use another home directory/database/configuration.

But don’‘t try to run Wildfire two times on one computer unless you did configure it to bind just to one ip address. And make sure that each Wildfire process uses it’'s own wildfireHome.

LG

I am going crazy.

I copied E:\Program Files\Wildfire to E:\Jabber\Wildfire.

This is my ran:

E:\Jabber\API\Smack 2.1.0\code>“E:\Program Files\Java\jdk1.5.0_06\bin\java” -DwildfireHome=“E:/Jabber/Wildfire” -classpath "E:\Jabber\Wildfire\lib\wil

dfire.jar;E:\Jabber\Wildfire\lib\servlet.jar;E:\Jabber\API\Smack 2.1.0\smack.jar;E:\Jabber\API\Smack 2.1.0\smackx.jar;./" Test

Before

Database setup or configuration error: Please verify your database settings and check the logs/error.log file for detailed error messages.

java.lang.IllegalArgumentException: java.lang.NullPointerException

at org.jivesoftware.wildfire.XMPPServer.verifyDataSource(XMPPServer.java:582)

at org.jivesoftware.wildfire.XMPPServer.start(XMPPServer.java:340)

at org.jivesoftware.wildfire.XMPPServer.(XMPPServer.java:135)

at Test.main(Test.java:20)

Caused by: java.lang.NullPointerException

at org.jivesoftware.wildfire.XMPPServer.verifyDataSource(XMPPServer.java:571)

… 3 more

Error starting the server. Please check the log files for more information.

After

Still give me the same thing with or without Wildfire running.

What do you mean by configure it to bind one ip address ? How ?

Thanks a million.

Hi,

to bind each wildfire instance to an IP address add to wildfire.xml a network.interface line, it may then look like this example:

/code

I don’'t know if what you are trying to do (start Wildfire like this) is really possible. I usually start Wildfire in Eclipse as described in a thread 20 lines below (Problems building WildFire in Eclipse SDK 3.1.2).

May I try again to direct you to the presence plugin which source code is included in wildfire_src_2_5_0.zip and located in wildfire_src/src/plugins/presence ? It may be better to modify the code to suit your needs.

LG

I tired “E:\Program Files\Java\jdk1.5.0_06\bin\java” -DwildfireHome=“E:/Jabber/Wildfire” -classpath "E:\Jabber\Wildfire\lib\wil

dfire.jar;E:\Jabber\Wildfire\lib\servlet.jar;E:\Jabber\API\Smack 2.1.0\smack.jar;E:\Jabber\API\Smack 2.1.0\smackx.jar;./" Test

Before

Database setup or configuration error: Please verify your database settings and check the logs/error.log file for detailed error messages.

java.lang.IllegalArgumentException: java.lang.NullPointerException

at org.jivesoftware.wildfire.XMPPServer.verifyDataSource(XMPPServer.java:582)

at org.jivesoftware.wildfire.XMPPServer.start(XMPPServer.java:340)

at org.jivesoftware.wildfire.XMPPServer.(XMPPServer.java:135)

at Test.main(Test.java:20)

Caused by: java.lang.NullPointerException

at org.jivesoftware.wildfire.XMPPServer.verifyDataSource(XMPPServer.java:571)

… 3 more

Error starting the server. Please check the log files for more information.

After

Anyway, I am going to try your suggestion on modifying the presence source code.

I downloaded Presence.jar, and out it in plugins filder. And typed the following url

http://127.0.0.1:9090/plugins/presence/status?jid=tancy@noneworkstation&type=xml.

I got:

How come ?

Hi Tan,

please check if you did activate “Presence visibility” “* Subscribed - Presence information is only visible to authorized users.” on /plugins/presence/presence-service.jsp

Maybe you want to select “* Anyone - Anyone may get presence information.”

Or look at your roster, take one account and modify your url to http://127.0.0.1:9090/plugins/presence/status?jid=tancy@noneworkstation&type=xml &&req_jid=freind@noneworkstation .

The source code for the plugin comes together with Wildfire.

LG

Thanks ! I am able to use presence now.