本文介绍了GoogleAppEngine:可以禁用FileUpload?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将应用程序部署到GoogleAppEngine时,我不断收到以下错误:

 从servlet 
java未捕获的异常。 lang.NoClassDefFoundError:java.io.FileOutputStream是一个受限制的类。有关更多详细信息,请参阅Google App Engine开发人员指南。
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)
处org.apache.log4j.PropertyConfigurator org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
。 configureRootCategory(PropertyConfigurator.java:509)
在org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)在org.apache.log4j.PropertyConfigurator.doConfigure
(物业Configurator.java:441)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:468)
at org.apache.log4j.LogManager。< clinit>(LogManager.java :122)
。在org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
。在org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:88)
。在有机apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
在org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
。在组织。 apache.commons.logging.LogFactory.getLog(LogFactory.java:685)LT
。在org.springframework.web.context.ContextLoader&; clinit>(ContextLoader.java:146)
。在org.springframework .web.context.ContextLoaderListener.createContextLoader(ContextLoaderListener.java:53)
在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:44)
在org.mortbay.jetty.handler .ContextH andler.startContext(ContextHandler.java:548)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext( WebAppContext.java:1250)在org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517
)在org.mortbay.jetty.webapp.WebAppContext.doStart
(WebAppContext.java:在org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50 467)

在com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:191)$ b在com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
$ b在com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:123)
,位于com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:243)
,位于com.google.apphosting.base.RuntimePb $ EvaluationRuntime $ 6.handleBlockingRequest(Runt imePb.java:5485)
在com.google.apphosting.base.RuntimePb $ EvaluationRuntime $ 6.handleBlockingRequest(RuntimePb.java:5483)
在com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest (BlockingApplicationHandler.java:24)
,位于com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:398)
位于com.google.net.rpc.impl.Server $ 2。运行(Server.java:852)
在com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
在com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:536)
在com.google.net.rpc.impl.Server.startRpc(Server.java:807)
在com.google.net.rpc.impl.Server.processRequest(Server.java:369)
在com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:442)
在com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
,位于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)
com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
com.google.net.async.EventDispatcher.loop(EventDispatcher.java:103)
com.google .net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
在com.google.apphosting.runtime.JavaRuntime $ RpcRunnable.run(JavaRuntime.java:404)
在java.lang.Thread中.run(Unknown Source)

我检查了,它建议创建一个FileUpload类,因为我不会从我的应用程序上传文件/文档等,是这有必要吗?

有没有办法禁用这个功能,或者至少绕过这个错误?



我已经提供了im为 MultipartWrapperFactory.Class 寻找这个错误的建议已经建议

谢谢

解决方案

看起来您不允许在运行代码的服务器上创建本地文件,但您的记录器正在尝试这样做。将日志记录机制切换为文件以外的其他内容。


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

解决方案

It appears you're not allowed to create local files on the server running your code, but your logger is trying to do so. Switch your logging mechanism to something other than a file.

这篇关于GoogleAppEngine:可以禁用FileUpload?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 08:23