1. Don't use that tutorial. It's out of date (it was last updated in 2010). 
Use this: https://developers.google.com/appengine/docs/java/gettingstarted/ or 
build the projects here: https://github.com/GoogleCloudPlatform

2. Seriously, don't use that tutorial. 

3. NoClassDefFoundError can happen for many reasons (and I emphasize, 
many). Here's a short laundry list:
3A. The JVM was unable to find the class definition (It found the file 
itself, but it failed static initialization
3B. Another exception is coming up in static initialization and is 
masquerading as a NoClassDefFoundError

3. If you absolutely insist on using this tutorial, try this: delete the 
EMFService class and move the EntityManagerFactory variable to whatever 
class file that getTodo is in. If that doesn't work, put a try/catch block 
around "return emfinstance" and see if something is wrong there.

4. Is that the entire EMFService class that you pasted in? Did you skip the 
imports? Because EntityManagerFactory is not a Google service, you have to 
import javax.persistence and/or JPA ( http://openjpa.apache.org/ )


-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

My Go side project: http://invalidmail.com/


On Tuesday, May 14, 2013 1:58:25 PM UTC-5, Chris McNulty wrote:
>
> Hey, I have been following this tutoiral for the google app engine. 
> http://www.vogella.com/articles/GoogleAppEngineJava/article.html
>
> When I went to deploy. The main page for the application displayed but in 
> order to use it I had to login using my google account when I did this I 
> was greeted with this error 
>
> HTTP ERROR 500
>
> Problem accessing /TodoApplication.jsp. Reason:
>
>     java.lang.NoClassDefFoundError: Could not initialize class 
> com.chrismcnulty.gaetutorial.EMFService
>
> Caused by:
>
> javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not 
> initialize class com.chrismcnulty.gaetutorial.EMFService
>       at 
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
>       at 
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
>       at 
> org.apache.jsp.TodoApplication_jsp._jspService(TodoApplication_jsp.java:194)
>       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>       at 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>       at 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>       at 
> com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
>       at 
> com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:61)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at 
> com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:58)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>       at 
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
>       at 
> com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>       at 
> com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>       at 
> com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>       at 
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:61)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>       at 
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>       at 
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>       at 
> com.google.appengine.tools.development.DevAppServerServersFilter.doFilter(DevAppServerServersFilter.java:106)
>       at 
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>       at 
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
>       at 
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>       at 
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>       at 
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>       at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
>       at 
> com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
>       at 
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>       at 
> com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:421)
>       at 
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>       at org.mortbay.jetty.Server.handle(Server.java:326)
>       at 
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>       at 
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
>       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
>       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>       at 
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>       at 
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: java.lang.NoClassDefFoundError: Could not initialize class 
> com.chrismcnulty.gaetutorial.EMFService
>       at com.chrismcnulty.gaetutorial.Dao.getTodo(Dao.java:33)
>       at 
> org.apache.jsp.TodoApplication_jsp._jspService(TodoApplication_jsp.java:92)
>       ... 43 more
>
>
> Here is the section of my code the error is linking to 
>
>
> public List<Todo> getTodo(String userID) {
>               
>       EntityManager em = EMFService.get().createEntityManager(); // Error 
> links to here
>
>       Query q = em.createQuery("select t from Todo t where t.author = :use 
> ID");
>       q.setParameter("userID", userID);
>       List<Todo> todos = q.getResultList();
>               
>       return todos;
> }
>
>
> Here is the EMFService class
>
>
> public class EMFService {
>       
>                   private static final EntityManagerFactory emfInstance = 
> Persistence.createEntityManagerFactory("transactions-optional");
>       
>       private EMFService() {}
>       
>       public static EntityManagerFactory get() {
>               return emfInstance;
>       }
> }
>
>
> I have everything added to the web.xml file so I don't know why this is 
> happening.   any help is greatly appreciated. I have to get to grips with 
> google app engine for a new job so I am pulling my hair out over this at the 
> moment.  
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to