Simple Java Mail program

Hi, i have written a simple code to send mail thru java... but it doesnt work... control never comes back after stepping in to the send function.. no exceptions.. no mails sent.. nothin.. cud someone hel me out??
sometimes i get this exception after a long time:
javax.mail.MessagingException: Exception reading response;
nested exception is:
     java.net.SocketException: Connection reset
     at com.sun.mail.smtp.SMTPTransport.readServerResponse(Unknown Source)
     at com.sun.mail.smtp.SMTPTransport.openServer(Unknown Source)
     at com.sun.mail.smtp.SMTPTransport.protocolConnect(Unknown Source)
     at javax.mail.Service.connect(Unknown Source)
here is the code snippet:
public void mySend() throws Throwable
Properties p = System.getProperties();
p.put("mail.transport.protocol", "smtp");
p.put("mail.smtp.host", "smtp.gmail.com");
p.put("mail.smtp.port", "465");
p.put("mail.smtp.starttls.enable", "true");
p.put("mail.smtp.auth", "true");
Authenticator authenticator = new Authenticator()
protected PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication("vicky.bhandari", "password");
Session session = Session.getInstance(p, authenticator);
SMTPMessage message = new SMTPMessage(session);
InternetAddress fromAddress = new InternetAddress("[email protected]");
InternetAddress toAddress = new InternetAddress("[email protected]");
message.setSubject("Test");
message.addRecipient(Message.RecipientType.TO, toAddress);
message.setFrom(fromAddress);
SMTPTransport.send(message);
Could someone please help me out??

Hey,
Im currently having problems with the code below:
public class SendMail {
     private static final String SMTP_HOST_NAME = "smtp.gmail.com";
     private static final String SMTP_AUTH_USER = "[email protected]";
     private static final String SMTP_AUTH_PWD = "**************";
     public void sendMail(String recipients[ ], String subject, String message , String from) throws MessagingException{
     boolean debug = false;
          Properties props = System.getProperties();
          props.put("mail.transport.protocol", "smtp");
          props.put("mail.smtp.host", SMTP_HOST_NAME);
          props.put("mail.smtp.port", "465");
          props.put("mail.smtp.starttls.enable", "true");
          props.put("mail.smtp.auth", "true");
          Authenticator auth = new SMTPAuthenticator();               
          Session session = Session.getDefaultInstance(props, auth);
          session.setDebug(debug);
          Message msg = new MimeMessage(session);
          InternetAddress addressFrom = new InternetAddress(from);
          msg.setFrom(addressFrom);
          InternetAddress[] addressTo = new InternetAddress[recipients.length];
     for (int i = 0; i < recipients.length; i++)
     addressTo[i] = new InternetAddress(recipients);
     msg.setRecipients(Message.RecipientType.TO, addressTo);
     msg.setSubject(subject);
     msg.setContent(message, "text/plain");
     Transport tr = session.getTransport("smtp");
     tr.connect(SMTP_HOST_NAME, SMTP_AUTH_USER, SMTP_AUTH_PWD);
     msg.saveChanges(); // don't forget this
     //tr.sendMessage(msg, msg.getAllRecipients());
     tr.close();
     tr.send(msg);
     public class SMTPAuthenticator extends Authenticator
     public PasswordAuthentication getPasswordAuthentication()
     String username = SMTP_AUTH_USER;
     String password = SMTP_AUTH_PWD;
     return new PasswordAuthentication(username, password);
the error i am receiving is:
java.lang.NoClassDefFoundError: javax/mail/Authenticator
     java.lang.Class.getDeclaredConstructors0(Native Method)
     java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
     java.lang.Class.getConstructor0(Unknown Source)
     java.lang.Class.newInstance0(Unknown Source)
     java.lang.Class.newInstance(Unknown Source)
     org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
     org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:292)
     org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:230)
     org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
     org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
If anyone has any ideas it will be much appreciated
Thanks in Advance
Andy

