First of all, I am no where near smslib expert, but it looks like you have the comport problem or comm driver that I had before (misplacing jar files) , check the hardware and see what com port it is attached to. If it does not work, you will need to reconfigure the comm library for the system.
Second, I am also using smslib in my j2ee project. I believe putting Service instance on the jsp is not the best option to use smslib, because it will invoke Service,( which takes several seconds to start ) everytime you load the servlet/jsp (???) . I think it should run only once throughout the application by design. In my case, it starts only once, when I start the application. If you have any tips using j2ee and smslib share me please. check http://smslib.org/doc/installation/ for installing comm drivers for java including windows and linux. Merry X mass and Good luck. Cheers Nick On Fri, Dec 11, 2009 at 10:48 PM, Vikas Patidar < [email protected]> wrote: > Hi, > I am using smslib in my project and I have properly configured the > whole > project in IBM Rational Application Developer 7.5. Also I am > successfully > able to run ReadMessages.java and SendMessage.java in my JAVA project, > but > I want to Send and Read SMS in a Dynamic Web Project using JSP or > Servlets. For > this i have written a simple ReadMessage.jsp file like: > > ===================================================================== > <%@ page language="java" contentType="text/html; charset=ISO-8859-1" > pageEncoding="ISO-8859-1" > import = "java.util.*, > org.smslib.*, > org.smslib.AGateway.Protocols, > org.smslib.InboundMessage.MessageClasses, > org.smslib.modem.SerialModemGateway" %> > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=ISO-8859-1"> > <title>Read Messages from phone Using SMSLib !</title> > </head> > <body> > <% > Service srv = new Service(); > InboundMessage message; > List<InboundMessage> msgList; > try > { > SerialModemGateway gateway = new > SerialModemGateway("modem.com27", > "COM27", 57600, "Nokia", "3220"); > gateway.setProtocol(Protocols.PDU); > gateway.setSimPin("0000"); > srv.addGateway(gateway); > srv.startService(); > msgList = new ArrayList<InboundMessage>(); > srv.readMessages(msgList, MessageClasses.ALL); > for (int i = 0; i < 1; i++) > { > message = msgList.get(i); > String msgTxt = message.getText(); > out.print(msgTxt); > } > } > catch (Exception e) > { > e.printStackTrace(); > } > finally > { > srv.stopService(); > } > %> > </body> > </html> > ===================================================================== > When i have publish the file ReadMessage.jsp to the server first time > it works fine and reads first message but when i have publish this > file again to the server it is displaying the following error: > ===================================================================== > > [12/11/09 23:55:39:732 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo SMSLib: A Java API library for > sending and > receiving SMS via a GSM modem or other supported gateways. > This software is distributed under the terms of the Apache v2.0 > License. > Web Site: http://smslib.org > [12/11/09 23:55:39:732 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo Version: 3.4.3 > [12/11/09 23:55:39:748 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo JRE Version: 1.6.0 > [12/11/09 23:55:39:748 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo JRE Impl Version: 2.4 > [12/11/09 23:55:39:748 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo O/S: Windows Vista / x86 / 6.1 build > 7600 > [12/11/09 23:55:39:748 IST] 00000107 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Starting gateway, > using > Generic AT Handler. > [12/11/09 23:55:39:748 IST] 00000107 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Opening: COM27 > @57600 > [12/11/09 23:55:40:748 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Stopping gateway... > [12/11/09 23:55:40:748 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Closing: COM27 > @57600 > [12/11/09 23:55:40:748 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Gateway stopped. > [12/11/09 23:55:41:154 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Stopping gateway... > [12/11/09 23:55:41:154 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Closing: COM27 > @57600 > [12/11/09 23:55:41:154 IST] 000000f4 smslib I > org.smslib.helper.Logger logInfo GTW: modem.com27: Gateway stopped. > [12/11/09 23:55:41:154 IST] 000000f4 SystemErr R > org.smslib.GatewayException: Comm library exception: > java.lang.RuntimeException: javax.comm.NoSuchPortException > [12/11/09 23:55:41:154 IST] 000000f4 SystemErr R at > org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java: > 96) > [12/11/09 23:55:41:154 IST] 000000f4 SystemErr R at > org.smslib.modem.AModemDriver.connect(AModemDriver.java:111) > [12/11/09 23:55:41:154 IST] 000000f4 SystemErr R at > org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:185) > [12/11/09 23:55:41:154 IST] 000000f4 SystemErr R at > org.smslib.Service$1Starter.run(Service.java:257) > > ==================================================================== > If anyone is working with J2EE then please reply me. > Thanks and regards, > Vikas Patidar > > -- > > You received this message because you are subscribed to the Google Groups > "SMSLib for Java User Group" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<smslib%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/smslib?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "SMSLib for Java User Group" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/smslib?hl=en.
