简体   繁体   中英

App engine deploy with spring MVC

I'm trying to deploy a Spring MVC app that uses Spring Security to app engine. This works fine locally using the jetty dev server.

I'm using the version 4.1.6 of spring framework, 4.0.2 of spring security and 1.9.27 of the app engine SDK. The error I am getting in my log is:

Uncaught exception from servlet
javax.servlet.UnavailableException: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Application.class]; nested exception is java.lang.ExceptionInInitializerError
    at org.mortbay.jetty.servlet.ServletHolder.makeUnavailable(ServletHolder.java:415)
    at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:458)
    at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    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:206)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:179)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:457)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:230)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:235)
    at java.lang.Thread.run(Thread.java:745)

From what I have read this an error relating GAE not supporting certain versions of Spring but I can't find out which versions are supported. Am I right in my assumption that it has to do with the version, and if so which version of these frameworks do I need?

Thanks

No, for sure is not version related problem. I am using even higher Spring versions with GAE and have no problems (I had 4.1.6 as well):

<appengine.target.version>1.9.27</appengine.target.version>
<spring.version>4.2.1.RELEASE</spring.version>
<spring.security.version>4.0.2.RELEASE</spring.security.version>
<javax.servlet-api.version>2.5</javax.servlet-api.version>

You may find some difficulties trying to migrate to spring 4.2.1. The solution can be found here:

Spring 4.2.1 on GAE and java.util.ResourceBundle$Control is a restricted class

UPDATED

The things that may be different on your local application and GAE is java (GAE uses Java7) and Servlet API which has to be 2.x and which will be replaced on production. Be specially aware about Servlet API because some content of web.xml may be differently interpreted.

Anyway, please paste the whole stack trace then it will be easier to find the solution.

I'm not sure if should close this question but the issue is with JMustache. It seems that one can not enable mustache via annotations on GAE. I'm not entirely clear why this is but the beans need to be setup in xml. I haven't got this working yet but the issue is not to do with Spring MVC.

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