Hi Petein,
I believe your use of the JavaMail API may be conflicting with the one
provided in the AppEngine environment. From the hosted mode error log you
posted, I noticed that you're running your application in hosted mode with
the AppEngine DevServer. I'm guessing that you created your project with the
Google Eclipse Plugin as a new Web Application Project. If that's the case,
the AppEngine feature is checked on that project, and hosted mode will try
to use

I noticed that you're using the AppEngine DevServer in your hosted mode
launch. You're likely using the Google Eclipse Plugin and created your
project as a Web Application Project. If that's the case, and you want to
use the AppEngine DevServer, you should remove any conflicting JARs that you
would normally use for the Mail API as they are already provided by the
DevServer. If you don't want to use the AppEngine DevServer, uncheck the
AppEngine feature on your project (right-click on your project > Google >
App Engine Settings... > Uncheck the "Use AppEngine" box > Click OK).

I believe the embedded hosted mode Jetty server should be able to handle the
JavaMail libraries that you're using in other Java projects. If this isn't
the case, please feel free to report the errors here, as these could be due
to misconfigured libraries, or might indicate that you need to use hosted
mode with the -noserver option (see link below for details).

How do I use my own server in hosted mode instead of GWT's built-in Jetty
instance?:
http://code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT's

<http://code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT's>Hope
that helps,
-Sumit Chandel

On Mon, Jul 20, 2009 at 4:07 PM, Petein <[email protected]> wrote:

