Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Java Frameworks and Integrations in Google App Engine and Managed VM's

DZone's Guide to

Java Frameworks and Integrations in Google App Engine and Managed VM's

· Cloud Zone
Free Resource

Production-proven Mesosphere DC/OS is now even better with GPU scheduling, pods, troubleshooting, enhanced security, and over 100+ integrated services deployed in one-click.

Java Frameworks, Integrations supported in Google App Engine and Managed VM

As per definition from Google docs, Google App Engine is a Platform as a Service (PaaS) offering that lets you build and run applications on Google’s infrastructure. App Engine applications are easy to build, easy to maintain, and easy to scale as your traffic and data storage needs change. With App Engine, there are no servers for you to maintain. You simply upload your application and it’s ready to go.

When your App Engine application is running in the cloud, Google provides a scalable number of instances of your app's modules. Each instance runs in its own hosting environment. From the beginning, the App Engine hosting environment has been a sandbox, containing your code, a webserver, and a language runtime. Aside from your application code, the other components in the App Engine hosting environment are immutable and managed by Google. The language runtime is modified in order to enforce the sandbox constraints, disabling some of the usual language APIs (such as access to the file system).

App Engine now offers a second hosting option: Managed VMs. The managed VM hosting environment lets you run App Engine applications on configurable Compute Engine Virtual Machines (VMs). The VM hosting environment offers more flexibility and provides more CPU and memory options.

You can choose the hosting environment (sandboxed or managed VM) separately for each module in your application. This means an application can contain a mix of modules that use different hosting environments. For instance, you might use the sandbox environment for your client-facing frontend, and use a module running in a managed VM for backend processing. Note that every instance of any specific module will run in the same type of environment.

This article will give the list of java supporting frameworks and integrations that are executed or not executed in google app engine and Managed VM.

Apache wicket in Google App Engine

When Wicket is started in development mode, exceptions are raised because Wicket spawns threads to check resource files such as HTML files for modifications. Need to disable resource modification checking by setting the resource poll frequency in WicketApplication's init() method to null.

We cannot use the SecondLevelCacheSessionStore in the app engine, which is the default. At least not with a DiskPageStore, because this serializes the pages to the disk. But writing to the disk is not allowed in the app engine. You can use the simple HttpSessionStore implementation instead (this increases HTTP session size), by overridingnewSessionStore() in our WicketApplication:

Struts2 in google app engine

Struts 2 need a listener to run in GAE environment and listener is configured in web.xml

This listener class is a class which implements ServletContextListener,HttpSessionListener, HttpSessionAttributeListener.

Call OgnlRuntime.setSecurityManager(null); in the contextIntialized method

To run Struts2 project in local GAE environment, you have to create a TextBlock class and overload the original TextBlok class, otherwise you will hit “javax.swing.tree.TreeNode is a restricted class” error message. Hope Struts2 team can fix this in future released.

TextBlok  class source code is available in

https://groups.google.com/forum/#!topic/google-appengine-java/3YTkT2BEmMQ

Sometimes the below exception occurs while executing Struts2 app

java.security.AccessControlException: access denied ("java.io.FilePermission" "jar:file:\..\war\WEB-INF\lib\struts2-core-2.3.15.3.jar" "read")

This exception only occurs when trying to run a Struts 2 application on Google App Engine for Windows.

In order to solve this problem when running under Google App Engine for Windows the working solution is to implement a custom plugin / extension point that implements the following interfaces com.opensymphony.xwork2.FileManager and com.opensymphony.xwork2.FileManagerFactory.

This issue will not occur in google cloud app engine as it is not windows environment

Running Java Server Faces in google app engine

JSF 2 is using “javax.naming.InitialContext” that’s not supported in GAE.

To solve this, you need to get a copy of the JSF’s source code, clone the WebConfiguration.java, comment methods that are using “javax.naming.InitialContext” class, put it in “src/com/sun/faces/comfig/WebConfiguration.java“. Now, your newly created WebConfiguration.java class will overload the original WebConfiguration.java.

You need to put this el-ri-1.0.jar, otherwise, you will hit error message – Unable to instantiate ExpressionFactory ‘com.sun.el.ExpressionFactoryImpl’.

Apache CXF not supporting in google app engine

Error - java.lang.NoClassDefFoundError: javax.management.ObjectName is a restricted class. Please see the Google  App Engine developer's guide for more details.

Alternative way of using light weight webservice in google app engine is Guice injection and Sitebricks framework released by Google.

Spring Framework

Spring - RMI not supported in google app engine since RMI is not supported by Google App Engine

Spring-Httpinvoker is supported in Google App Engine

Spring-Hessian is supported in Google App engine

Spring MVC with Restful Webservices is supported in Google App Engine

Spring WebFlow is supported in Google App engine

Spring – Security ACL (Domain object security) not working in App engine. Spring security ACL needs to be customized integrating with Google App engine Datastore

Hibernate

Hibernate is working in Google App Engine with database as cloud SQL.

Hibernate with Ehcache is not working as Ehcache used disk I/O internally. Ehcache needs to be customized integrating with Google App Engine Datastore

