Mar 20, 2009 5:12 AM
whack weather example usage
-
Like (0)
ez all
i'm pretty new with whack and i have some perplexities about the weather example...i built it, run it: now what? how i can use it? i suppose i have to write a client plugin but...
thanks!
Hi, for testing you can use Psi for example, add your weather component in your buddy list and send him a message with a weather station from http://weather.noaa.gov/ (see the attached screenshot).But for a comfortable usage, yeah, maybe you can write a client ![]()
I read that the weather example was in a sample folder in the source. I downloaded the source zip and did not find it.
Q: Where are you getting the weather example these days?
Thanks,
You can get it via subversion
svn co http://svn.igniterealtime.org/svn/repos/whack/trunk whack
But currently I think you can't compile the trunk if you don't fix some old references. See my attached patch to compile and run the actual revision (11087).
Best regards
I changed the whack.jar build compile target includes in order to pick up the xmpp classes. That allowed me to use whack.jar in my component project. I hope I'm on the right track..
Thanks!
<target name="jar" depends="compile" unless="jar.uptodate" description="Produces whack.jar">
<jar destfile="${jar.dest.dir}/whack.jar"
basedir="${compile.dir}"
includes="org/**/*.class" />
<!-- includes="org/jivesoftware/whack/**/*.class" -->
</target>
1) I rebuild whack.jar from SVN - just needed to modify the build.xml to include more classes in whack.jar.
2) I got the weather sample to compile against these jars:
commons-httpclient.jar
dom4j.jar
jweather.jar
tinder-1.0.0.jar
xpp3.jar
commons-logging.jar
jakarta-oro.jar
log4j.jar
whack.jar
2) When I try to run the weather example I get:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jivesoftware/stringprep/IDNA
at org.xmpp.packet.JID.init(JID.java:369)
at org.xmpp.packet.JID.<init>(JID.java:248)
at org.jivesoftware.whack.ExternalComponentManager.addComponent(ExternalComponentM anager.java:212)
at org.jivesoftware.whack.ExternalComponentManager.addComponent(ExternalComponentM anager.java:191)
at org.jivesoftware.weather.ExternalWeatherComponent.main(ExternalWeatherComponent .java:32)
Caused by: java.lang.ClassNotFoundException: org.jivesoftware.stringprep.IDNA
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 5 more
3) It looks like the missing class is required by the tinder jar. My goal is to run the weather example.
Woops, sorry - found stringprep.jar to fix my runtime problem
Weather example is running, thanks!
I fixed the current trunk version of whack for the updated API and libraries.
Got to bump this discussion up.
I just downloaded the whack trunk from svn (rev 12148), it seems I cannot build it using ant.
pongells:build fusionove$ ant
Buildfile: /Users/fusionove/whack/build/build.xml
compile:
[javac] Compiling 21 source files to /Users/fusionove/whack/target/classes
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:23: package org.eclipse.jetty.server does not exist
[javac] import org.eclipse.jetty.server.Server;
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:24: package org.eclipse.jetty.server.nio does not exist
[javac] import org.eclipse.jetty.server.nio.SelectChannelConnector;
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:25: package org.eclipse.jetty.server.ssl does not exist
[javac] import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:26: package org.eclipse.jetty.webapp does not exist
[javac] import org.eclipse.jetty.webapp.WebAppContext;
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:52: cannot find symbol
[javac] symbol : class Server
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] private Server jetty;
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:105: cannot find symbol
[javac] symbol : class Server
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] jetty = new Server();
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:115: cannot find symbol
[javac] symbol : class SelectChannelConnector
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] SelectChannelConnector connector0 = new SelectChannelConnector();
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:115: cannot find symbol
[javac] symbol : class SelectChannelConnector
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] SelectChannelConnector connector0 = new SelectChannelConnector();
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:131: cannot find symbol
[javac] symbol : class SslSelectChannelConnector
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] SslSelectChannelConnector listener = new SslSelectChannelConnector();
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:131: cannot find symbol
[javac] symbol : class SslSelectChannelConnector
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] SslSelectChannelConnector listener = new SslSelectChannelConnector();
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:192: cannot find symbol
[javac] symbol : class WebAppContext
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] WebAppContext webapp = new WebAppContext();
[javac] ^
[javac] /Users/fusionove/whack/source/java/org/jivesoftware/whack/container/ServerContainer.java:192: cannot find symbol
[javac] symbol : class WebAppContext
[javac] location: class org.jivesoftware.whack.container.ServerContainer
[javac] WebAppContext webapp = new WebAppContext();
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 12 errors
BUILD FAILED
/Users/fusionove/whack/build/build.xml:95: Compile failed; see the compiler error output for details.
Total time: 2 seconds
pongells:build fusionove$
Any suggestion here?
Thanks.
Oh well, I just downloaded the whole jetty distribution and put each jar inside the lib/merge folder... not sure wether this was a good idea, but it worked.
The Whack 1.0.jar which can be found on this website doesn't work anymore (missing Log class, at least) - maybe someone should update it?
For this weather example, the jweather.jar was missing, too.
I have another solution for compiling the Whack library.Just download "jetty-all-server-7.0.2.RC0.jar" and add build/ merge and run the ant file. This worked for me and had written a sample external component and thats working fine.