简体   繁体   中英

com.google.apphosting.runtime.security.shared.stub.java.nio.file.Files

I am using google app engine to and trying to run a cron job which is a success. But there is an exception that I am facing can anyone please guide me with this exception which is as follows:

Error for /cron/fetchnewfiles
java.lang.NoClassDefFoundError: Could not initialize class com.google.apphosting.runtime.security.shared.stub.java.nio.file.Files
    at com.google.appengine.runtime.Request.process-cbe3f36b744636fe(Request.java)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:44)
    at com.google.api.client.util.IOUtils.isSymbolicLink(IOUtils.java:193)
    at com.google.api.client.util.store.FileDataStoreFactory.<init>(FileDataStoreFactory.java:56)
    at com.demo.gapps.server.Utils.authorize(Utils.java:283)
    at com.demo.gapps.server.FetchNewFilesCron.getDriveService(FetchNewFilesCron.java:242)
    at com.demo.gapps.server.FetchNewFilesCron.doGet(FetchNewFilesCron.java:96)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    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 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 org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:446)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:453)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:276)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:312)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:304)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:450)
    at java.lang.Thread.run(Thread.java:745)

Based from the error log, the java.lang.NoClassDefFoundError: org.jcp.xml.dsig.internal.dom.XMLDSigRI is a restricted class. . Take a look at the Sandbox restriction . The stack trace is showing java.lang.reflect so there is probably an issue related to Sandbox restrictions and reflection.

The secured "sandbox" environment isolates your application for service and security. It ensures that apps can only perform actions that do not interfere with the performance and scalability of other apps. For instance, an app cannot spawn threads in some ways, write data to the local file system or make arbitrary network connections. An app also cannot use JNI or other native code. The JVM can execute any Java bytecode that operates within the sandbox restrictions.

The App Engine platform provides many services that your code can call. Your application can also configure scheduled tasks that run at specified intervals.

Simple steps how to create cron job:

  • Create the cron.xml file in the WEB-INF/ directory of your application (alongside appengine-web.xml ).
  • Add one or more <cron> entries to your file and define the necessary elements for your job, including the required <url> and <schedule> elements.

The following example creates a basic cron job that runs daily:

/tasks/summary beta daily summary job every 24 hours The target specification is optional and is the name of a service/version. If present, the target is prepended to your app's hostname, causing the job to be routed to that service/version. If no target is specified, the job will run in the default version of the default service. * Create a handler for the cron job's URL. The handler should execute any tasks that you want scheduled. The handler should respond with an HTTP status code between 200 and 299 (inclusive) to indicate success.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM