ZK + Spring + Jpa + Google app engine

asked 2009-11-02 07:19:08 +0800

morfeusys gravatar image morfeusys
12 1

Hello all!
Has somebody a working example of zk_jpa+spring3+gae? I have a lot of problems with implementation of such app. I've already read all posts on forum about integration zk with gae but no one helps me. Everything is working fine locally but not on gae server.
Please if somebody has successful experience help me!

Thanks a lot

delete flag offensive retag edit

12 Replies

Sort by ยป oldest newest

answered 2009-11-02 17:11:16 +0800

jtoupin gravatar image jtoupin

I do not believe ZK works on GAE. They have announced GAE support but some critical classes do not implement Serializable which make applications crash on GAE. This might have been fixed though.

link publish delete flag offensive edit

answered 2009-11-03 01:46:56 +0800

morfeusys gravatar image morfeusys
12 1

Yes, but I can run my zkoss gmaps application on gae server. The main problem for me is to link my window controller classes with spring beans. For example there are problems with serialization when I try to inject service layer into my controller.

link publish delete flag offensive edit

answered 2009-11-03 11:42:18 +0800

kesavkolla gravatar image kesavkolla
180 3

I am currently developing zk+spring 3.0+jdo on GAE. I have no issues so far only thing I am not really utilizing the spring mvc other than that everything works ok. I am using zk's MVC combined with spring JDO.

link publish delete flag offensive edit

answered 2009-11-04 01:09:16 +0800

iantsai gravatar image iantsai
2755 1

updated 2009-11-04 01:09:57 +0800

