502 Issue with @ComponentScan in java8 standard jetty environment and flexible

129 views
Skip to first unread message

Miguel Pagan Murphy

unread,
Jan 16, 2018, 12:04:46 PM1/16/18
to Google App Engine
Hi,

Me and my team are in the middle of a migration towards Google App Engine and have found it near to impossible to complete it. Basically, we had our Spring MVC App for java 8 and managed for it to work perfectly on the app engine standard local server with jetty but when we upload it to the cloud it completely fails to even respond to basic http requests. 

This of course is very off putting (I don´t like the idea of something working locally and then not when we uploaded) but after hours of searching forums, stackoverflow, etc.. We still haven´t been able to solve the issue.

The main problem, as close as we can get, is that for some reason when we deploy in google app engine, it stops recognising the @Components Spring annotation. 

To load our configuration we use a programatic model similar to this one:   http://www.codejava.net/frameworks/spring/bootstrapping-a-spring-web-mvc-application-programmatically

We have tried building a few demo apps from 0 and the only way we can get them to work is if we explicity declare the servlets/security config in our web.xml. 

¿Is there no way that this can work? ¿Is the local app engine standard server so different from the cloud server?

Additional info:
- After having it working locally we have deployed the project to app engine and when trying to access a simple service get the following error:
Failed startup of context c.g.a.r.j.AppEngineWebAppContext@
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' available.

- If we remove the springSecurityFilter (which has had no issues in any other environment including the local jetty/app engine server so far and is loaded programatically, as i said before) we then get an error saying that:
No handlers matched this URL.
Because of the @Spring notation we know that they should be created automatically and don´t understand why they are not. 

¿Is there anything i´m missing here? 

Thanks

Miguel.





Jordan (Cloud Platform Support)

unread,
Jan 17, 2018, 3:12:26 PM1/17/18
to Google App Engine
I would recommend starting with a base Spring application that works on App Engine. Once you have Spring working with all of the configurations in place for App Engine you can then add in your application code. 

Note that Spring is not optimized for App Engine since Spring is in itself not scalable due to it having a long startup time (aka it is more for stand-alone applications). Therefore it is recommended to follow the Spring Optimizations guide to conform your Spring app into a Cloud-friendly application. 

- Google Groups is reserved for general product discussions and not for technical support. If you require further Spring technical support it is recommended to post your full detailed questions to Stack Overflow using the supported Cloud tags. 
Reply all
Reply to author
Forward
0 new messages