aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Problem related smslib api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Problem related smslib api" Watch "Problem related smslib api" New topic
Author

Problem related smslib api

mayank pandey
Greenhorn

Joined: Nov 24, 2011
Posts: 5
I am trying to send sms using smslib api using the example in it. but its giveing me below error. I think its basically because smslib is not coorectly installed in my eclipse because i cant find anywhere how to instal in an IDE like eclipse. Could anyone tell me how to do it?? thkns in advance.. n btw this is the error..
.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.2
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jre6\bin\awt.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at sun.security.action.LoadLibraryAction.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Unknown Source)
at java.awt.Toolkit.<clinit>(Unknown Source)
at java.awt.Color.<clinit>(Unknown Source)
at org.apache.log4j.lf5.LogLevel.<clinit>(LogLevel.java:95)
at org.apache.log4j.lf5.LF5Appender.getDefaultInstance(LF5Appender.java:207)
at org.apache.log4j.lf5.LF5Appender.<init>(LF5Appender.java:68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:336)
at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:123)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:752)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at org.smslib.helper.Logger.<init>(Logger.java:49)
at org.smslib.helper.Logger.<clinit>(Logger.java:29)
at org.smslib.Service.listSystemInformation(Service.java:113)
at org.smslib.Service.initializeService(Service.java:103)
at org.smslib.Service.<init>(Service.java:95)
at org.smslib.Service.<clinit>(Service.java:90)
at in.msgin.SendSMS.doIt(SendSMS.java:35)
at in.msgin.SendSMS.main(SendSMS.java:80)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

You are making a common beginner mistake. Because you are writing a program which uses a feature which you don't quite understand yet, you assume that the problem you are having must have something to do with that feature.

And that assumption makes you look in the wrong place for the problem. Let's have a look at the stack trace which you posted, reading from the bottom up:

at in.msgin.SendSMS.doIt(SendSMS.java:35)


This is your code calling the "doIt" method.

at org.smslib.helper.Logger.<clinit>(Logger.java:29)


This method calls some things which load the Logger class, also part of the smslib package.

at org.apache.log4j.Logger.getLogger(Logger.java:104)


... which in turn tries to get a Logger which is part of log4j. Going farther down the stack (which is farther up in the printed version)...

at org.apache.log4j.lf5.LogLevel.<clinit>(LogLevel.java:95)


The log4j initialization is trying to load a LogLevel.

at java.awt.Color.<clinit>(Unknown Source)


And to do that it tries to load the java.awt.Color class.

Now, if you thought your problem was something to do with SMS, you wouldn't notice that. But if you just try to read the stack trace and find out what the problem was, you would have to ask yourself why log4j would need to be using a Color object as a log level. And then you would go and look at your log4j configuration to see what was up with that.








mayank pandey
Greenhorn

Joined: Nov 24, 2011
Posts: 5
yes you are right n thanks for help. Resolved. But Now i am stuck with another prblm. It couldnt identify the port but when I am running with rxtx.it establish serial communication. this is what its showing..

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.2
dada
1 2012-06-24 01:50:08,764 [main] INFO org.smslib.Service - 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
9 2012-06-24 01:50:08,772 [main] INFO org.smslib.Service - Version: 3.5.2
10 2012-06-24 01:50:08,773 [main] INFO org.smslib.Service - JRE Version: 1.6.0_21
16 2012-06-24 01:50:08,779 [main] INFO org.smslib.Service - JRE Impl Version: 17.0-b17
16 2012-06-24 01:50:08,779 [main] INFO org.smslib.Service - O/S: Windows 7 / x86 / 6.1
24 2012-06-24 01:50:08,787 [main] DEBUG org.smslib.threading.AServiceThread - Initialized.
28 2012-06-24 01:50:08,791 [main] INFO org.smslib.queues.DefaultQueueManager - Queue directory not defined. Queued messages will not be saved to filesystem.
29 2012-06-24 01:50:08,792 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread - Running...
29 2012-06-24 01:50:08,792 [NotifyQueueManager] DEBUG org.smslib.notify.NotifyQueueManager$NotificationQueueManager - NotifyQueueManager running...
30 2012-06-24 01:50:08,793 [main] DEBUG org.smslib.threading.AServiceThread - Initialized.
31 2012-06-24 01:50:08,794 [DelayQueueManager] DEBUG org.smslib.threading.AServiceThread - Running...
32 2012-06-24 01:50:08,795 [DelayQueueManager] DEBUG org.smslib.queues.AbstractQueueManager$DelayQueueManager - DelayQueueManager running...
32 2012-06-24 01:50:08,795 [main] DEBUG org.smslib.threading.AServiceThread - Initialized.
37 2012-06-24 01:50:08,800 [Thread-4] INFO org.smslib.modem.ModemGateway - GTW: modem.com1: Starting gateway, using Generic AT Handler.
37 2012-06-24 01:50:08,800 [Thread-4] INFO org.smslib.modem.SerialModemDriver - GTW: modem.com1: Opening: COM21 @9600
41 2012-06-24 01:50:08,804 [WatchDog] DEBUG org.smslib.threading.AServiceThread - Running...
69 2012-06-24 01:50:08,832 [Thread-4] INFO org.smslib.modem.SerialModemDriver - GTW: modem.com1: Closing: COM21 @9600
1038 2012-06-24 01:50:09,801 [NotifyQueueManager] DEBUG org.smslib.notify.NotifyQueueManager$NotificationQueueManager - NotifyQueueManager end...
1038 2012-06-24 01:50:09,801 [DelayQueueManager] DEBUG org.smslib.queues.AbstractQueueManager$DelayQueueManager - DelayQueueManager end...
1138 2012-06-24 01:50:09,901 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread - Running...
1138 2012-06-24 01:50:09,901 [NotifyQueueManager] DEBUG org.smslib.notify.NotifyQueueManager$NotificationQueueManager - NotifyQueueManager running...
1238 2012-06-24 01:50:10,001 [WatchDog] DEBUG org.smslib.threading.AServiceThread - Stopped.
1238 2012-06-24 01:50:10,001 [main] INFO org.smslib.modem.ModemGateway - GTW: modem.com1: Stopping gateway...
1239 2012-06-24 01:50:10,002 [main] INFO org.smslib.modem.SerialModemDriver - GTW: modem.com1: Closing: COM21 @9600
1239 2012-06-24 01:50:10,002 [main] INFO org.smslib.modem.ModemGateway - GTW: modem.com1: Gateway stopped.
1240 2012-06-24 01:50:10,003 [NotifyQueueManager] DEBUG org.smslib.notify.NotifyQueueManager$NotificationQueueManager - NotifyQueueManager end...
1340 2012-06-24 01:50:10,103 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread - Running...
1340 2012-06-24 01:50:10,103 [NotifyQueueManager] DEBUG org.smslib.notify.NotifyQueueManager$NotificationQueueManager - NotifyQueueManager running...
1341 2012-06-24 01:50:10,104 [NotifyQueueManager] DEBUG org.smslib.notify.NotifyQueueManager$NotificationQueueManager - NotifyQueueManager end...
1439 2012-06-24 01:50:10,202 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread - Stopped.
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)
 
Don't get me started about those stupid light bulbs.
 
subject: Problem related smslib api