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].
For more options, visit this group at
http://groups.google.com/group/smslib?hl=en.