8 Replies Latest reply on Jan 5, 2010 5:38 PM by 843834

    Not loading resource: /META-INF/javamail.default.providers error

    843830
      Hello,

      This is the code I have for sending an email:

      ******************************************************
      public void sendEmail1()
      {
      System.out.println("HERE in SendMai1**1*******************");
      // SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
      String to = "jyoshi@pinnacle.com.my";
      String from = "jyoshi@pinnacle.com.my";
      // SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
      // String host = "smtp.yourisp.net";
      String host = "localhost";
      //host = "202.190.202.17";
      //host="mail.yahoo.com.sg";

      // Create properties, get Session
      Properties props = new Properties();
      System.out.println("HERE in SendMai1**2*******************");
      // If using static Transport.send(),
      // need to specify which host to send it to
      System.out.println("********HOST******" + host);
      props.put("mail.smtp.host", host);
      // To see what is going on behind the scene
      props.put("mail.debug", "true");
      Session session = Session.getInstance(props,null);
      session.setDebug(true);
      System.out.println("HERE in SendMai1**3*******************");
      try {
      // Instantiatee a message
      System.out.println("HERE in SendMai1**4*******************");
      Message msg = new MimeMessage(session);
      System.out.println("HERE in SendMai1**5*******************");
      //Set message attributes
      msg.setFrom(new InternetAddress(from));
      InternetAddress[] address = {new InternetAddress(to)};
      msg.setRecipients(Message.RecipientType.TO, address);
      msg.setSubject("Test E-Mail through Java from Parcvista ");
      msg.setSentDate(new Date());

      // Set message content
      msg.setText("This is a test of sending a " +
      "plain text e-mail through Java.\n" +
      "Here is line 2. Hi wats doing");

      //Send the message
      Transport.send(msg);
      }
      catch (MessagingException mex) {
      // Prints all nested (chained) exceptions as well
      mex.printStackTrace();
      }

      }

      *****************************************************

      This is the output from catalina.out file
      *****************************************************
      HERE in SendMai1**1*******************
      HERE in SendMai1**2*******************
      ********HOST******localhost
      DEBUG: JavaMail version 1.3.2ea
      DEBUG: java.io.FileNotFoundException: /usr/java/j2sdk1.4.2/jre/lib/javamail.providers (No such file or directory)
      DEBUG: URL jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/smtp.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded resource: jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/smtp.jar!/META-INF/javamail.providers
      DEBUG: URL jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/pop3.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded resource: jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/pop3.jar!/META-INF/javamail.providers
      DEBUG: URL jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/imap.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded resource: jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/imap.jar!/META-INF/javamail.providers
      DEBUG: URL jar:file:/opt/jakarta-tomcat-5.0.19/common/lib/imap.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded resource: jar:file:/opt/jakarta-tomcat-5.0.19/common/lib/imap.jar!/META-INF/javamail.providers
      DEBUG: URL jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/imap.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded resource: jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/imap.jar!/META-INF/javamail.providers
      DEBUG: URL jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/pop3.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded resource: jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/pop3.jar!/META-INF/javamail.providers
      DEBUG: URL jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/smtp.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded resource: jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/smtp.jar!/META-INF/javamail.providers
      DEBUG: not loading resource: /META-INF/javamail.default.providers
      DEBUG: Tables of loaded providers
      DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc]}
      DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
      DEBUG: not loading resource: /META-INF/javamail.default.address.map
      DEBUG: URL jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/smtp.jar!/META-INF/javamail.address.map
      DEBUG: successfully loaded resource: jar:file:/usr/java/j2sdk1.4.2/jre/lib/ext/smtp.jar!/META-INF/javamail.address.map
      DEBUG: URL jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/smtp.jar!/META-INF/javamail.address.map
      DEBUG: successfully loaded resource: jar:file:/opt/jakarta-tomcat-5.0.19/webapps/mmknn9/WEB-INF/lib/smtp.jar!/META-INF/javamail.address.map
      DEBUG: java.io.FileNotFoundException: /usr/java/j2sdk1.4.2/jre/lib/javamail.address.map (No such file or directory)
      DEBUG: setDebug: JavaMail version 1.3.2ea
      HERE in SendMai1**3*******************
      HERE in SendMai1**4*******************
      ********************************************************

      This is the error display in the browser
      ************************************************************
      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: javax/activation/DataSource
           org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
           org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
           org.apache.jsp.sm.CRMailUsers_jsp._jspService(CRMailUsers_jsp.java:807)
           org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
           org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
           org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
           org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


      root cause

      java.lang.NoClassDefFoundError: javax/activation/DataSource
           com.pinnacle.mmknv2.utils.Email.sendEmail1(Email.java:74)
           org.apache.jsp.sm.CRMailUsers_jsp._jspService(CRMailUsers_jsp.java:433)
           org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
           org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
           org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
           org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


      note The full stack trace of the root cause is available in the Tomcat logs.


      ****************************************************************

      Can anybody pls help me to resolve this error

      Thnx in advance,
      Sagar