Hello Everyone!
Today I am going to tell you about how to Simply send SMS by using your HSDPA dongle or GSM modem. Cool! Isnt It? yes Its not that Difficult too. I have tried so many ways to Accomplish this problem. After so many Attempts I got the way to do. So well I will tell you how I have done that.
Basically this was created by using
SMSLib which is an open source Library for Java. After studying the API I have created a Simple API Wrapper for the convenience of all of us. I have hosted the open source coding at Github with a sample Project named
SMS.Dura.Wrapper. For this sample project I have made and used a Prebuilt Jar Library named
smsdura-1.0.jar which works as the wrapper. So in your Project you have to do is simply import that smsdura-1.0.jar, just configure the modem, put the Message, TP and Send. Now SMS from Java? Its very easy as Ice Cream! :D Don't worry. I will tell you how to do that. May be it will add more value for your project as well.
I will guide you rest of the Process.
Okay lets Start!
1. First of all you have to
Download this Sample Project.
2. Now we have to copy few files in the <Extras folder> to your Java Classpath.[Normally JDKDIR can be found in > C:\Program Files\Java] So go to that path and do it as said. Detailed Instructions are listed below.
---------------------------
External Configurations for the JVM on the targeted machine. (Strictly Recommended!)
[These files can be found in <extras> folder of the Project path.)
---------------------------
Java Comm Installation <comm dir>
-----------------------------------
File comm.jar should go under JDKDIR/jre/lib/ext/
File javax.comm.properties should go under JDKDIR/jre/lib/
Library files (i.e. win32com.dll for Win32 or the .so Linux library files) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!
RxTx Installation <rxtx dir>
-----------------------------------
File RXTXcomm.jar should go under JDKDIR/jre/lib/ext/
The necessary library (e.g.. for Linux 32bit, the librxtxSerial.so) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!
huh! All the hard work has been done. be cool now :)
3. Okay now Simply open the Project from Netbeans IDE or whatever IDE you are using.
4. Importing the Required Dependencies. I have Imported all the Jars for this Project. So by default you have to do nothing with importing. But in your project you have to import few Jar files you can found in <lib> folder. You have to import all the Jars in that folder.
5. Okay done! Now take a look at this code.
package logic;
import com.harshadura.gsm.smsdura.GsmModem;
public class TestSMS {
private static String port = "COM3"; //Modem Port.
private static int bitRate = 115200; //this is also optional. leave as it is.
private static String modemName = "ZTE"; //this is optional.
private static String modemPin = "0000"; //Pin code if any have assigned to the modem.
private static String SMSC = "+9477000003"; //Message Center Number ex. Mobitel
public static void main(String[] args) throws Exception {
GsmModem gsmModem = new GsmModem();
GsmModem.configModem(port, bitRate, modemName, modemPin, SMSC);
gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg)
}
}
Okay in here. you will notice that you have to first find out the port number of your USB modem/dongle.
for that you can simply right click the MyComputer Icon > goto Mange > then Search for Modems > then it will pop up a interface with several tabs.
Okay then you can simply notice theirs a Name called port. Infront of that theirs the port Number. okay cool now you know the port number. Insert that into the code.
Modem name is a optional thing.Give it some relevant name.
Bitrate? leave it as it is. Or change to a proper one. The number will change depending modem to modem. so just leave as it as.
Some modems are using PIN numbers for Security. Does your one also using such a pin? If so please insert it to the code.
well then You have to insert the SMS Message Center Number. You already know that. Suppose you own a Mobitel/Dialog Sim you can easily find out it in your Mobile phone/Dongle Message Settings. So get the Number and paste it with +94 prefix.
wow! Now all are ready. we have completed the Configuration of the modem. Cool isnt it? :D
Okay now please disconnect your Modem from the Internet Before continue.
If its connected to the internet or may be the Mobile Partner or what ever the Software you are using to connect with the modem, can disturb our work. So just close them All.
You better restart your computer to refresh the Modem Port. Don't Connect it to the Internet!!
Well now we are ready to send SMS thorough Java.. Be Cool..!
gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg)
Just put some Telephone number and message for the Body.
Then do a Clean and Build. Now simply Run the project.
Okay all have to be working Properly..Wait, Give it some Time! Did you got the Message? :D
So thats how we can simply send SMS using Java with our USB modem.
Cool way.. huh!
Cheers!
- Harsha
_________________________
Troubleshooting
- Case 1 - javax.comm.NoSuchPortException
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
This error can be occurred caused by several reasons.
1. your dongle
software might be opened. so close it, double check if its running as a
background service by using Task Manager. kill if it exists.
2. Your
SMSLib configurations to JVM isnt affected properly. so check again the
required files are thr or not. you need to place them both JDK and JRE
see ^
3. This program doesnt work well with 64Bit JVM, but it doesnt
say you cant use it in a 64 bit machine. but You have install 32Bit JDK
on it, remove the 64Bit JDK to prevent mix ups.
4. The port you gonna
access might not really available in the system. you can simple check
the Dongle port if its thr by: right clicking Computer icon then go
manage > then select device manager > then expand Ports(COM LPT)
column > You will see the Application interface port of your device.
Thats the port you have to use thr.
- Case 2 - SMS to multiple recipients
Unfortunately this program doesn't have the capability to send SMS for multiple recipients but the core API (SMSLib) would do it, So you may refer
this to send same SMS to multiple recipients(group sms) by using the built in functions of SMSLib API.
Notes:
- This program is licensed under: Apache License (Please see the full license document at here)
- The program is a API Wrapper for SMSLib and the Main API has more Functionality than this Wrapper Code.
- Please review the below comments section for Answers towards most of the frequently asked questions.
April 30, 2012 at 6:52 PM
Hello, I tried to run your code, but there occurs an exception "NoSuchPortException". I tried for all COM ports available. Is this something wrong with the OS itself? User restrictions and all. Still I am running the app in admin mode.
-I tried to sort out all the ports of system using CommPortIdentifier.getPortIdentifiers() also. But no ports were shown. Help me friend
April 30, 2012 at 7:02 PM
Hi, did u connect modem? No such port means the code was unable to find a such port num u have given. Don't connect to internet thru the same dongle while doing this.
April 30, 2012 at 7:09 PM
Device manager shows that my modem is on COM32. I entered it in the code. Not connected to internet also. This probably is something wrong with system. Or else does the provided comm.jar compatible with windows? You also running it on windows?
April 30, 2012 at 7:43 PM
hi, forgot to ask?, did u configure JVM on your machine as I have noted in the post. Thats necessary for this case.
<<<
---------------------------
External Configurations for the JVM on the targeted machine. (Strictly Recommended!)
[These files can be found in folder of the Project path.)
---------------------------
Java Comm Installation
-----------------------------------
File comm.jar should go under JDKDIR/jre/lib/ext/
File javax.comm.properties should go under JDKDIR/jre/lib/
Library files (i.e. win32com.dll for Win32 or the .so Linux library files) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!
RxTx Installation
-----------------------------------
File RXTXcomm.jar should go under JDKDIR/jre/lib/ext/
The necessary library (e.g.. for Linux 32bit, the librxtxSerial.so) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!
>>>
May 8, 2012 at 11:01 AM
sir..first of all thank you for this wonderful staff.. i tried your code and it run smoothly.. but sir i have a question.. your codes only sends a message to a single number right?..i mean it doesn't allow to send messages to multiple recipient. sir do you have a code for that..who supports multiple recipient? sir please i need help please..i need it for my thesis.. this is my problem i have a database which contains list of students with corresponding contact number.so what i need to do is to send a message those students all at once. i mean i don't have to send messages with the same info to all of those students one by one. hope you could help me sir. thank you.. ^_^
May 8, 2012 at 11:15 AM
hi, you cant SMS to multiple recipients at once using this method, though you can send them one by one. You might need special GSM modem for get done that.
May 9, 2012 at 6:15 PM
use a loop
May 11, 2012 at 12:10 PM
sir.. i tried the loop method but it report an error..,sir is there a way i could do the multiple recipient..??sir need help... -_-
June 18, 2012 at 10:11 PM
it's working...thank you..
July 12, 2012 at 1:06 PM
sir:
can you tell why these errors are coming and how to solve them.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
July 12, 2012 at 9:21 PM
hi Shehara,
This error can be occurred by several reasons.
1. your dongle software might be opened. so close it, double check if its running as a background service by using Task Manager. kill if it exists.
2. Your SMSLib configurations to JVM isnt affected properly. so check again the required files are thr or not. you need to place them both JDK and JRE see ^
3. This program doesnt work well with 64Bit JVM, but it doesnt say you cant use it in a 64 bit machine. but You have install 32Bit JDK on it, remove the 64Bit JDK to prevent mix ups.
4. The port you gonna access might not really available in the system. you can simple check the Dongle port if its thr by: right clicking Computer icon then go manage > then select device manager > then expand Ports(COM LPT) column > You will see the Application interface port of your device. Thats the port you have to use thr.
Hope this helps!
July 12, 2012 at 9:44 PM
sir :
we got some errors could you help us to solve them
org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
July 12, 2012 at 9:50 PM
Hello sir
I'm Shehara.Thank you ,I'll try it.
July 12, 2012 at 9:51 PM
hi,
Sorry, no idea. the stacktrace you provided isnt sufficient.But I suspect this is an error regarding misconfiguration issue of JVM, I repeat pls do the Configurations properly and do clean build, its very important to run the SMSLib related programs.
JVM Configurations means that you need to copy paste some Jar, properties files in your Programfiles/JDK, JRE directories.
July 12, 2012 at 10:19 PM
sir ,can you tell,why these errors are coming,and how to slove them...
Exception in thread "main" org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
July 12, 2012 at 10:31 PM
hi Shihara,
Okay Cool ! I think you are very near for the output now.
Me too got this kinda of error when plug and play my dongle for the first time. Try remove the dongle and plug again and try, It should work.
In worse case may be your dongle model isnt support this SMSLib API.
July 13, 2012 at 11:24 AM
Hi! I really appreciate this.It works well.I want to send messages to multiple recipients.Can you please help me out with that?
July 13, 2012 at 11:32 AM
sir ,i have used HSUPA,HUWAWEI.dongals..but same error was occur...can you tell me which dongals can be use..
July 13, 2012 at 12:39 PM
@Anonymous1: you can refer this[1] to send same SMS to multiple recipients(group sms) by using the built in functions of SMSLib API,
[1] http://code.google.com/p/smslib/wiki/SMSLib_Groups
@Anonymous2: yes, You can use Huawei, Most of models are supported.
July 13, 2012 at 1:20 PM
Thanks a lot... It's working :) (SMS to multiple recipients)
July 13, 2012 at 1:35 PM
@Anonymous1: great!
July 14, 2012 at 10:07 AM
sir,
I tried to this programme in several times using HUWAWEI dongal,and some other types of dongals.But it indicate me,same error in every time,..sir can you tell me how slove this..
this is the error.
Exception in thread "main" org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
July 15, 2012 at 12:07 PM
I got an error called
Caused by: java.lang.RuntimeException: Uncompilable source code - package com.harshadura.gsm.smsdura does not exist
can you please help me.
July 16, 2012 at 7:23 PM
sir.
it is work for me..we send sms.thanks for it...
can you tell me how send MMS using this programme...
July 16, 2012 at 7:48 PM
Glad if I have helped some sorta!
No idea about MMS, I dont think so.
[1] http://smslib.org/doc/faq/
July 18, 2012 at 5:11 PM
hi harshadura,
first of all thank u for your amazaing effort !!
i did all steps but i got this error :
-------------------------------------------------------------
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
---------------------------------------------------------------------
how to solve this ?
thank u in advance :):)
July 18, 2012 at 5:36 PM
please read my previous comments. some person has asked the same question in previous before.
July 18, 2012 at 5:51 PM
i have Solve this problem nw :) :) thank u harshadura
iam sorry for disturbance :))
July 19, 2012 at 1:33 PM
cool =)
July 20, 2012 at 10:18 PM
I have created recipient list as below.
Service.getInstance().createGroup("SMSNumberList");
while (itr.hasNext()) {
Service.getInstance().addToGroup("SMSNumberList", itr.next());
}
how i can pass this list to gsmModem.Sender(String number, String msg); method.
Give me idea..
Thanks in Advance for you code.
July 26, 2012 at 6:15 PM
Hi Harshadura,,,i have imported the project in Netbeans & carried out all the steps as mentioned above.
It is showing an error on the statement
import com.harshadura.gsm.smsdura.GsmModem;
netbeans is not able to find the GsmModem class.
please tell an appropriate solution..
July 27, 2012 at 2:16 AM
just add the jar file to the library of your netbeans project in this case "smsdura-1.0.jar"
July 27, 2012 at 10:07 AM
July 27, 2012 at 10:13 AM
Sir,
Thank you so much i try this it's work
But I have a problem,
I Create a interface to send sms, but i can only send one sms using it,
I think that because the last line "Hit enter to continue" how can i solve
this?
please reply soon as possible.
thank again.
July 29, 2012 at 10:31 PM
Plz if someone can tell me how slove this..
org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
August 17, 2012 at 10:14 AM
hi harsha,
I downloaded the entire code.in that code u have send 2 class files i..e GsmModem and GsmModem$out..etc.i have decompile the two classes but iam getting compile time errors.Can u suggest me in that.before that i have copied the smsdura jar file into my class path,but it saying like cannot find the symbol of GsmModem,because of that i have extracted the jar file and i did all the things.but still it is giving error.please suggest me.
August 23, 2012 at 5:13 PM
Hi Harsha
i am using reliance netconnect+ data card . How to config from CDMA based device
Please help me
Thanks
Malar
September 10, 2012 at 3:51 PM
hi, i'm a students in java. i followed the instrunction but still get this error, "package com.harshadura.gsm.smsdura" not found.
please help me.
September 10, 2012 at 4:40 PM
hi sir,
i tried to run the program but i gate these warnings.
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: The GSM modem does not support the PDU protocol.
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:194)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
what should i do?
September 14, 2012 at 7:37 PM
Sir,
I'm a java Trainer, I'm doing a project using java to send and receive sms. I tried ur project But I got some errors. Could u please help me?.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: GSM Network Auto-Registration disabled!
at org.smslib.modem.AModemDriver.waitForNetworkRegistration(AModemDriver.java:444)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:168)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
September 15, 2012 at 8:39 PM
Tnakyou very much Genious!!!
Shankaultimate@gmail.com
+94774713454
September 16, 2012 at 8:54 PM
does smslib support to send sms long/concatenated?
i'v been trying, the PDU looks right, but got CMS ERROR 304, the message can't be sent.
September 18, 2012 at 8:48 PM
Hi!!! my code got stucked at the last line "Hit enter to continue". Can you please help to go to the rest of the code?
September 27, 2012 at 12:36 AM
Good !!! its working !!! Can this code be freely used for commercial purpose
September 27, 2012 at 2:36 AM
I am getting below errors ,how to solve it ?
Example: Send message from a serial gsm modem.
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
Version: 3.5.1
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.PortInUseException: Port currently owned by org.smslib
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
September 28, 2012 at 11:31 AM
Hi
Can you pls give me details of Mobile Hardware and Connection of Mobile with PC
October 5, 2012 at 8:21 AM
Dear Brother,
I am using Nokia N70 as GSM Modem.And I am getting the following error.
-----------------------------
*** SMS-DURA - GSM MODEM SMS API WRAPPER ***
www.harshadura.com
-----------------------------
Example: Send message from a serial gsm modem.
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
Version: 3.5.1
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I couldn't get help in any of the above comments.Can you help,what should I probably do to do it right.
October 5, 2012 at 8:54 AM
Any way thanks. I got it solved. Actually I have incorrectly entered my Port No.Now it worked and the output in the Netbeans console was(for other users who want to see how the output looks like):
-----------------------------
*** SMS-DURA - GSM MODEM SMS API WRAPPER ***
www.harshadura.com
-----------------------------
Example: Send message from a serial gsm modem.
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
Version: 3.5.1
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Modem Information:
Manufacturer: Nokia
Model: Nokia N70
Serial No: 358080011561115
SIM IMSI: ** MASKED **
Signal Level: -51 dBm
Battery Level: 35%
===============================================================================
<< OutboundMessage >>
-------------------------------------------------------------------------------
Gateway Id: modem.com1
Message Id: 0
Message UUID: c3936cb1-0e34-409b-aa63-c1ce2981c892
Encoding: 7-bit
Date: Fri Oct 05 08:59:50 NPT 2012
SMSC Ref No: 63
Recipient: +9779849152620
Dispatch Date: Fri Oct 05 09:00:15 NPT 2012
Message Status: SENT
Failure Cause: NO_ERROR
Validity Period (Hours): -1
Status Report: false
Source / Destination Ports: -1 / -1
Flash SMS: false
Text: Send from java.reply if u rx this
PDU data: D3B29B0C32CBDF6D903A6C0FBBE465383B0F4A9B4175901C0FA2A3D373
Scheduled Delivery: null
===============================================================================
Now Sleeping - Hit to terminate.
October 8, 2012 at 4:30 PM
How to find Modem port no in linux ?
October 9, 2012 at 1:31 PM
i am using huawie dongel, how to find COMPORT number in linux ? please reply soon.,and where to get .so file of JAVA COMM ?
October 9, 2012 at 7:52 PM
Code which was working on windows 7 is not working on linux os. what i need to change ...get NoSuchPortException using port number as /dev/ttyUSB0.
"org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException"
October 9, 2012 at 8:18 PM
Hi sorry, I think you need to find the exact port of your dongle first. (I dont know how to find the port in linux)
And it should work for linux as well since its using Java to handle stuff.
October 10, 2012 at 1:57 PM
i am getting this error... i am working on ubuntu
javax.faces.FacesException: #{noticeBean.send}: org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:90)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.faces.FacesException: #{noticeBean.send}: org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
... 18 more
Caused by: javax.faces.el.EvaluationException: org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
October 10, 2012 at 2:13 PM
As i am working on linux will i need to use below code ,or just user your GsmModem code
SerialModemGateway gateway = new SerialModemGateway("modem.com1", "/
dev/ttyUSB3", 115200, "", "");
October 10, 2012 at 3:55 PM
Sir,kindly make another blog for linux os,facing lot of difficulties
October 10, 2012 at 4:40 PM
Now i got it solved ,myself ,
===============================================================================
getting hanged at ...
Now Sleeping - Hit to terminate.
In my application even after hitting enter it is not getting terminated...
how can it be terminated automatically after once messages are sent
October 10, 2012 at 7:52 PM
I am trying to send 2nd message after first message is sent in my application,but i am getting this error "Cannot add gateway when service is running ...." ...i am not able to stop the service whats solution ?
October 11, 2012 at 4:41 PM
harshadura plz reply for above comment
December 18, 2012 at 3:10 PM
hello sir,
I have try to configure smsdura but always a hava these errors..
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
January 16, 2013 at 3:17 PM
im getting error in this line....
import com.harshadura.gsm.smsdura.GsmModem;
plz help
January 16, 2013 at 5:03 PM
-----------------------------
*** SMS-DURA - GSM MODEM SMS API WRAPPER ***
www.harshadura.com
-----------------------------
Example: Send message from a serial gsm modem.
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
Version: 3.5.1
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
y the above error??? sir plz help..
February 3, 2013 at 5:54 PM
I have been using your test wrapper to successfully send messages from my PC to another phone. I had tried, previously, to use SMSlib directly with no success. I would appreciate the source of your gsmModem class please. I have been unable to find the same on the internet even though you imply that it is open source.
Regards,
John
February 3, 2013 at 8:20 PM
hi John,
Here's the code you asked abt: https://gist.github.com/4702043
Just FYI: you can use A Decompiler tool to get the source of any JAR file Theres a tool called JDJUI [1], so after decompilation u can see the source code of any compiled JAR archive. (if the author hasn't obfuscated the code, you can see the actual java class files. cool huh)
in this case i havent obfuscated, so can simply see the original code without any hassle: "smsdura-1.0.jar" is the file u need to decompile.
[1] http://java.decompiler.free.fr/?q=jdgui
hope this helps.
February 4, 2013 at 8:44 PM
Thank you for your prompt response. I will get hold of JDGUI. It should prove very useful.
Regards,
John
March 8, 2013 at 12:45 PM
hi harshadura
i m trying to run the 'sendmessage.java' from smslib examples. my operating system is windows 7 64 bit ultimate. I m using RxTx for win7 64bit and I am getting following
org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:277)
can you plz help me to sort out ?
thanks
April 9, 2013 at 8:54 PM
Please help I got following error!
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: GSM Network Registration error!
at org.smslib.modem.AModemDriver.waitForNetworkRegistration(AModemDriver.java:457)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:168)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
May 7, 2013 at 1:19 PM
hey code is running great but how to send message to multiple recipient.
May 10, 2013 at 5:34 PM
hey i am able to run this code on netbeans but on eclipse it gives nosuchportexception would you please help to run this code on eclipse.
May 14, 2013 at 5:17 PM
hey its a great program but at end it doesn't terminate automatically is there a way to terminate it automatically without pressing the enter key.
May 18, 2013 at 7:14 AM
sir thnx for this code!nw i can send sms!gud luk!
May 29, 2013 at 12:37 PM
I am getting output on console......but unable to get it on mobile...
can you please tell me why is it so?
July 26, 2013 at 4:26 AM
I have this error when i run your program.. pls help
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
September 16, 2013 at 10:41 AM
Hello everyone,
this functionality is working fine but i got error as GATEWAY FAILURE. I think it is because length of the SMS to be sent,so i just want to know how to increase the length/size.
Thank you
September 16, 2013 at 7:33 PM
Hello,
does anyone know how to send in message special signs from other languages like German or Czech or French? Becouse when I try to send message with special signs in words, these words don't have any sign.
September 16, 2013 at 8:09 PM
I've found that http://sourceforge.net/tracker/index.php?func=detail&aid=1743367&group_id=164313&atid=831227
and in this new version of smslib authors corrected few errors associated with special signs. Unfortunetly adding it to project doesn't resolove the problem. I think maybe mr. harshadura can add this lib instead of old 3.5.1 to his own made smsdura-1.0.jar?
October 6, 2013 at 11:30 PM
Thanks for this article. Sir can you explain the code to receive a SMS.
October 7, 2013 at 1:09 PM
Please sir I really need it
October 8, 2013 at 8:22 PM
Hello Thanks for this.
Im only a newbie at java programming. And where is the part that i can edit that it will automatically close, even without pressing the enter key.
November 12, 2013 at 8:40 PM
November 15, 2013 at 10:48 AM
hey can i apply this code using textfield for 4n number and play as a Ok button? can u send me codes?
November 29, 2013 at 10:29 PM
run:
-----------------------------
*** SMS-DURA - GSM MODEM SMS API WRAPPER ***
www.harshadura.com
-----------------------------
Example: Send message from a serial gsm modem.
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.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Priority
Web Site: http://smslib.org
Version: 3.5.0
at org.smslib.Service.listSystemInformation(Service.java:113)
at org.smslib.Service.initializeService(Service.java:103)
at org.smslib.Service.(Service.java:95)
at org.smslib.Service.(Service.java:90)
at com.harshadura.gsm.smsdura.GsmModem.doIt(GsmModem.java:51)
at com.harshadura.gsm.smsdura.GsmModem.Sender(GsmModem.java:31)
at logic.TestSMS.main(TestSMS.java:23)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 7 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
when i run the file it shows the error hoe to solve this
January 17, 2014 at 11:21 PM
Hello all, I wanted to ask if anyone had a sample code to read the Incoming SMS saved in the modem's internal memory?
March 26, 2014 at 8:34 PM
when i try to import the project through eclipse IDE it says "No projects are found to import"?
April 12, 2014 at 12:48 PM
plz help...
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
July 25, 2014 at 1:21 PM
Hi, Thank you for your great topic. I tried to using your API and i sent SMS. But now i want to receive message from user to my phone. How can is do it with SMSLib?
August 5, 2014 at 10:30 PM
Thank sir
October 9, 2014 at 8:58 PM
i need help plez :( . why Message Status: FAILED??
Modem Information:
Manufacturer: QUANTA COMPUTER INCORPORATED
Model: 0
Serial No: 352593053423503
SIM IMSI: ** MASKED **
Signal Level: -71 dBm
Battery Level: 100%
===============================================================================
<< OutboundMessage >>
-------------------------------------------------------------------------------
Gateway Id: *
Message Id: 0
Message UUID: 197fb24b-746c-4f9f-8afc-35aea7b4a2d0
Encoding: 7-bit
Date: Thu Oct 09 17:53:47 AST 2014
SMSC Ref No: null
Recipient: +966595160009
Dispatch Date: null
Message Status: FAILED
Failure Cause: UNKNOWN
Validity Period (Hours): -1
Status Report: false
Source / Destination Ports: -1 / -1
Flash SMS: false
Text: hi
PDU data: 20741A04
Scheduled Delivery: null
===============================================================================
Now Sleeping - Hit to terminate.
BUILD SUCCESSFUL (total time: 4 minutes 57 seconds)
October 26, 2014 at 12:06 AM
How to get delivery status once message is delivered please any one can help me out
October 26, 2014 at 12:07 AM
How to get delivery status once message is delivered please any one can help me out
November 13, 2014 at 4:32 PM
how to found the modem pin number..? is it optional?
December 11, 2014 at 5:02 PM
Hy...
I tried with your code and it's working smoothly...
but when it send first message , the code running continuously..
how i stop the that after send first message
please help me........ i tried lot ......
January 26, 2015 at 11:11 PM
Yes it really works...I just downloaded the NetBeans 8.0.2 with java...installed...followed your steps carefully...As simple as it can get...No headaches...The SMS just went through!!!...Total time was about 30 mins MAX. Thanks
January 30, 2015 at 1:17 PM
Guys please help me i am getting following error
----------------------------
*** SMS-DURA - GSM MODEM SMS API WRAPPER ***
www.harshadura.com
-----------------------------
Example: Send message from a serial gsm modem.
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
Version: 3.5.1
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
February 3, 2015 at 8:49 PM
have any code for receive sms??
thank you
April 1, 2015 at 8:08 PM
April 4, 2015 at 8:14 PM
May 8, 2015 at 9:51 PM
How to read sms from usb modem ?...............please help
May 22, 2015 at 6:40 PM
I tried you java based solution to sent / read sms with Huawei USB Modem E3531 3G ,
but it's not working ?
Please could you please advice which port should i use (com1, com3 ? ..)
May 22, 2015 at 6:41 PM
there is specific java api for Huawei USB Modem decices models ?
July 20, 2015 at 8:02 PM
hi, thx for your work, i wonder if there's a way to send USSD request and receive its response please ?
September 15, 2015 at 12:40 PM
Same Instructions are working Properly in Windows 32 bit OS Systems. Thanks a lot.... Keep it up.
If any issues faced please clearly follow the configuration instructions given above... Definitely It will work.
November 23, 2015 at 10:02 PM
Hello
How to find the port number on Windows 10?
December 10, 2015 at 7:38 PM
if there is a version to 64bit ?? help
January 20, 2016 at 12:00 PM
thanx bro...........it works..
June 30, 2016 at 6:21 PM
sir a got this error please help me.
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102) at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
July 7, 2016 at 3:10 PM
Hi
I am getting this error and reading all comments again and again to shortout but getting
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Please Helip where i am doing wrong stuff
modem ----itegno
December 30, 2016 at 3:16 PM
meka wada karanne na machan
1=>com.harshadura.gsm.smsdura.GsmModem; meka kohennda denne
2=>cant load IA 32-bit on a AMD 64-bit platform
January 2, 2017 at 3:00 PM
huththo meka wada na
June 5, 2017 at 9:24 AM
Is this working for java1.8
July 16, 2017 at 5:26 PM
I am facing Gatway failure error .and tried everything to Short out but failed to do so kindly assist me over this.
Modem is itengo
System is 32 bit.
July 19, 2017 at 11:55 AM
Please help me over this struggling last one months
Example: Send message from a serial gsm modem.
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
Version: 3.5.3
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Modem Information:
Manufacturer: iWOW
Model: TR-800
Serial No: 355780003133947
SIM IMSI: ** MASKED **
Signal Level: -73 dBm
Battery Level: 0%
===============================================================================
<< OutboundMessage >>
-------------------------------------------------------------------------------
Gateway Id: *
Message Id: 0
Message UUID: 08baebe8-ca69-4d58-b6b8-8c5ee5722f7c
Encoding: 7-bit
Date: Mon Jul 17 16:05:57 IST 2017
SMSC Ref No:
Recipient: 918558939816
Dispatch Date: null
Message Status: FAILED
Failure Cause: GATEWAY_FAILURE
Validity Period (Hours): -1
Status Report: false
Source / Destination Ports: -1 / -1
Flash SMS: false
Text: Hello from SMSLib!
PDU data: C8329BFD0699E5EF3668DA9C32D3E210
Scheduled Delivery: null
February 8, 2018 at 11:48 AM
I am having this error, can you please anyone to help
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1
October 22, 2018 at 3:44 PM
Thanks for sharing. Are you looking for a way that enables SMS gateway services in your own software then must choose Bulk SMS API PHP of MsgClub company. Their APIs are highly secured and reliable in nature that enables clients to create, send and track campaign with an ease.
March 31, 2019 at 7:40 AM
Buenas noches. Amigos solucionaron el problema para enviar mensaje al Celular. Yo ya pude resoltar, PUDE COMUNICARME CON EL MODEM. ES UN HUAWEI DE OPERADORA MOVISTAR VENEZUELA. ESTOY PARA SERVIR. ESCRIBANME AL CORREO: antonyloza@gmail.com . Saludos
May 20, 2019 at 12:01 PM
Yeah!! Text messages that just contain simple text can be forgotten very easily. Instead of simply informing your customers regarding a certain promotion, you can easily show the product or the service to them by choosing to Send SMS Attachment.
August 17, 2019 at 5:07 PM
Thanks for sharing!!
Have a look JAVA sms
November 10, 2024 at 11:34 PM
Cool and I have a super supply: What Renovations Increase The Value Of A Home prefab home addition