Hey guys, I am coding a simple gae webapp that should send me an email from a form:
I have coded that gae code: index.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>A form</title> </head> <body> <form action="/feedback" method="post"> <!-- Simple text field --> <label for="name">Name </label> <input type="text" name="name"/> <br/> <!-- Email --> <label for="email">Email </label> <input type="email" name="email"/> <br/> <!-- Textarea --> <label for="description">Description </label> <textarea name="description" cols="50" rows="5">Type your comment here </textarea> <br/> <input type="submit" name="submit" value="Send Request" action= "/feedback"/> </form> </body> </html> web.xml <servlet> <servlet-name>FeedbackServlet</servlet-name> <servlet-class>at.wunderapps.servlets</servlet-class> </servlet> <servlet-mapping> <servlet-name>FeedbackServlet</servlet-name> <url-pattern>/feedback</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app> servlet: import java.io.IOException; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings("serial") public class FeedbackServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponseresp ) throws ServletException, IOException { String name = req.getParameter("name"); String description = req.getParameter("description"); String email = req.getParameter("email"); Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); String msgBody = name + description + email + " :EMAIL"; try { Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("a...@gmail.com", "Es FUNKTIONIERT!!!")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress("my.m...@mail.com", "Your name")); msg.setSubject("Bestellung"); msg.setText(msgBody); Transport.send(msg); } catch (Exception e) { resp.setContentType("text/plain"); resp.getWriter().println("Something went wrong. Please try again."); throw new RuntimeException(e); } resp.setContentType("text/plain"); resp.getWriter().println( "Thanks you for your feedback. An Email has been send out."); } } When I am doing localhost i get: HTTP ERROR: 503 > > Problem accessing /. Reason: > > SERVICE_UNAVAILABLE > and the exceptions I get are: java.lang.ClassNotFoundException: at.wunderapps.servlets CRITICAL: javax.servlet.ServletContext log: unavailable javax.servlet.UnavailableException: at.wunderapps.servlets 20.07.2012 13:13:46 com.google.apphosting.utils.jetty.JettyLogger warn WARNUNG: failed FeedbackServlet: java.lang.NullPointerException 20.07.2012 13:13:46 com.google.apphosting.utils.jetty.JettyLogger warn WARNUNG: Failed startup of context com.google.appengine.tools.development.DevAppEngineWebAppContext@495c998a{/,C:\Users\Desktop\mailservice\war} java.lang.NullPointerException I guess the problem could be that the inde.html does not find my servlet. But why, cause the web.xml seems to be alright? Can you please help me? I very much appreciate your answer!!! PS.: I am running it on windows 7, eclipse. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/jPmgnNdXCS8J. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.