Missing resource file after deployed to App Engine- works fine in local

39 views
Skip to first unread message

Gift

unread,
Aug 20, 2010, 5:08:00 AM8/20/10
to Google Web Toolkit
Hi,

I am developing code in Eclipse using GWT.

I saved my resource files under the root of war directory, my code
works fine when I am in my eclipse and my code can read the file I
stored.

However, after I uploaded the code to app engine, it looks like the
app engine is been missing the resource.

I tried to save my files under war/WEB-INFO,
but sill no good in App engine side.


The code I used is:

ServletContext servletContext.....

resourceFilePath = "/testfile";

Properties prop = new Properties();
InputStream propStream =
servletContext.getResourceAsStream(resourceFilePath);
prop.load(propStream);

jobSourceFileName = prop.getProperty("JobSourceInformationFile");
.............

The exception at app engine side was:

javax.servlet.ServletContext log: Exception while dispatching incoming
RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.lang.String
asu.client.GreetingService.greetServer(java.lang.String) throws
java.lang.IllegalArgumentException' threw an unexpected exception:
java.lang.NullPointerException
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
378)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
581)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
188)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:
224)
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:
62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at
com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:
97)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:
35)
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
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.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:
238)
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
com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:
76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:
135)
at
com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
251)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:6784)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:6782)
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:
576)
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:418)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at
asu.server.SimulationRunInformation.createSimulationRunInformation(SimulationRunInformation.java:
52)
at asu.server.TestMain.test1(TestMain.java:14)
at asu.server.LineChartTool.example(LineChartTool.java:49)
at
asu.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:
34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:43)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
562)
... 46 more


Cheers,

Leo

Gift

unread,
Aug 20, 2010, 1:54:13 PM8/20/10
to Google Web Toolkit
I might have not explained this in detail.

So my problem is the program work fine in my eclipse however, after I
deploy it to App engine, it stopped working.

Thanks,

Gift

unread,
Aug 20, 2010, 2:49:13 PM8/20/10
to Google Web Toolkit

I tried the following code

String jobDataFileResourceName = servletContext.getRealPath("")
+ "/WEB-INF" + "/jobs_" + info.getName() + ".txt";

InputStream stream =new FileInputStream(jobDataFileResourceName);

but I am receiving AccessControlException right now.


Caused by: java.security.AccessControlException: access denied
(java.io.FilePermission /base/data/home/apps/dddd/
2.344222575196535718\WEB-INF\properties.TestBankDataWith_20_Resources
read)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:
355)
at
java.security.AccessController.checkPermission(AccessController.java:
567)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.FileInputStream.<init>(FileInputStream.java:133)
at java.io.FileInputStream.<init>(FileInputStream.java:98)
at
asu.server.SimulationProperties.getPropertiesFromResourceFile(SimulationProperties.java:
64)
at
asu.server.SimulationRunInformation.createSimulationRunInformation(SimulationRunInformation.java:
38)
at asu.server.TestMain.test1(TestMain.java:14)
at asu.server.LineChartTool.example(LineChartTool.java:49)
at
asu.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:
33)

Gift

unread,
Aug 23, 2010, 4:36:26 AM8/23/10
to Google Web Toolkit
Sorry for taking your time. I solved my problem.

My problem was because my file name was wrong. By accident, I
capitalized one of my resource file. It works fine in my local windows
machine, however, in app engine, they treat it differently.

cheers,
> On Aug 20, 10:54 am,Gift<liwufi...@gmail.com> wrote:
>
>
>
> > I might have not explained this in detail.
>
> > So my problem is the program work fine in my eclipse however, after I
> > deploy it to App engine, it stopped working.
>
> > Thanks,
>
Reply all
Reply to author
Forward
0 new messages