Finally, I decided to abandon Google App Engine and move on. The main reason for giving up this platform are:
- Lack of support for Java 8, only Java 7 is available
- "Whitelist" or black list. It sets a boundary and the software cannot grow. For instance: I'd like to add Scala support but Scala cannot be executed inside Google App Engine because it uses packages forbidden. And there is no way to bypass this restriction.
I came to the conclusion that being bound to this platform reduces my capabilities to grow. The glory of supporting one more environment does not prevail the losses.
In searching for alternatives my finger stopped at Heroku.
I spent some time refactoring the application and removing redundant stuff and now the application is ready. I'm using free Heroku account and it can take some time until the application shows up.
Eclipse projects
I added the instruction how to set up Eclipse projects and run the sample application locally.
Tomcat deployment
I created build.xml file, so by running ant command the .war file is built ready for Tomcat. More information : https://github.com/stanislawbartkowski/javahotel/blob/master/wiki/create_tomcat.md. Data source should be defined beforehand. The application was tested with Derby and Postgresql databases.
Heroku deployment
The same .war can be deployed as Heroku Tomcat application and run on Heroku Postgresql database. More information: https://github.com/stanislawbartkowski/javahotel/blob/master/wiki/create_heroku.md
Heroku, Tomcat
Although Heroku supports Tomcat container, I discovered that I was unable to read environment variable from META-INF/context.xml file. It returns null all the time. So was forced to split the Heroku code from standard Tomcat code to retrieve some configuration settings.
The Heroku version is recognized by discovering webapp-runner.jar file in classpath.
if (isJarOnPath(classPath, "webapp-runner.jar")) return ContainerType.HEROKU;Then by virtue of guice it i easy to inject proper configuration properties, particularly related to datasource definition.
@Provides @Singleton IJythonUIServerProperties getServerProperties(IGetResourceJNDI getJNDI, IReadResourceFactory iFactory, IReadMultiResourceFactory mFactory, IGetEnvVariable iGet) { if (ContainerInfo.getContainerType() == ContainerType.HEROKU) return new HerokuServerProperties(iFactory, mFactory); return new ServerPropertiesEnv(getJNDI, iFactory, mFactory, iGet); }
Conclusion
I also implemented GWT 2.8 and the latest gwt-polymer 1.7.0.0. But finally, I can say : "Welcome to Java 8 world".
Brak komentarzy:
Prześlij komentarz