Similar Messages

  • Problem with Java Mail Program

    Hi Everyone...
    Please help me to sort out this problem...
    I am getting this Exception while executing the code pasted below...
    javax.mail.AuthenticationFailedException
    at javax.mail.Service.connect(Service.java:306)
    at javax.mail.Service.connect(Service.java:156)
    at javax.mail.Service.connect(Service.java:105)
    at javax.mail.Transport.send0(Transport.java:168)
    at javax.mail.Transport.send(Transport.java:98)
    at JDCSend.main(JDCSend.java:38)
    It's just a simple java program to send an email using JavaMail API
    import java.io.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.event.*;
    import javax.mail.internet.*;
    import java.util.Properties;
    public class JDCSend {
           public static void main (String args[]) {
              try{
                  String from = "[email protected]";
                  String to = "[email protected]";
                   String host = "smtp.yahoo.com";
        // Get system properties
                  Properties props = System.getProperties();
                   props.put("mail.smtp.host", host);
                   props.put("mail.smtp.port", 465);
                   props.put("mail.smtp.auth", "true");
                   props.put("mail.smtp.starttls.enable","true");
        // Get session
                  Session session = Session.getDefaultInstance(props, null);
        // Define message
                  MimeMessage message = new MimeMessage(session);
                  message.setFrom(new InternetAddress(from));
                  message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
                  message.setSubject("Hello, JDC");
                  message.setText("Welcome to the JDC");
        // Send message
                  Transport.send(message);
              catch(Exception e){ e.printStackTrace(); }
    }

    You need to be identified by stmp server :
    // Send message with authentication!
    Transport tr = session.getTransport("smtp");
    tr.connect(MailHost, user, pass);
    message.saveChanges(); // don't forget this
    tr.sendMessage(message, message.getAllRecipients());
    tr.close();
    Read JavaMail Faq please!

  • Java mail program

    Can anyone give me a complete seperate codes for sending mail, retreving a mail, and for mail attachements.
    If possible explain those codings also............ Because, i am new to this JAVA MAIl..........
    Plz,,,,,,, Help me soonnnnnnnnnnnnnnnn my frdsssssssssssssssssssssssssssssssssssssssssss

    What was wrong with all the sample programs included with JavaMail?
    You did find those, didn't you?
    And you read the JavaMail FAQ, right?

  • Java Mail Program - Please Help!

    Hi everyone, I am new to Java (been learnig for about 6 months) and I was hoping you could help me.
    I would like to write a program to be able to send and receive email (a basic version of outlook express), the prblem is that i have no idea on how to start such a program as i have only written programs such as calculators before.
    I was hoping someone could tell me how to begin such a challenging program, which java package is best to create such a program, Jbuilder or the normal javac compiler.
    Thanks everyone for your help

    See the Java mail API for more details (javax.mail if I remember well). This can be found at:
    http://java.sun.com/products/javamail/index.html
    Hope it helps,
    Stephane

  • Java mail program in java

    Hi,
    Can anybody suggest me the java code which sends mails using java mail api?
    Thanks & Regards,
    Karimulla

    Hi
    I have worked on it,so if you need code for the application,please write mail to me on my address [email protected]
    hopes u will get gud solution.
    cheers
    Sandy

  • Simple Java 3D program’s CPU Usage spikes to up to 90 percent!

    Hi, everyone. I’m completely new to Java 3D and I’m toying around with basic program structure right now. My code is based off of that in the first chapter on 3D in Killer Game Programming in Java. I removed most of the scene elements, replacing them with a simple grid, Maya style. (Yes, I’m starting off small, but my ambitions are grand – I intend on creating a polygonal modeling and animation toolset. After all, the Maya PLE is dead – damn you, Autodesk! – and I just plain dislike Blender.) I implement a simple OrbitBehavior as a means for the user to navigate the scene. That part was basically copy and paste from Andrew Davison’s code. The mystery, then, is why the program’s framerate drops below 1 FPS and its CPU Usage spikes to up to 90 percent, according to the Task Manager, when I tumble the scene. I’d appreciate anyone taking the time to look at the code and trying to identify the problem area. (I’ve undoubtedly missed something totally newbish. -.-) Thank you!
    (Also, I had the worst possible time wrestling with the posting process. Is anyone else having trouble editing their posts before submitting them?)
    import java.awt.*;
    import javax.swing.*;
    public class MAFrame
        public static final Dimension SCREEN_SIZE = Toolkit.getDefaultToolkit().getScreenSize();
        public MAFrame ()
            System.out.println("Initializing...");
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception e) {
                e.printStackTrace();
            JFrame frame = new JFrame ("Modeling and Animation");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            MAViewPanel panel = new MAViewPanel ();
            frame.getContentPane().add(panel);
            frame.pack();       
            frame.setLocation(((int)SCREEN_SIZE.getWidth() / 2) - (frame.getWidth() / 2),
                              ((int)SCREEN_SIZE.getHeight() / 2) - (frame.getHeight() / 2));     
            frame.setVisible(true);
    import com.sun.j3d.utils.behaviors.vp.*;
    import com.sun.j3d.utils.geometry.*;
    import com.sun.j3d.utils.universe.*;
    import java.awt.*;
    import javax.media.j3d.*;
    import javax.swing.*;
    import javax.vecmath.*;
    public class MAViewPanel extends JPanel
        public static final int GRID_SIZE = 12;
        public static final int GRID_SPACING = 4;
        public BoundingSphere bounds;
        public BranchGroup sceneBG;
        public SimpleUniverse su;
        public MAViewPanel ()
            GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
            Canvas3D canvas3D = new Canvas3D (config);               
            canvas3D.setSize(600, 600);
            add(canvas3D);
            canvas3D.setFocusable(true);
            canvas3D.requestFocus();
            su = new SimpleUniverse (canvas3D);
            createSceneGraph();
            initUserPosition();
            orbitControls(canvas3D);
            su.addBranchGraph(sceneBG);
        public void createSceneGraph ()
            sceneBG = new BranchGroup ();
            bounds = new BoundingSphere (new Point3d(0, 0, 0), 1000);
            // ambient light
            Color3f white = new Color3f (1.0f, 1.0f, 1.0f);
            AmbientLight ambientLight = new AmbientLight (white);
            ambientLight.setInfluencingBounds(bounds);
            sceneBG.addChild(ambientLight);
            // background
            Background background = new Background ();
            background.setColor(0.17f, 0.65f, 0.92f);
            background.setApplicationBounds(bounds);       
            sceneBG.addChild(background);
            // grid
            createGrid();
            sceneBG.compile();
        public void createGrid ()
            Shape3D grid = new Shape3D();
            LineArray lineArr = new LineArray (GRID_SIZE * 8 + 4, GeometryArray.COORDINATES);
            int offset = GRID_SIZE * GRID_SPACING;
            // both sides of the grid plus the middle, done for both directions at once (each line defined by two points)
            for (int count = 0, index = 0; count < GRID_SIZE * 2 + 1; count++) {
                // vertical, left to right
                lineArr.setCoordinate(index++, new Point3d (-offset + (count * GRID_SPACING), 0, offset));  // starts near
                lineArr.setCoordinate(index++, new Point3d (-offset + (count * GRID_SPACING), 0, -offset)); // ends far
                // horizontal, near to far
                lineArr.setCoordinate(index++, new Point3d (-offset, 0, offset - (count * GRID_SPACING))); // starts left
                lineArr.setCoordinate(index++, new Point3d (offset, 0, offset - (count * GRID_SPACING)));  // ends right
            grid.setGeometry(lineArr);
            sceneBG.addChild(grid);
        public void initUserPosition ()
            ViewingPlatform vp = su.getViewingPlatform();
            TransformGroup tg = vp.getViewPlatformTransform();
            Transform3D t3d = new Transform3D ();
            tg.getTransform(t3d);
            t3d.lookAt(new Point3d (0, 60, 80), new Point3d (0, 0, 0), new Vector3d(0, 1, 0));
            t3d.invert();
            tg.setTransform(t3d);
            su.getViewer().getView().setBackClipDistance(100);
        private void orbitControls (Canvas3D c)
            OrbitBehavior orbit = new OrbitBehavior (c, OrbitBehavior.REVERSE_ALL);
            orbit.setSchedulingBounds(bounds);
            ViewingPlatform vp = su.getViewingPlatform();
            vp.setViewPlatformBehavior(orbit);     
    }

    Huh. A simple call to View.setMinimumFrameCycleTime() fixed the problem. How odd that there effectively is no default maximum framerate. Of course simple programs like these, rendered as many times as possible every second, are going to consume all possible CPU usage...

  • How to run the simple java card program in eclipse?

    I am trying to run a simple HelloWorld program in eclipse 3.5 having java card development kit 2.2 installed in it.
    Firstly,I go to the JCWDE tab and press start..then when trying to deploy that package its giving me error like " com.hw.HelloWorld: unsupported class file format of version 50.0." can any one help me in this what is this error???n how to resolve n run this program..

    Hi,
    It is because the converter works on byte code and it only supports a subset of the Java language (see the JC specifications). It is kind of like compiling you code on Java 6 and trying to run it on Java 5. The JCDK outlines the required compiler version.
    Cheers,
    Shane

  • First Java Mail Program...some problems

    Hi Friends,
    I am new to JavaMail and i am trying to follow the following exercise:
    http://java.sun.com/developer/onlineTraining/JavaMail/exercises/MailSetup/
    I am using rogers high speed internet connection,so i enter the following:
    D:\JAVAWORLD\javamail1.3.2-src\src\share\classes\demo>java msgsend -o [email protected] -M smtp.broadband.rogers.com [email protected]
    To: [email protected]
    Subject: hi
    Welcome
    ^ZI get the following error:
    com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for hel
    p go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
            at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
    275)
            at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
            at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
            at javax.mail.Transport.send0(Transport.java:151)
            at javax.mail.Transport.send(Transport.java:80)
            at msgsend.main(msgsend.java:165)When i went to that yahoo link for help,there are no settings for command line.Please tell me how to accomplish this..friends

    Thanks Ananda,
    But i guess,i should be able to access the rogers smtp server,because i have them as my isp.Moreover,it works fine with my outlook too.I even tried to use a free smtp server called "dumbster",i downladed it but i dont know how to use it.If anyone has some idea,please let me know.
    Thanks

  • Assistance needed with simple java vocabulary program

    I need to construct a java program that can read in text documents. The program must then display an image and prompt the user to input the word that best-describes the image. If the user is incorrect, however, the program must tell the user how many letters the word has and what the first letter is.

    * @(#)words.java
    * @author
    * @version 1.00 2010/6/8
    import javax.swing.*; //class necessary for GUI
    import java.awt.*; //class necessary for GUI
    import java.awt.event.*; //class necessary for GUI
    import java.util.ArrayList; //import ArrayList class
    public class Words implements ActionListener { //ActionListener is required for the button to function
    //initialize values that will be used in other methods
    int noLetters = 0; //number of letters
    String[] words; //words
    JTextField textNL; //inputs number of letters
    ArrayList<JLabel> list;
    public static void main (String[] args) {
         Word s = new Word(); //this is so you are not referencing non-static methods from a static context (main must be static, but the constructor is not)
         s.go();} //runs following method as a method of the object Words s
    public void go() {
         //build GUI
              JFrame frame = new JFrame(); //intializes frame, this is essentially the GUI
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //sets program to stop when frame is exited
              JTabbedPane pane = new JTabbedPane(); //creates a new tabbed panel
              JPanel panel1 = new JPanel(); //creates input panel
              JPanel panel2 = new JPanel(); //creates output panel
              textNL = new JTextField("", 15); //initializes the text field of the same name from the beginning of the program
              JButton button = new JButton("Enter"); //This button will input the data you have entered into the text fields
              button.addActionListener(this); //tells the button to do stuff when it is clicked (see actionPerformed())
              panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); //Sets frame to display labels and text fields arranged vertically
              panel1.add(new JLabel("Number of Letters")); //this label tells you what the text field is prompting for
              panel1.add(textND); //adds text field to input panel
              panel1.add(BorderLayout.SOUTH, button); //adds button to input panel
              pane.add("Enter Data", panel1); //adds input panel to tabbed panel
              pane.add("Words", panel2); //adds output panel to tabbed panel
              frame.getContentPane().add(pane); //adds tabbed panel to frame
              frame.setSize(400, 400); //sets GUI intial dimensions
              frame.setVisible(true); //displays GUI
              //end of GUI build
    }

  • Simple Java Bank Program

    Can anyone please help?
    I am looking for a very simple client/server banking Java Application that performs basic function such as view account balance, and being able to deposit and withdraw money from the account.
    Any help would be much appreciated!

    You are asking for an application. I don't think anyone will ever start an open source banking system, because only banks will have an interest in them and they will develop their systems in-house.
    Sorry dude, but you'll have to switch on that brain of yours and do the work yourself.

  • Simple Java probablitity program?

    Could anyone type up a simple probability program?
    For example...
    a has a chance of being picked .44
    b has .22
    c has .30
    d has .04
    All added equals 1.00
    So, how would I print a string of 50 chars, a through d, with those probabilities/chances?

    javalavalamp wrote:
    Hell, the last time I ever posted was Sept...
    Profile: http://forums.sun.com/profile.jspa?userID=1052864
    I'm not talking about here, I'm talking about posting the same question in multiple forums. Again, this will frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread.
    So again, what other fora did you post this in?

  • Simple Java Network Programming Question

    import java.io.*;
    import java.net.*;
    public class ConsumerClient
         private static InetAddress host;
         private static final int PORT = 1234;
         private static Socket link;
         private static Resource item;
         private static BufferedReader in;
         private static PrintWriter out;
         private static BufferedReader keyboard;
         public static void main(String[] args)     throws IOException
              try
                   host = InetAddress.getLocalHost();
                   link = new Socket(host, PORT);
                   in = new BufferedReader(new InputStreamReader(link.getInputStream()));
                   out = new PrintWriter(link.getOutputStream(),true);
                   keyboard = new BufferedReader(new InputStreamReader(System.in));
                   String message, response;
                   do
                        System.out.print("Enter 1 for resource or 0 to quit: ");
                        message = keyboard.readLine();
         if(message.equals("1")**
                             item.takeOne();**
                        //Send message to server on
                        //the socket's output stream...
                        out.println(message);
                        //Accept response from server on
                        //the socket's input stream...
                        response = in.readLine();
                        //Display server's response to user...
                        System.out.println(response);
                   }while (!message.equals("0"));
              catch(UnknownHostException uhEx)
                   System.out.println("\nHost ID not found!\n");
              catch(IOException ioEx)
                   ioEx.printStackTrace();
              finally
                   try
                        if (link!=null)
                             System.out.println("Closing down connection...");
                             link.close();
                   catch(IOException ioEx)
                        ioEx.printStackTrace();
    }

    georgemc wrote:
    BlueNo yel-- Auuuuuuuugh!
    But the real question is: What is the air-speed velocity of an unladen swallow?

  • Implementing File Upload component + Java Mail

    Guys,
    Brief Intro : I have a form with some input fields. Upon submission of the form all the necessary information is submitted ro R/3 system and a mail is send to lets say administrators. I have Java Mail program for sending emails.
    My requirement : I want the users to give the FileUpload option in the form so that they can select the file and that file should be attached to email whcih I am sending upon form submission.
    Questions:
    1) How to check the path of the file where it gets uploaded.
    2) Does it get uploaded on the Server where I deploy my application.
    3) Any Solution/suggestion on how to implement the requirement stated above.
    Regards,
    <b>Chintan Virani.</b>

    Hi Chintan...
    File Uplaod UI Element is just to get the file path of the file from the client or presentation server i.e. our pc. Rest code to store the data is done in action of the upload button (not the browse button). So no file is formed automatically.
    Unless you write the code to read the file from the path selected, you cannot get the data bytes and unless you mention the path no file is made in the server.
    Better would be that you keep a file template in the mimes folder and at runtime you write to this file.
    The path of the file in the mimes folder is
    temp
    webdynpro
    web
    local
    <ProjectName>
    Components
    <Component Package>
    <File Name>
    This file can be attached to your mail as an attachement.
    Further reference...
    Re: how to create a file i mimes/ components folder
    Regards,
    Mahesh K.

  • Problem while executing simple java program

    Hi
    while trying to execute a simple java program,i am getting the following exception...
    please help me in this
    java program :import java.util.*;
    import java.util.logging.*;
    public class Jump implements Runnable{
        Hashtable activeQueues = new Hashtable();
        String dbURL, dbuser, dbpasswd, loggerDir;   
        int idleSleep;
        static Logger logger = Logger.getAnonymousLogger();      
        Thread myThread = null;
        JumpQueueManager manager = null;
        private final static String VERSION = "2.92";
          public Jump(String jdbcURL, String user, String pwd, int idleSleep, String logDir) {
            dbURL = jdbcURL;
            dbuser = user;
            dbpasswd = pwd;
            this.idleSleep = idleSleep;
            manager = new JumpQueueManager(dbURL, dbuser, dbpasswd);
            loggerDir = logDir;
            //preparing logger
            prepareLogger();
          private void prepareLogger(){      
            Handler hndl = new pl.com.sony.utils.SimpleLoggerHandler();
            try{
                String logFilePattern = loggerDir + java.io.File.separator + "jumplog%g.log";
                Handler filehndl = new java.util.logging.FileHandler(logFilePattern, JumpConstants.MAX_LOG_SIZE, JumpConstants.MAX_LOG_FILE_NUM);
                filehndl.setEncoding("UTF-8");
                filehndl.setLevel(Level.INFO);
                logger.addHandler(filehndl);
            catch(Exception e){
            logger.setLevel(Level.ALL);
            logger.setUseParentHandlers(false);
            logger.addHandler(hndl);
            logger.setLevel(Level.FINE);
            logger.info("LOGGING FACILITY IS READY !");
          private void processTask(QueueTask task){
            JumpProcessor proc = JumpProcessorGenerator.getProcessor(task);       
            if(proc==null){
                logger.severe("Unknown task type: " + task.getType());           
                return;
            proc.setJumpThread(myThread);
            proc.setLogger(logger);       
            proc.setJumpRef(this);
            task.setProcStart(new java.util.Date());
            setExecution(task, true);       
            new Thread(proc).start();       
         private void processQueue(){       
            //Endles loop for processing tasks from queue       
            QueueTask task = null;
            while(true){
                    try{
                        //null argument means: take first free, no matters which queue
                        do{
                            task = manager.getTask(activeQueues);
                            if(task!=null)
                                processTask(task);               
                        while(task!=null);
                    catch(Exception e){
                        logger.severe(e.getMessage());
                logger.fine("-------->Sleeping for " + idleSleep + " minutes...hzzzzzz (Active queues:"+ activeQueues.size()+")");
                try{
                    if(!myThread.interrupted())
                        myThread.sleep(60*1000*idleSleep);
                catch(InterruptedException e){
                    logger.fine("-------->Wakeing up !!!");
            }//while       
        public void setMyThread(Thread t){
            myThread = t;
        /** This method is only used to start Jump as a separate thread this is
         *usefull to allow jump to access its own thread to sleep wait and synchronize
         *If you just start ProcessQueue from main method it is not possible to
         *use methods like Thread.sleep becouse object is not owner of current thread.
        public void run() {
            processQueue();
        /** This is just another facade to hide database access from another classes*/
        public void updateOraTaskStatus(QueueTask task, boolean success){
            try{         
                manager.updateOraTaskStatus(task, success);
            catch(Exception e){
                logger.severe("Cannot update status of task table for task:" + task.getID() +  "\nReason: " + e.getMessage());       
        /** This is facade to JumpQueueManager method with same name to hide
         *existance of database and SQLExceptions from processor classes
         *Processor class calls this method to execute stored proc and it doesn't
         *take care about any SQL related issues including exceptions
        public void executeStoredProc(String proc) throws Exception{
            try{
                manager.executeStoredProc(proc);
            catch(Exception e){
                //logger.severe("Cannot execute stored procedure:"+ proc + "\nReason: " + e.getMessage());       
                throw e;
         *This method is only to hide QueueManager object from access from JumpProcessors
         *It handles exceptions and datbase connecting/disconnecting and is called from
         *JumpProceesor thread.
        public  void updateTaskStatus(int taskID, int status){       
            try{
                manager.updateTaskStatus(taskID, status);
            catch(Exception e){
                logger.severe("Cannot update status of task: " + taskID + " to " + status + "\nReason: " + e.getMessage());
        public java.sql.Connection getDBConnection(){
            try{
                return manager.getNewConnection();
            catch(Exception e){
                logger.severe("Cannot acquire new database connection: " + e.getMessage());
                return null;
        protected synchronized void setExecution(QueueTask task, boolean active){
            if(active){
                activeQueues.put(new Integer(task.getQueueNum()), JumpConstants.TH_STAT_BUSY);
            else{
                activeQueues.remove(new Integer(task.getQueueNum()));
        public static void main(String[] args){
                 try{
             System.out.println("The length-->"+args.length);
            System.out.println("It's " + new java.util.Date() + " now, have a good time.");
            if(args.length<5){
                System.out.println("More parameters needed:");
                System.out.println("1 - JDBC strign, 2 - DB User, 3 - DB Password, 4 - sleeping time (minutes), 5 - log file dir");
                return;
            Jump jump = new Jump(args[0], args[1], args[2], Integer.parseInt(args[3]), args[4]);
            Thread t1= new Thread(jump);
            jump.setMyThread(t1);      
            t1.start();}
                 catch(Exception e){
                      e.printStackTrace();
    } The exception i am getting is
    java.lang.NoClassDefFoundError: jdbc:oracle:thin:@localhost:1521:xe
    Exception in thread "main" ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
    JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [../../../src/share/back/util.c:820] Please help me.....
    Thanks in advance.....sathya

    I am not willing to wade through the code, but this portion makes me conjecture your using an Oracle connect string instead of a class name.
    java.lang.NoClassDefFoundError: jdbc:oracle:thin:@localhost:1521:xe

  • How to compile a simple "Hello World" program in Java by using Netbeans

    Hi all, I am very new to java programming arena. i am trying to learn the most demanding language for the time being. To program, i always use IDE's as it makes programming experience much easier by underline the syntax errors or sometimes showing codehint. However, I am facing some problem when i use Netbeabs to compile a simple "Hello world" program. my problem is whenever i write the code and press compile button, netbeans says "main class not found". Consequently,i am becoming frustated. So, i am here in this forum to get some kind help on How i can compile java programs in Netbeans. Please help me out, otherwise i may lose my enthusiasm in Java. please help me, i m stuck

    Go to http://www.netbeans.org/
    You should find tutorials there.

Maybe you are looking for

  • I did the update and now cant open itunes i get a error 7  windows error 198

    I did the update and now itunes wont open...I get a windows error 7 (windows error 198)  HELP

  • Problem with 0Date

    Hi Experts, Data came to PSA, in PSA it is showing error as below. Value with 000 of charecteristic 0Date is not a number with space. In this I am not using 0Date. Char. Please help me. Thanks in Advance.

  • I2C USB 8451 ADS1100 read result incorrect

    Hi, I have connected ADS1100 (http://www.ti.com/lit/ds/symlink/ads1100.pdf) to measure the temperature sensor output voltage of LMP91000 (http://www.ti.com/lit/ds/symlink/lmp91000.pdf). In LMP91000, I have write 0x7 to switch the MODECN to TIA ON mod

  • Intercepting OS's Sound Output

    I am developing a desktop 'widget' system in java, and one of the widgets I plan to develop is a simple sound visualization display, similar to those found in many media players except that it would display any sound the OS outputs. However, I am str

  • Error installing SQL 2005 SP4

    Hi Guys, When i am installing SQL 2005 SP4 in windows 2008r2 cluster i get following error message "your account information could not be verified. Press OK to return to Authentication Mode screen to determine reason for failure.For setup to verify y