Do not you think this is the typical class path error? What version of tomcat are you using? Are you including the class path?
By using tomcat 4.1.12, you should place your jar under shared/lib. Gustavo. *********************************************** Gustavo Cebrian Analyst/Programmer Want to improve the ROI on your EAI project? Download RV Tester and reduce your development and testing timescales by as much as 50%. http://www.greenhatconsulting.com/rvtester Green Hat Consulting Ltd. 107 Fleet Street, London EC4A 2AB DDI +44 (0)20 7936 9495 Mobile +44 (0)7788 922291 http://www.greenhatconsulting.com [EMAIL PROTECTED] *********************************************** -----Original Message----- From: narayanaswamy anandapadmanabhan [mailto:[EMAIL PROTECTED] Sent: 17 March 2003 13:13 To: [EMAIL PROTECTED] Subject: How can I send an SMS to a number from Tomcat Server to the J2ME (2.0 ) client? dear sir/madam, How can I send an SMS to a number from Tomcat Server to the J2ME (2.0 ) client? I am using the bridge API , it works good from console (c:/java ...) but not with servlet? The following program I used for this purpose ( changing public void doGet(...) as public static void main(string arg[]) ) but this one doesn't runs from my servlet It prints "Hello World" and then it says the error.... java.lang.NoClassDefFoundError: com/sun/kvem/environment/ToolkitDirs at com.sun.kvem.midp.io.j2se.wma.client.WMAClient.(Unknown Source) at MySMS.doGet(MySMS.java:29) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at ... at ... at java.lang.Thread.run(Thread.java:536) Do I want to do any changes in the tomcat to run this If so what are the changes. The program: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import com.sun.kvem.midp.io.j2se.wma.client.WMAClient; import com.sun.kvem.midp.io.j2se.wma.Message; public class MySMS extends HttpServlet{ private final int MAX_LEN = 500; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException , IOException{ res.setContentType("text/html"); PrintWriter out = res.getWriter(); int DEFAULT_SMS_PORT = 50000; WMAClient wtkClient; int smsPort = DEFAULT_SMS_PORT; System.out.println("Hello World!"); System.setProperty("kvem.home","c:\\wtk20"); wtkClient = new WMAClient(null, WMAClient.SEND_AND_RECEIVE); System.out.println("Object created"); try{ wtkClient.connect(); }catch(Exception e){ e.printStackTrace(); } System.out.println("Connected"); System.out.println("Enter the number and message:"); String argString = "5550001 test"; System.out.println("Number obtained is:"+wtkClient.getPhoneNumber()); int spacePos = argString.indexOf(' '); String toPhoneNumber= null; String messageStr = null; if (spacePos > 0) { toPhoneNumber = argString.substring(0, spacePos); messageStr = argString.substring(spacePos+1).trim(); } else { System.out.println("sms requires a phone number and a message."); } Message message = new Message(messageStr); message.setToAddress("sms://" + toPhoneNumber + ":" + smsPort); message.setFromAddress("sms://" + wtkClient.getPhoneNumber()); try { wtkClient.send(message); System.out.println("Sent sms."); } catch (Exception e) { System.err.println("Caught exception sending sms: "); e.printStackTrace(); } } } Awaiting for your reply... Thank you Narayanaswamy. _________________________________________________________________ Get ball by ball action on your desktop. http://server1.msn.co.in/msnspecials/cricketdownload/contest.asp Get Hutch MSN Cricketer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
