ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Google App Engine - Window Freezes

norberto108
26 Feb 2010 13:31:28 GMT
26 Feb 2010 13:31:28 GMT

Hello,

I am creating a search window with this code, everything works fine in eclipse, but when i put it online

				Window pesquisa = (Window) Executions.createComponents("/principal/comum/pesquisa.zul",winMain, map);
				pesquisa.setParent(this);
				pesquisa.doModal();

pesquisa.zul uses a listbox for browse records,

when i finally click on OK button

		((WinMediumBasico) getFellow("Pesquisa").getParent()).
			setMedium(MediumDAO.getInstance().
					findById(((Medium) lbMedium.getSelectedItem().getValue()).getId()));
		this.onClose();

it don´t close the modal dialog.

	public Medium findById(Key id) {
		PersistenceManager pm = PMF.get().getPersistenceManager();
		Medium medium = null;
		try {
			medium  = pm.getObjectById(Medium.class,id);
		} catch (NoResultException nr) {
			nr.printStackTrace();
		} catch (Exception ex) {
			ex.printStackTrace();
		} finally {
			pm.close();
		}
		return medium;
	}	

I am not able to debug it, does someone can help ?

terrytornadoTop Contributor
26 Feb 2010 14:06:30 GMT
26 Feb 2010 14:06:30 GMT

If you outComment this line:

// ((WinMediumBasico) getFellow("Pesquisa").getParent()).
setMedium(MediumDAO.getInstance().
findById(((Medium) lbMedium.getSelectedItem().getValue()).getId()));


does the window closes?


PS: It's important to know what zk version do you use.

norberto108
26 Feb 2010 14:48:46 GMT
26 Feb 2010 14:48:46 GMT

Hi terrytornado,

I´m using ZK 5, the setMedium is a method from parent window, to update parent window with selected record.

I did

		//((WinMediumBasico) getFellow("Pesquisa").
		((WinMediumBasico) getParent()).setMedium(MediumDAO.getInstance().
					findById(((Medium) lbMedium.getSelectedItem().getValue()).getId()));
		this.onClose();

it didn´t close anyway

samchuang
28 Feb 2010 18:55:12 GMT
28 Feb 2010 18:55:12 GMT

Hi

may I ask, everything works fine in eclipse, do you mean when you run ZK with GAE on local, it work, but when you put online, it fail to close dialog ??

it's strange, if you run ZK and GAE correctly on local, it should be the same when you put online.

norberto108
1 Mar 2010 14:44:33 GMT
1 Mar 2010 14:44:33 GMT

That is what happens. samchuang

terrytornadoTop Contributor
1 Mar 2010 15:27:22 GMT
1 Mar 2010 15:27:22 GMT

Different JAVA versions?

samchuang
1 Mar 2010 18:42:46 GMT
1 Mar 2010 18:42:46 GMT

@norberto108

Hi, that's very strange. the local environment that GAE provide should be the same.

And we could debug on local GAE environment, if this's what happened, I don't have a clue, maybe you could post on GAE's forum?

norberto108
2 Mar 2010 14:18:31 GMT
2 Mar 2010 14:18:31 GMT

It seems that the modal window is not receiving any events. I´ve tried some

		btOk.addEventListener("onClick", new EventListener() {

			@Override
			public void onEvent(Event event) throws Exception {
				log.info("btOk.onClick");
			}
			
		});
		
		this.addEventListener("onClick", new EventListener() {

			@Override
			public void onEvent(Event event) throws Exception {
				log.info("Pesquisa.onClick");				
			}
			
		});

it never fires. When i put onClose at onCreate event it works. On Create On Close.

samchuang
2 Mar 2010 18:35:32 GMT
2 Mar 2010 18:35:32 GMT

@norberto108

does this fails on local too, or just on GAE server??

norberto108
3 Mar 2010 06:12:09 GMT
3 Mar 2010 06:12:09 GMT

Just on GAE server. I´d put into GAE forum too.

norberto108
3 Mar 2010 07:51:21 GMT
3 Mar 2010 07:51:21 GMT

This Warning appear after pesquisa.doModal

/zkau
java.lang.RuntimeException: java.io.NotSerializableException: br.org.valedoamanhecer.comum.Pesquisa$1
at com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager.java:361)
	at com.google.apphosting.runtime.jetty.SessionManager.createEntityForSession(SessionManager.java:341)
	at com.google.apphosting.runtime.jetty.SessionManager$AppEngineSession.save(SessionManager.java:162)
	at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:41)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
	
