>From what I can understand, you haven't install the log4j jar file.
Please review the installation instructions again.

On Sep 3, 6:01 pm, Ruchi <[email protected]> wrote:
> Hiii everyone,
>
> I'm a beginner to smslib. I tried this and followed the instructions.
> Using the netbeans IDE attaching the libraries and tried to use this
> example. but it throws an exception in the following code snippet.
>
> srv = new Service();
>
> this is my code....
>
> package smstest;
>
> /**
>  *
>  * @author Ruchintha
>  */
>
> import org.smslib.IOutboundMessageNotification;
> import org.smslib.Library;
> import org.smslib.OutboundMessage;
> import org.smslib.Service;
> import org.smslib.modem.SerialModemGateway;
>
> public class SendMessage
> {
>
>             public void doIt() throws Exception
>         {
>                 Service srv;
>                 OutboundMessage msg;
>                 OutboundNotification outboundNotification = new 
> OutboundNotification
> ();
>                 System.out.println("Example: Send message from a serial gsm
> modem.");
>                 System.out.println(Library.getLibraryDescription());
>                 System.out.println("Version: " + Library.getLibraryVersion());
>
>                 srv = new Service();
>                 SerialModemGateway gateway = new 
> SerialModemGateway("modem.com1",
> "COM7", 57600, "SonyErricsson", "W800i");
>                 gateway.setInbound(true);
>                 gateway.setOutbound(true);
>                 //gateway.setSimPin("0000");
>                 srv.setOutboundNotification(outboundNotification);
>                 srv.addGateway(gateway);
>                 srv.startService();
>                 System.out.println();
>                 System.out.println("Modem Information:");
>                 System.out.println("  Manufacturer: " + 
> gateway.getManufacturer());
>                 System.out.println("  Model: " + gateway.getModel());
>                 System.out.println("  Serial No: " + gateway.getSerialNo());
>                 System.out.println("  SIM IMSI: " + gateway.getImsi());
>                 System.out.println("  Signal Level: " + 
> gateway.getSignalLevel() +
> "%");
>                 System.out.println("  Battery Level: " + 
> gateway.getBatteryLevel() +
> "%");
>                 System.out.println();
>                 // Send a message synchronously.
>                 //msg = new OutboundMessage("+306948494037", "Hello from 
> SMSLib!");
>                 //srv.sendMessage(msg);
>                 //System.out.println(msg);
>                 System.out.println("Now Sleeping - Hit <enter> to 
> terminate.");
>                 System.in.read();
>                 srv.stopService();
>         }
>
>         public class OutboundNotification implements
> IOutboundMessageNotification
>         {
>                 public void process(String gatewayId, OutboundMessage msg)
>                 {
>                         System.out.println("Outbound handler called from 
> Gateway: " +
> gatewayId);
>                         System.out.println(msg);
>                 }
>         }
>
>         public static void main(String args[])
>         {
>                 SendMessage app = new SendMessage();
>                 try
>                 {
>                         app.doIt();
>                 }
>                 catch (Exception e)
>                 {
>                         e.printStackTrace();
>                 }
>         }
>
> }
>
> but it throws this exception when i execute....
>
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
> log4j/Level
>         at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:
> 189)
>         at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
>         at org.slf4j.LoggerFactory.performInitialization
> (LoggerFactory.java:105)
>         at org.slf4j.LoggerFactory.getILoggerFactory
> (LoggerFactory.java:235)
>         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
>         at org.smslib.helper.Logger.<init>(Logger.java:34)
>         at org.smslib.Service.<init>(Service.java:93)
>         at smstest.SendMessage.doIt(SendMessage.java:31)
>         at smstest.SendMessage.main(SendMessage.java:83)
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:
> 229)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
> 320)
>         ... 9 more
> Java Result: 1
>
> Please someone help me out to figure this out
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to