Hi ,
I am able to send SMS using sendMessage.java (This is running as standalone
application. Same code in SMSLib src).
But i want this as WAR file deployed in Jboss 7.
So i wrote the similar code in a servelet and deployed. But getting error
when starting the service "Caused by: java.lang.RuntimeException:
CommPortIdentifier class not found"...
Please help me on this. I want this SMS lib to run as a webaplication and
shuold be able to send/recieve SMS through ULR hits.
Here is my servlet......
package com.hp.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.smslib.AGateway.Protocols;
import org.smslib.InboundMessage;
import org.smslib.Service;
import org.smslib.modem.SerialModemGateway;
public class startService extends HttpServlet {
public startService() {
super();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
System.out.println("Starting Service");
OutboundNotification outboundNotification = new
OutboundNotification();
SerialModemGateway gateway = new SerialModemGateway("modem.com22",
"COM6", 115200, "huawei", "E1750");
try {
gateway.setProtocol(Protocols.PDU);
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
gateway.setSmscNumber("+919845087001");
Service.getInstance().setOutboundMessageNotification(outboundNotification);
Service.getInstance().addGateway(gateway);
System.out.println("Gateway Added");
Service.getInstance().startService();
System.out.println("Service Started");
}
catch (Exception e) {
System.out.println(e);
}
}
}
Error in log.
---------------------
10:03:57,853 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Starting
Service
10:03:57,854 INFO [smslib] (http-localhost-127.0.0.1-8080-1) 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
10:03:57,854 INFO [smslib] (http-localhost-127.0.0.1-8080-1) Version: 3.5.2
10:03:57,854 INFO [smslib] (http-localhost-127.0.0.1-8080-1) JRE Version:
1.6.0_31
10:03:57,854 INFO [smslib] (http-localhost-127.0.0.1-8080-1) JRE Impl
Version: 20.6-b01
10:03:57,869 INFO [smslib] (http-localhost-127.0.0.1-8080-1) O/S: Windows
7 / x86 / 6.1
10:03:57,885 INFO [stdout] (http-localhost-127.0.0.1-8080-1) Gateway Added
10:03:57,885 INFO [smslib] (http-localhost-127.0.0.1-8080-1) Queue
directory not defined. Queued messages will not be saved to filesystem.
10:03:57,885 INFO [smslib] (Thread-87) GTW: modem.com22: Starting gateway,
using Generic AT Handler.
10:03:57,885 INFO [smslib] (Thread-87) GTW: modem.com22: Opening: COM6
@115200
10:03:57,885 ERROR [stderr] (Thread-87) Exception in thread "Thread-87"
java.lang.ExceptionInInitializerError
10:03:57,885 ERROR [stderr] (Thread-87) at
org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:69)
10:03:57,901 ERROR [stderr] (Thread-87) at
org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
10:03:57,901 ERROR [stderr] (Thread-87) at
org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
10:03:57,901 ERROR [stderr] (Thread-87) at
org.smslib.Service$1Starter.run(Service.java:276)
10:03:57,901 ERROR [stderr] (Thread-87) Caused by:
java.lang.RuntimeException: CommPortIdentifier class not found
10:03:57,901 ERROR [stderr] (Thread-87) at
org.smslib.helper.CommPortIdentifier.<clinit>(CommPortIdentifier.java:76)
10:03:57,901 ERROR [stderr] (Thread-87) ... 4 more
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msg/smslib/-/VfAufGLhwowJ.
For more options, visit https://groups.google.com/groups/opt_out.