This forum system (ZK Forum) is the result that ZK Team ate their own dog food to wipe out those silly NotSerializableException(Finally we did it~ HA HA).
So if you want the most stable version to build a web app which need to replicate & persist Session Objects, please use ZK 3.6.3.
I believe things are much better now.(I've tested 3.6.3 using Tomcat Context PersistenceManager, and it works fine currently.)

Do you have any interest to share your experience in how to do your work? maybe a smalltalk in our wiki or a blog that we can announce a news to link to it for you.

link publish delete flag offensive edit

answered 2009-11-04 01:56:24 +0800

edudant gravatar image edudant
219 1 1 1


I did some tests on GAE with version 3.6.2, Spring/JPA and got it (almost) work. However, I if I understand the concepts of ZK and GAE correctly, it will conceptually not work well together. ZK's main advantage and disadvatage is, that the client session runs (and has many objects) on server. This is good, because AJAX (or update) requests can be served very fastly by in memory existing page/comonent structure. This will become problem on GAE, because whole session is deserialized/serialized before/after each reqeust. This means, that if you got "onChanging" event, for (almost) each keystroke whole page and all components have to be deserialized. This can never be fast. In case of cloud computing, I would consider Amazon E2 instead (it will give you virtual server and you can hold session in memory as long as you want to).

But I did only few tests in this field, so I might be wrong. Any thoughts on concepts ZK and GAE?

link publish delete flag offensive edit

answered 2009-11-04 02:51:58 +0800

iantsai gravatar image iantsai
2755 1

Hi edudant, nice to have you to join this thread.

I think about the result you think: "not work well together" is a choice that developer should make while implement a user's requirement.
What ZK should do to support developer is given an "ability" to let they can program in client-side(using JS of course) and offer more detailed settings to configure the responsiveness.
In your case, if we can decrease the send back frequency of onChanging event or use a client-side timer which will piggyback the text and will work in async thread , then we can improve the usability of our ZK application.
I think this part is one of the reason(maybe the most important reason) why ZK step to ZK5.

link publish delete flag offensive edit

answered 2009-11-05 02:03:56 +0800

morfeusys gravatar image morfeusys
12 1

Ok. Could somebody show me a little example of injection of service layer into zkoss window controller? I've many time spent without any success.

link publish delete flag offensive edit

answered 2009-11-17 13:05:44 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16


link publish delete flag offensive edit

answered 2009-11-17 23:05:16 +0800

tomyeh gravatar image tomyeh
610 1 3
http://blog.zkoss.org ZK Team

updated 2009-11-17 23:06:44 +0800

To work with GAE, it is all about serializable (except some features GAE's JVM disallowed). With ZK 3.6.3, the standard composer (GenericComposer and others) are all serializable. Technically it works with GAE without attention if the composer contains only components.

However, if you want to store Spring objects (or application-specific objects), you have to handle the serialization manually.

There are two approaches depending on your preferences and what kind of objects to handle. One is to declare the object serializable (java.io.Serializable) if the object can be serialized. The second approach is to declare it as transient and re-generate (or re-bind) when doActivate() (part of ComponentActivationListener) is called.

Serialization of Spring related objects (disclaimer: I am not an expert of Spring) shall be a well-known topic. If so, the first approach (make it serializable) shall be straightforward.

link publish delete flag offensive edit

answered 2009-11-18 03:11:01 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16

updated 2009-11-18 03:15:10 +0800



	<!-- DAO's beans -->
	<bean id="kundeDAO" class="de.daibutsu.backend.dao.impl.KundeDAOImpl"/>
	<bean id="filialeDAO" class="de.daibutsu.backend.dao.impl.FilialeDAOImpl" />

	<!-- Service beans  -->
	<bean name="kundeService" class="de.daibutsu.backend.service.impl.KundeServiceImpl">
		<property name="kundeDAO" ref="kundeDAO" />
		<property name="filialeDAO" ref="filialeDAO" />


	<!-- Customers -->
	<bean id="customerListCtrl" class="de.forsthaus.webui.customer.CustomerListCtrl"
		parent="basisCtrl" scope="prototype">
		<property name="brancheService" ref="brancheService" />
		<property name="kundeService" ref="kundeService" />
		<property name="testService" ref="testService" />


<?xml version="1.0" encoding="UTF-8"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>

<zk xmlns="http://www.zkoss.org/2005/zul"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">

	<window id="window_customerList" apply="${customerListCtrl}"
		border="none" width="100%">

		<panel id="panel_CustomerList"
			title="${c:l('panel_CustomerList.title')}" border="none" />


public class CustomerListCtrl extends GFCBaseCtrl implements Serializable {

	private static final long serialVersionUID = 6787508590585436872L;
	private transient final static Logger logger = Logger.getLogger(CustomerListCtrl.class);

	 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	 * All the components that are defined here and have a corresponding
	 * component with the same 'id' in the zul-file are getting autowired by our
	 * 'extends GFCBaseCtrl' GenericForwardComposer.
	 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	protected transient Window window_customerList; // autowired
	// listbox customerList
	protected transient Borderlayout borderLayout_customerList; // autowired
	protected transient Paging pagingCustomerList; // autowired
	protected transient Listbox listBoxCustomer; // autowired
	protected transient Listheader listheader_CustNo; // autowired
	protected transient Listheader listheader_CustMatchcode; // autowired

	 * default constructor.<br>
	public CustomerListCtrl() {

		if (logger.isDebugEnabled()) {
			logger.debug("--> super()");

	public void onCreate$window_customerList(Event event) throws Exception {

		if (logger.isDebugEnabled()) {
			logger.debug("--> " + event.toString());

		/* autowire comps the vars */
		doOnCreateCommon(window_customerList, event);


abstract public class GFCBaseCtrl extends GenericForwardComposer implements Serializable {

	private transient static final Logger logger = Logger.getLogger(GFCBaseCtrl.class);
	private static final long serialVersionUID = -1171206258809472640L;

	protected transient AnnotateDataBinder binder;

	// protected Workspace ws;
	protected transient Map<String, Object> args;

	public void doOnCreateCommon(Window w) throws Exception {
		binder = new AnnotateDataBinder(w);
		// ws = Workspace.getWorkspace();

	public void doOnCreateCommon(Window w, Event fe) throws Exception {
		CreateEvent ce = (CreateEvent) ((ForwardEvent) fe).getOrigin();
		args = ce.getArg();


1. Configure the configuration-files well.
2. In zul-files change the controller calls to apply="" that spring can create them.


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2009-11-02 07:19:08 +0800

Seen: 2,068 times

Last updated: Dec 04 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More