>
> this code works fine when i have a java app. I do have the mail.jar in
> my path. Any ideas?
>
> On Jul 20, 3:27 pm, "Donald W. Long" <[email protected]> wrote:
> > Do you have the jar for gmail in your path?
> >
> > On Jul 19, 7:52 am, Petein <[email protected]> wrote:
> >
> > > Hi. I made an RPC for sending an email
> >
> > > this is the Impl file:
> >
> > > package faceRecognition.server;
> >
> > > import com.google.gwt.user.server.rpc.RemoteServiceServlet;
> >
> > > import faceRecognition.client.EmailService;
> > > import faceRecognition.server.Email.SendMail.Gmail;
> >
> > > @SuppressWarnings("serial")
> > > public class EmailServiceImpl extends RemoteServiceServlet implements
> > >                 EmailService {
> >
> > >         @Override
> > >         public String send(String emailTo, String subject, String body)
> {
> >
> > >                 String msg = "";
> >
> > >                 msg = Gmail.send("this", emailTo, subject, body);
> >
> > >                 return(msg);
> >
> > >         }
> >
> > > }
> >
> > > when i commented out the line "msg = Gmail.send("this", emailTo,
> > > subject, body);"
> >
> > > everything is ok. the problem is in the method Gmail.send:
> >
> > > package faceRecognition.server.Email.SendMail;
> >
> > > import java.security.Security;
> > > import java.util.Properties;
> > > import javax.mail.*;
> > > import javax.mail.internet.*;
> >
> > > public class Gmail {
> >
> > >     private static final String SMTP_HOST_NAME = "smtp.gmail.com";
> > >     private static final String SMTP_PORT = "465";
> > >     private static final String SSL_FACTORY =
> > > "javax.net.ssl.SSLSocketFactory";
> >
> > >     public static String send(String emailFromAddress, String sendTo,
> > > String subject, String body){
> >
> > >         Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider
> > > ());
> >
> > >         String[] emails = new String[1];
> > >         emails[0] = sendTo;
> > >         try {
> > >             sendSSLMessage("[email protected]", "password", emails,
> > > subject,
> > >                     body, emailFromAddress);
> > >             return("");
> > >         }catch  (Exception e) {
> > >             e.printStackTrace();
> > >            return(e.getMessage());
> > >         }
> >
> > >     }
> >
> > >     private static void sendSSLMessage(final String username, final
> > > String password, String recipients[], String subject,
> > >             String message, String from) throws MessagingException {
> > >         boolean debug = true;
> >
> > >         Properties props = new Properties();
> > >         props.put("mail.smtp.host", SMTP_HOST_NAME);
> > >         props.put("mail.smtp.auth", "true");
> > >         props.put("mail.debug", "true");
> > >         props.put("mail.smtp.port", SMTP_PORT);
> > >         props.put("mail.smtp.socketFactory.port", SMTP_PORT);
> > >         props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
> > >         props.put("mail.smtp.socketFactory.fallback", "false");
> >
> > >         Session session = Session.getDefaultInstance(props,
> > >                 new javax.mail.Authenticator() {
> >
> > >                     @Override
> > >                     protected PasswordAuthentication
> > > getPasswordAuthentication() {
> > >                         return new PasswordAuthentication(username,
> > > password);
> > >                     }
> > >                 });
> >
> > >         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[i]);
> > >         }
> > >         msg.setRecipients(Message.RecipientType.TO, addressTo);
> >
> > >         // Setting the Subject and Content Type
> > >         msg.setSubject(subject);
> > >         msg.setContent(message, "text/html");
> > >         //Transport.send(msg);
> >
> > >         javax.mail.Transport.send(msg); //HERE I GET THE FOLLOWING
> > > ERROR
> > >     }
> >
> > > }
> >
> > > The error which i get is:
> >
> > > DEBUG: getProvider() returning javax.mail.Provider
> > > [TRANSPORT,gm,com.google.appengine.api.mail.stdimpl.GMTransport]
> > > com.google.apphosting.api.ApiProxy$CallNotFoundException: The API
> > > package 'mail' or call 'Send()' was not found.
> > >         at
> com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:70)
> > >         at com.google.appengine.api.mail.MailServiceImpl.doSend
> > > (MailServiceImpl.java:96)
> > >         at com.google.appengine.api.mail.MailServiceImpl.send
> > > (MailServiceImpl.java:33)
> > >         at
> com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage
> > > (GMTransport.java:247)
> > >         at javax.mail.Transport.send0(Transport.java:191)
> > >         at javax.mail.Transport.send(Transport.java:120)
> > >         at faceRecognition.server.Email.SendMail.Gmail.sendSSLMessage
> > > (Gmail.java:75)
> > >         at
> faceRecognition.server.Email.SendMail.Gmail.send(Gmail.java:26)
> > >         at
> faceRecognition.server.EmailServiceImpl.send(EmailServiceImpl.java:
> > > 17)
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke
> > > (NativeMethodAccessorImpl.java:39)
> > >         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > > (DelegatingMethodAccessorImpl.java:25)
> > >         at java.lang.reflect.Method.invoke(Method.java:597)
> > >         at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
> > > (RPC.java:527)
> > >         at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
> > > (RemoteServiceServlet.java:166)
> > >         at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
> > > (RemoteServiceServlet.java:86)
> > >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> > >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > >         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > > 487)
> > >         at org.mortbay.jetty.servlet.ServletHandler.handle
> > > (ServletHandler.java:362)
> > >         at org.mortbay.jetty.security.SecurityHandler.handle
> > > (SecurityHandler.java:216)
> > >         at org.mortbay.jetty.servlet.SessionHandler.handle
> > > (SessionHandler.java:181)
> > >         at org.mortbay.jetty.handler.ContextHandler.handle
> > > (ContextHandler.java:729)
> > >         at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > > 405)
> > >         at org.mortbay.jetty.handler.HandlerWrapper.handle
> > > (HandlerWrapper.java:152)
> > >         at org.mortbay.jetty.handler.RequestLogHandler.handle
> > > (RequestLogHandler.java:49)
> > >         at org.mortbay.jetty.handler.HandlerWrapper.handle
> > > (HandlerWrapper.java:152)
> > >         at org.mortbay.jetty.Server.handle(Server.java:324)
> > >         at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > > 505)
> > >         at org.mortbay.jetty.HttpConnection$RequestHandler.content
> > > (HttpConnection.java:843)
> > >         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
> > >         at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> > >         at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> > >         at org.mortbay.io.nio.SelectChannelEndPoint.run
> > > (SelectChannelEndPoint.java:395)
> > >         at org.mortbay.thread.QueuedThreadPool$PoolThread.run
> > > (QueuedThreadPool.java:488)
> >
> > > What is going on? This code sends email fine when i have it in my
> > > desktop app. Here this exception occurs. Any ideas?
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to