powered by Jive Software

Beginner Question

After installation and setup, where should we start?

Do we write java classes or JSP pages?

I have tried the following code:


<%@ page import=“java.util.*”%>

<%@ page import=“org.jivesoftware.smack.*”%>

Testing Jabber service…

<%

out.print(“Step 1…
”);

XMPPConnection connection = new XMPPConnection(“merakdemo.com”, 5222);

out.print(“Step 2…
”);

connection.login(“user”, “user”);

out.print(“Step 3…
”);

connection.createChat("admin@merakedemo.com").sendMessage(“Howdy!”);

out.print(“Step 4…
”);

%>


filename: smackdemo.jsp

running server: Tomcat

but this is the error message I got:


org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 3 in the jsp file: /smackdemo.jsp

Generated servlet error:

Compiling 1 source file

C:\jakarta-tomcat-4.1.29\work\Standalone\localhost\worktest\smackdemo_jsp.java:8 : package org.jivesoftware.smack does not exist

import org.jivesoftware.smack.*;

^

C:\jakarta-tomcat-4.1.29\work\Standalone\localhost\worktest\smackdemo_jsp.java:4 8: cannot resolve symbol

symbol : class XMPPConnection

location: class org.apache.jsp.smackdemo_jsp

XMPPConnection connection = new XMPPConnection(“merakdemo.com”, 5222);

^

An error occurred at line: 3 in the jsp file: /smackdemo.jsp

Generated servlet error:

C:\jakarta-tomcat-4.1.29\work\Standalone\localhost\worktest\smackdemo_jsp.java:4 8: cannot resolve symbol

symbol : class XMPPConnection

location: class org.apache.jsp.smackdemo_jsp

XMPPConnection connection = new XMPPConnection(“merakdemo.com”, 5222);

^

3 errors


I totally don’'t know what to do now.

Or should I write them in classes instead of JSP?

Can someone help?

Thank you so much !!!

Tom

Tom,

The problem that you are seeing is because Smack classes cannot be found. To solve the problem you need to place the jar files (smack.jar, smackx.jar) in the WEB-INF\lib folder inside your webapp.

Or should I write them in classes instead of JSP?

It’'s up to you to decide where do you want to place your application logic. Smack will work fine as long as the jar files are placed in the right place.

Regards,

– Gato

Also, to make it easier on you and the rest of us to read, why not just create a simple class and include it in your jsp as a usebean instead of adding scriptlets? In your webapp, put the smack.jar and smackx.jar under web-inf/lib. Things will work just fine.

Cheers.

Thank you all !!!

I got it to work…

Thanks a lot !!!