Hi Alex,
I was already using the commons-fileupload.jar 1.2.1 version which is
semi-compatible with GAE!

The problem here was that I still had the  tapestry-upload.jar, in the path,
and it got packed in the war!
I had to remove the tapestry-upload.jar from the war, it works now!

Thanks,

Fernando





On 5 April 2011 00:16, Alex Kotchnev <akoch...@gmail.com> wrote:

> Fernando,
>   There's nothing specific about the generic tapestry form. If you look at
> the stacktrace, the problem comes from Commons Fileupload trying to use a
> temp file to store the file upload. There is a version of Commons
> Fileupload
> that is GAE friendly, google it and you'll be able to get it working.
>
> Cheers,
>
> Alex K
>
> On Mon, Apr 4, 2011 at 6:03 PM, Fernando Benjamin <
> fernandobenja...@gmail.com> wrote:
>
> > Hi all,
> >
> >
> > I need some help on using tapestry's form component on GAE.
> > I am uploading a file & a beaneditor with a tapestry form component.
> >
> > The problem is that when the file gets uploaded to GAE, I get an
> exception.
> > This exception occurs because, tapestry wants to create the file for me.
> >
> > Is there a way of avoiding this automatic creation of file after
> uploading
> > the form?
> > GAE does not allow to create files!
> > And I must use the tapestry component form :)
> >
> >
> > Thanks,
> >
> > Fernando
> >
> > --------------------------------------- EXCEPTION
> > ---------------------------------------
> >
> > jjava.lang.NoClassDefFoundError: java.rmi.server.UID is a restricted
> > class. Please see the Google  App Engine developer's guide for more
> > details.
> >
> >    at
> com.google.appengine.tools.development.agent.runtime.Runtime.reject(
> > Runtime.java:51)
> >
> > at org.apache.commons.fileupload.disk.DiskFileItem.<clinit>(
> > DiskFileItem.java:109)
> >
> > at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(
> > DiskFileItemFactory.java:199)
> >
> > at
> >
> $FileItemFactory_12f226be4b1.createItem($FileItemFactory_12f226be4b1.java)
> >
> > at org.apache.commons.fileupload.FileUploadBase.parseRequest(
> > FileUploadBase.java:361)
> >
> > at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(
> > ServletFileUpload.java:126)
> >
> > at
> >
> >
> org.apache.tapestry5.upload.internal.services.MultipartDecoderImpl.parseRequest(
> > MultipartDecoderImpl.java:106)
> >
> > at
> >
> org.apache.tapestry5.upload.internal.services.MultipartDecoderImpl.decode(
> > MultipartDecoderImpl.java:88)
> >
> > at
> $MultipartDecoder_12f226be4b0.decode($MultipartDecoder_12f226be4b0.java)
> >
> > at
> $MultipartDecoder_12f226be329.decode($MultipartDecoder_12f226be329.java)
> >
> > at
> >
> >
> org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(
> > MultipartServletRequestFilter.java:41)
> >
> > at
> >
> >
> $HttpServletRequestHandler_12f226be32e.service($HttpServletRequestHandler_12f226be32e.java)
> >
> > at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(
> > IgnoredPathsFilter.java:62)
> >
> > at
> >
> >
> $HttpServletRequestFilter_12f226be32b.service($HttpServletRequestFilter_12f226be32b.java)
> >
> > at
> >
> >
> $HttpServletRequestHandler_12f226be32e.service($HttpServletRequestHandler_12f226be32e.java)
> >
> > at org.apache.tapestry5.services.TapestryModule$2.service(
> > TapestryModule.java:926)
> >
> > at
> >
> >
> $HttpServletRequestHandler_12f226be32e.service($HttpServletRequestHandler_12f226be32e.java)
> >
> > at
> >
> >
> $HttpServletRequestHandler_12f226be328.service($HttpServletRequestHandler_12f226be328.java)
> >
> > at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:147)
> >
> > at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
> > ServletHandler.java:1157)
> >
> > at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(
> > ServeBlobFilter.java:58)
> >
> > 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:122)
> >
> > 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.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(
> > DevAppEngineWebAppContext.java:70)
> >
> > at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> >
> > at
> >
> >
> com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(
> > JettyContainerService.java:351)
> >
> > 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.content(
> > HttpConnection.java:938)
> >
> > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
> >
> > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
> >
> > 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)
> >
> >
> >
> ------------------------------------------------------------------------------------------
> >
> >
> >
> > --------------------------------------- MY FORM
> > ---------------------------------------
> >
> >
> >     <t:form t:id="upload" >
> >
> >        <t:errors/>
> >
> >        <t:beaneditor t:id="product" object="product" />
> >
> >        <br/><br/>
> >
> >        <input type="file" id="ga" name="file"/>
> >
> >
> >        <br/><br/>
> >
> >        <input t:type="submit" t:id="button"
> t:value="message:button-label"
> > />
> >
> >
> >
> >    </t:form>
> >
> >
> >
> ----------------------------------------------------------------------------------------
> >
> >
> >
> >
> >
> >
> > Here is my example of the Filter
> >
> > --------------------------------------- MY FILTER
> > ---------------------------------------
> >
> >
> >   @Override
> >
> > public boolean service(Request request, Response response, RequestHandler
> > handler) throws IOException {
> >
> >  log.info("PATH = " + request.getPath());
> >
> >  if (urlPath.equalsIgnoreCase(request.getPath())) {
> >
> >  try {
> >
> >  ServletFileUpload upload = new ServletFileUpload();
> >
> >  FileItemIterator iterator = upload.getItemIterator(reqServlet);
> >
> >  FileItemStream item = iterator.next();
> >
> >  InputStream stream = item.openStream();
> >
> >  String filename = item.getName();
> >
> >  Blob content = new Blob(IOUtils.toByteArray(stream));
> >
> >  log.debug("Filename " + filename.substring(filename.length() - 3,
> > filename.length()));
> >
> >                                 [* .... more functionality for saving
> > tefile
> > *!.....]
> >
> >  } catch (Exception ex) {
> >
> >  log.error(ex.getMessage());
> >
> >  }
> >
> >
> >  log.info("################# EINDE ############");
> >
> >  }
> >
> >  return handler.service(request, response);
> >
> > }
> >
> > }
> >
>

Reply via email to