...

terrytornadoTop Contributor
3 Mar 2010 08:22:14 GMT
3 Mar 2010 08:22:14 GMT

java.io.NotSerializableException: br.org.valedoamanhecer.comum.Pesquisa$1

Look at this class and add the Serializable Interface.

norberto108
3 Mar 2010 08:23:25 GMT
3 Mar 2010 08:23:25 GMT

Yes, i did it before, now i am working in ZK.3.6.3

public class Pesquisa extends Window implements AfterCompose, Serializable {

norberto108
3 Mar 2010 09:10:23 GMT
3 Mar 2010 09:10:23 GMT

The code inside window class uses a ListitemRenderer class i´ve modified it and the error has changed

public void onCreate$Pesquisa() {
		List<Medium> list = (List<Medium>) params.get("model");
		list.size();
		lbMedium.setModel( new ListModelSet(list));
		if( list.size()>0) lbMedium.setSelectedIndex(0);
		lbMedium.setItemRenderer(new MediumListitemRenderer());
		
	}
	
	public class MediumListitemRenderer implements ListitemRenderer, Serializable {
		@Override
		public void render(Listitem listItem, Object data) throws Exception {
               Medium medium = (Medium) data;
               
               new Listcell(medium.getNome()).setParent(listItem);
               new Listcell(medium.getMediunidade()).setParent(listItem);
               new Listcell(medium.getNomeMae()).setParent(listItem);
               
               listItem.setValue(medium);
		}		
	}
	

now looks like some problem in list datastore entities

java.lang.RuntimeException: java.io.NotSerializableException: org.datanucleus.store.appengine.query.DatastoreQuery$2
	at com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager.java:361)

terrytornadoTop Contributor
3 Mar 2010 09:21:52 GMT
3 Mar 2010 09:21:52 GMT

Does your Medium Pojo implements the Serializable Interface?

norberto108
3 Mar 2010 09:28:27 GMT
3 Mar 2010 09:28:27 GMT

Yes, it does

@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
public class Medium implements Serializable {
	
	
	public Medium() {
	    UserService userService = UserServiceFactory.getUserService();;
	    User user = userService.getCurrentUser();
		
		setQuemDigitou(user.getNickname());
	}
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;

	@Persistent
	private String cod;
	@Persistent
	private String codNovo;
	
	@Persistent
	private String nomeTemplo;
	@Persistent
	private String nomeAdjunto;
	@Persistent
	private String nome;
	@Persistent
	private String nomeLowerCase;
	
	@Persistent
	private String quemDigitou;
	
	@Persistent 
	private String mediunidade;
	
	@Persistent
	private String sexo;
	@Persistent
	private String nomePai;
	@Persistent
	private String nomeMae;
	
	
	@Persistent
	private Date dataNascimento;
	@Persistent
	private String natural;

	@Persistent
	private String ufNatural;
	
	public String getUfNatural() {
		return ufNatural;
	}
	public void setUfNatural(String ufNatural) {
		this.ufNatural = ufNatural;
	}

	@Persistent
	private String estadoCivil;
	
	@Persistent
	private String profissao;
	@Persistent
	private String endereco;
	@Persistent
	private String cidade;

	@Persistent
	private String ufEndereco;
	
	public String getUfEndereco() {
		return ufEndereco;
	}
	public void setUfEndereco(String ufEndereco) {
		this.ufEndereco = ufEndereco;
	}

	@Persistent
	private String cep;
	@Persistent
	private String telefone;
	
	@Persistent
	private String mentor;

	@Persistent
	private String princesa;
	
	@Persistent
	private Date dataIngresso;
	@Persistent
	private Date dataEmplacamento;
	@Persistent
	private Date dataIniciacao;
	@Persistent
	private Date dataElevacao;

norberto108
3 Mar 2010 11:52:44 GMT
3 Mar 2010 11:52:44 GMT

@terrytornado
@samchuang

I fixed the problem. I was trying to pass a list as a map parameter to Executions.createComponent. Just stoped to do this and it works.

I think it should be possible in the future, or am i doing something still wrong ?

Thanks for your help

terrytornadoTop Contributor
3 Mar 2010 15:05:29 GMT
3 Mar 2010 15:05:29 GMT

Have a try with overhanding the whole controller as object in your map.
Read them back and have control over his components/properties.

best
Stephan

PS: In our Zksample2 app we overhanded controlers or a single listbox very well. But it's not tested on GAE.
Have you a download link to GAE for local testing?