I got this error too when I deployed one of my applications. In my case, I
had used a JAR file which was not on the classpath. So, it compiled fine
but gave this runtime error.  It got fixed after I updated my classpath.

Check this article for more info:

http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html


On Tue, May 14, 2013 at 11:58 AM, Chris McNulty <[email protected]>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.
>
>
>

-- 
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