GoogleAppEngine : possible to disable FileUpload?

Posted by James.Elsey on Stack Overflow See other posts from Stack Overflow or by James.Elsey
Published on 2010-04-02T23:05:42Z Indexed on 2010/04/02 23:13 UTC
Read the original article Hit count: 703

Filed under:

Hi,

When I deploy my application to GoogleAppEngine I keep getting the following error

Uncaught exception from servlet
java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google App Engine developer's guide for more details.
    at com.google.apphosting.runtime.security.shared.stub.java.io.FileOutputStream.<clinit>(FileOutputStream.java)
    at org.apache.log4j.FileAppender.setFile(FileAppender.java:289)
    at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:163)
    at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
    at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:654)
    at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
    at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441)
    at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:468)
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:122)
    at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:88)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
    at org.springframework.web.context.ContextLoader.<clinit>(ContextLoader.java:146)
    at org.springframework.web.context.ContextLoaderListener.createContextLoader(ContextLoaderListener.java:53)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:44)
    at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:191)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:123)
    at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:243)
    at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5485)
    at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5483)
    at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
    at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:398)
    at com.google.net.rpc.impl.Server$2.run(Server.java:852)
    at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
    at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:536)
    at com.google.net.rpc.impl.Server.startRpc(Server.java:807)
    at com.google.net.rpc.impl.Server.processRequest(Server.java:369)
    at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:442)
    at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
    at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
    at com.google.net.async.Connection.handleReadEvent(Connection.java:474)
    at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:831)
    at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
    at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:103)
    at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
    at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:404)
    at java.lang.Thread.run(Unknown Source)

I've checked the documentation and it suggests to create a FileUpload class, since I won't be uploading files/documents etc from my application, is this necessary?

Is there a way to disable this functionality, or at least bypass this error?

I have already provided implementation for a MultipartWrapperFactory.Class as that has been suggested from searching for this error

Thanks

© Stack Overflow or respective owner

Related posts about google-app-engine