[appengine-java] Re: ClassLoading Problems in FileUpload Servlet

2009-09-15 Thread John

Toby,

thanks for taking the time to respond, I appreciate it.

First some things I should have said before, I am using the GAE
Eclipse plug in. GWT 1.7, App Engine 1.2.5.

What I don't understand is why other test applications seem to work
quite hapilly with datastore without me adding a load of jars to the
lib area. Those other applications are using GWT and for example the
standard eclipse generated GreatingServer expanded to use
PersistenceManager seem to work just fine.

Now this may just be down to good/bad luck and the way that the google
projects are structured and therefore work with Jetty etc.

If the correct way to structure things is to explicitly put the GAE/
JDO/... jars in the war/WEB-INF/lib area should they be appearing on
the classpath of the eclipse projects? And why do some projects/use
cases (such as via GWT RCP) seem to work and others fail?

Its coming up to midnight here, so I am going to sleep and revisit
this in the morning, hopefully with a clear head I will be able to
work out what I need to do, but any input on how to set up properly is
really appreciated.

J

On Sep 15, 11:23 pm, Toby Reyelts to...@google.com wrote:
 John,
 The JDO/JPA support for App Engine lives entirely in userland. Like all
 the other libraries under the sdk's SDK_ROOT/lib/user folder, you must
 bundle it with your application in order to use it. One nice aspect about
 the ORM support living in userland is that you can easily apply patches or
 try new interim releases between official SDK releases.

 On Tue, Sep 15, 2009 at 6:17 PM, John john.r.nic...@gmail.com wrote:

  Actually I think I have simplified this further. The basic issue seems
  to be referencing anything to do with the datastore from an ordinary
  servlet. So if I have a servlet

  import java.io.IOException;

  import javax.jdo.JDOHelper;
  import javax.jdo.PersistenceManagerFactory;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;

  public class UploadFileServlet extends HttpServlet {
        �...@override
         protected void service(HttpServletRequest request,
  HttpServletResponse response) throws ServletException, IOException {
         }

         private static final PersistenceManagerFactory PMF =

   JDOHelper.getPersistenceManagerFactory(transactions-optional);

  }

  and  I send it a request I get the following exception

  WARNING: Nested in javax.servlet.ServletException: init:
  java.lang.NoClassDefFoundError: javax/jdo/JDOHelper
          at
  com.cloudscapesolutions.wavacalculator.server.UploadFileServlet.clinit
  (UploadFileServlet.java:18)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
  Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance
  (NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
  (DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at java.lang.Class.newInstance0(Class.java:355)
         at java.lang.Class.newInstance(Class.java:308)
         at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
         at org.mortbay.jetty.servlet.ServletHolder.getServlet
  (ServletHolder.java:339)
         at
  org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
  463)
         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1093)
         at
  com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
  (TransactionCleanupFilter.java:43)
         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1084)
         at com.google.appengine.tools.development.StaticFileFilter.doFilter
  (StaticFileFilter.java:121)
         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1084)
         at org.mortbay.jetty.servlet.ServletHandler.handle
  (ServletHandler.java:360)
         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:712)
         at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
  405)
         at
  com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
  (DevAppEngineWebAppContext.java:54)
         at org.mortbay.jetty.handler.HandlerWrapper.handle
  (HandlerWrapper.java:139)
         at com.google.appengine.tools.development.JettyContainerService
  $ApiProxyHandler.handle(JettyContainerService.java:313)
         at org.mortbay.jetty.handler.HandlerWrapper.handle
  (HandlerWrapper.java:139)
         at org.mortbay.jetty.Server.handle(Server.java:313)
         at
  

[appengine-java] Re: ClassLoading Problems in FileUpload Servlet

2009-09-15 Thread John

Ok having thought about what Toby said and allied to what I knew I
went back to retest basics, which no longer worked!!! On investigation
I see that all of my projects have empty lib areas, except for gwt-
servlet.jar.

I created a new Eclipse project and sure enough it has been created
with all of the necessary jar files in the war/WEB-INF/lib area.

I can't immediately think why/how the jars have been removed from the
lib area, I am thinking it must be related to upgrading from App
Engine 1.2.2 to App Engine 1.2.5 yesterday.

Well thanks again Toby for the comments, they have helped me onto the
right path hopefully and I can continue with a clearer model of how
things are constructed.

Now sleep ... John

On Sep 15, 11:49 pm, John john.r.nic...@gmail.com wrote:
 Toby,

 thanks for taking the time to respond, I appreciate it.

 First some things I should have said before, I am using the GAE
 Eclipse plug in. GWT 1.7, App Engine 1.2.5.

 What I don't understand is why other test applications seem to work
 quite hapilly with datastore without me adding a load of jars to the
 lib area. Those other applications are using GWT and for example the
 standard eclipse generated GreatingServer expanded to use
 PersistenceManager seem to work just fine.

 Now this may just be down to good/bad luck and the way that the google
 projects are structured and therefore work with Jetty etc.

 If the correct way to structure things is to explicitly put the GAE/
 JDO/... jars in the war/WEB-INF/lib area should they be appearing on
 the classpath of the eclipse projects? And why do some projects/use
 cases (such as via GWT RCP) seem to work and others fail?

 Its coming up to midnight here, so I am going to sleep and revisit
 this in the morning, hopefully with a clear head I will be able to
 work out what I need to do, but any input on how to set up properly is
 really appreciated.

 J

 On Sep 15, 11:23 pm, Toby Reyelts to...@google.com wrote:

  John,
  The JDO/JPA support for App Engine lives entirely in userland. Like all
  the other libraries under the sdk's SDK_ROOT/lib/user folder, you must
  bundle it with your application in order to use it. One nice aspect about
  the ORM support living in userland is that you can easily apply patches or
  try new interim releases between official SDK releases.

  On Tue, Sep 15, 2009 at 6:17 PM, John john.r.nic...@gmail.com wrote:

   Actually I think I have simplified this further. The basic issue seems
   to be referencing anything to do with the datastore from an ordinary
   servlet. So if I have a servlet

   import java.io.IOException;

   import javax.jdo.JDOHelper;
   import javax.jdo.PersistenceManagerFactory;
   import javax.servlet.ServletException;
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;

   public class UploadFileServlet extends HttpServlet {
         �...@override
          protected void service(HttpServletRequest request,
   HttpServletResponse response) throws ServletException, IOException {
          }

          private static final PersistenceManagerFactory PMF =

    JDOHelper.getPersistenceManagerFactory(transactions-optional);

   }

   and  I send it a request I get the following exception

   WARNING: Nested in javax.servlet.ServletException: init:
   java.lang.NoClassDefFoundError: javax/jdo/JDOHelper
           at
   com.cloudscapesolutions.wavacalculator.server.UploadFileServlet.clinit
   (UploadFileServlet.java:18)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
   Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance
   (NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
   (DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          at java.lang.Class.newInstance0(Class.java:355)
          at java.lang.Class.newInstance(Class.java:308)
          at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
          at org.mortbay.jetty.servlet.ServletHolder.getServlet
   (ServletHolder.java:339)
          at
   org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
   463)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
   (ServletHandler.java:1093)
          at
   com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
   (TransactionCleanupFilter.java:43)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
   (ServletHandler.java:1084)
          at com.google.appengine.tools.development.StaticFileFilter.doFilter
   (StaticFileFilter.java:121)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
   (ServletHandler.java:1084)
          at org.mortbay.jetty.servlet.ServletHandler.handle
   (ServletHandler.java:360)
          at org.mortbay.jetty.security.SecurityHandler.handle