BPM tools in google app engine

Activiti workflow is not working in google app engine

JBPM  is working in Google app engine

I tried to implement Activiti workflow in google app engine. Google app engine has some restrictions like access permissions, file writing operations. Due to these restrictions, Activiti workflow is not getting executed in google app engine properly. I am using Activiti 5.11 version.

By customizing ExceptionManager, ExpressionFactoryImpl, file writing issue has been solved. But after invoking Activiti workflow app, getting below issue

Getting the below error

Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")

Enterprise Service Bus in Google App Engine

Apache Camel

All components of Apache Camel are not supported by Google App engine. Below tables lists components that are supported by corresponding services in Google App Engine.

GAE service

Camel component

Component description

URL fetch service

ghttp

Provides connectivity to the GAE URL fetch service but can also be used to receive messages from servlets.

Task queueing service

gtask

Supports asynchronous message processing on GAE by using the task queueing service as message queue.

Mail service

gmail

Supports sending of emails via the GAE mail service. Receiving mails is not supported yet but will be added later.

Memcache service

Not supported yet.

XMPP service

Not supported yet.

Images service

Not supported yet.

Datastore service

Not supported yet.

Accounts service

gauth glogin

These components interact with the Google Accounts API for authentication and authorization. Google Accounts is not specific to Google App Engine but is often used by GAE applications for implementing security. The gauth  component is used by web applications to implement a Google specific OAUTH consumer. This component can also be used to OAuth-enable non-GAE web applications. The glogin component is used by Java clients (outside GAE) for programmatic login to GAE applications.

Search API

Lucene Search is working in Google App Engine

Reporting Library

Dynamic reporting library which has designer defined by java code is not working in Google App Engine since this uses internally java.awt.Color package which is not supported by Google App Engine

Itext library is working in Google App engine.

Rule Engine

Drools and MVEL libraries are working in google app engine

Here is the list of summary of frameworks and integrations that are supported and not supported in Google App Engine and Managed VM

Description Java framework/Integration/Tool Google App Engine Managed VM's
Soap based WebServices
JAX-WS Implementation Framework Apache CXF java.security.AccessControlException: access denied ("java.io.FilePermission" "cxf-servlet.xml" "read") Working with CXF 2.3.6, getting security exception with CXF 2.7.3
Restful WebServices frameworks
Library for Json response in Rest response Jackson Working Working
Spring framework Restful WebService Spring Restful WebService Working Working
Java MVC frameworks
MVC Framework Struts2 Working with few changes as mentioned above Working
MVC Framework Java Server faces Working with few changes as mentioned above Working
MVC Framework Apache Wicket Working with few changes as mentioned above Working
MVC Framework Spring MVC Working Working
Spring frameworks
Subproject of Spring Framework for building and running rich web applications Spring WebFlow Working Working
RMI with Spring Framework Spring RMI Not working as RMI not supported by google app engine Working
Remoting with Spring framework using HttpInvoker Spring HttpInvoker Working Working
Remoting with Spring framework using Hessian Library Spring Hessian Working Working
Data binding with Spring framework using Castor library Spring Castor Working Working
Data binding with Spring framework using JAXB library Spring JAXB Working Working
ORM with Spring Framework using Hibernate Spring ORM (Spring - Hibernate) Working and Ehcache is not working for secondary cache in hibernate Working with Ehcache also
Asynchronous support in Spring Spring Asynch Not working, java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") at java.security.AccessControlControlException Working
Authorizations and Access control using Spring Security Spring Security Access Control Working Working
Domain object security using Spring framework Spring Security ACL Not working, java.security.AccessControlException: access denied ("java.io.FilePermission" "java.io.tmpdir" "write") Working
Rapid application development using Spring Roo Spring Roo Working Working
Search API
Full text search engine library Lucene Search Working Working
Java - BPM frameworks
Light weight workflow and BPM platform Activiti Not working,java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") Working
Workflow engine and BPM suite JBPM Working Working
Mobile applications
Android application connecting app engine as back end Android Working Working
Reporting Library
Library for creating dynamic report designs Dynamic reporting library Not Working due to java.awt.Color is not supported by Google App Engine run time Working
Opensource PDF library Itext Working Working
Rule Engine
Business Rules management library Drools Working Working
Expression languag for Java applications MVEL Working Working
Enterprise Service Bus
Enterprise Service Bus and integration framework Apache Camel Only 3 services of Google app engine are supported which are Urlfetch, Taskqueue, Mail service Working 
Messaging Brokers
Open source Message broker Java application - ActiveMq Not Supported Working
Distribued messaging system Java application - Kafka Not Supported Working
Enterprise Messaging system Java application - RabitMQ Not Supported Working
NoSQL
Java integration with MongoDB NOSQL Java application - MongoDB Working Working
Java integration with Cassandra Java application - Cassandra Working Working
Hadoop and Eco systems
Hadoop framework Map Reduce Working Working

Simply build, test, and deploy. Mesosphere DC/OS is the best way to run containers and big data anywhere offering production-proven flexibility and reliability.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}