-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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.
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.
@jtoupin:
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.)
@kesavkolla:
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.
Hi,
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?
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.
push
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.
@morfeusys
application-context-hibernate.xml
... <!-- 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" /> </bean> ...
application-context-zkoss.xml
... <!-- 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" /> </bean> ...
customerList.zul
<?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" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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() { super(); 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); binder.loadAll(); // ws = Workspace.getWorkspace(); } @SuppressWarnings("unchecked") public void doOnCreateCommon(Window w, Event fe) throws Exception { doOnCreateCommon(w); 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.
best
Stephan
Asked: 2009-11-02 07:19:08 +0800
Seen: 2,068 times
Last updated: Dec 04 '09