You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by alex <al...@gmail.com> on 2005/07/26 08:29:22 UTC

editable contrib: Table -- java.io.NotSerializableException

Hi!

I have an issue with editable table and don't know if is my mistake...

There is a simple editable table which uses a custom comparator.(is one of the 
examples from  the wiki page)

I'll post the exception and then the source files.
The exception is thrown in
class : [SerializableAdaptor  ]
method : [squeeze(DataSqueezer squeezer, Object data) throws IOException]
line : [oos.writeObject(data);]

I understand that the problem is that ColumnCmparator should be 
serializable .... What i don't know is if there is , and where is a mistake in 
my code.

Here is the exception : 



***********__________________***********
java.io.NotSerializableException: 
org.apache.tapestry.contrib.table.model.simple.ColumnComparator
	at java.io.ObjectOutputStream.writeObject0
(ObjectOutputStream.java:1075)
	at java.io.ObjectOutputStream.defaultWriteFields
(ObjectOutputStream.java:1369)
	at java.io.ObjectOutputStream.writeSerialData
(ObjectOutputStream.java:1341)
	at java.io.ObjectOutputStream.writeOrdinaryObject
(ObjectOutputStream.java:1284)
	at java.io.ObjectOutputStream.writeObject0
(ObjectOutputStream.java:1073)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
	at org.apache.tapestry.util.io.SerializableAdaptor.squeeze
(SerializableAdaptor.java:85)
	at org.apache.tapestry.util.io.DataSqueezerImpl.squeeze
(DataSqueezerImpl.java:169)
	at $DataSqueezer_10551b42519.squeeze($DataSqueezer_10551b42519.java)
	at org.apache.tapestry.components.ForBean.storeSourceData
(ForBean.java:120)
	at org.apache.tapestry.components.ForBean.renderComponent
(ForBean.java:206)
	at org.apache.tapestry.AbstractComponent.render
(AbstractComponent.java:628)
	at org.apache.tapestry.BaseComponent.renderComponent
(BaseComponent.java:92)


-------------------------------

Source files : 

-----page class -------

This is where i set the comparator : 

public ITableColumn getBirthDateColumn() {
		SimpleTableColumn birthDateColumn = new SimpleTableColumn
("birthDate","Birth Date",new BirthDateColumnEvaluator() ,true);
                //if this line is commented i don't get the exception anymore
		birthDateColumn.setColumnComparator(new BirthDateComparator());
		return birthDateColumn;
		
	}
-----------------



BirthDateComparator.java implements Comparable and also Serializable.


--------html page ----------
<table class="mytable" jwcid="table@contrib:Table" source="ognl:dataItems" 
	columns="SSN:SSN,firstName:firstName,lastName:lastName,=birthDateColumn
 , height:height,weight:weight"
	rowsClass="ognl:evenOdd.next"
	pageSize="6"
	initialSortColumn="birthDate">
----------------


So it apears that ColumnComparator should be made Serializable .... is it so ? 
(or i did  mistake ....)


Thanks a lot !

, Alex






---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: editable contrib: Table -- java.io.NotSerializableException

Posted by alex <al...@gmail.com>.
Forgot to tell : 
I use tapestry -beta 2 , jdk1.5 , eclipse 3.1

Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: editable contrib: Table -- java.io.NotSerializableException

Posted by "Scott F. Walter" <sc...@vivare.com>.
alex wrote:

>Hi!
>
>I have an issue with editable table and don't know if is my mistake...
>
>There is a simple editable table which uses a custom comparator.(is one of the 
>examples from  the wiki page)
>
>I'll post the exception and then the source files.
>The exception is thrown in
>class : [SerializableAdaptor  ]
>method : [squeeze(DataSqueezer squeezer, Object data) throws IOException]
>line : [oos.writeObject(data);]
>
>I understand that the problem is that ColumnCmparator should be 
>serializable .... What i don't know is if there is , and where is a mistake in 
>my code.
>
>Here is the exception : 
>
>
>
>***********__________________***********
>java.io.NotSerializableException: 
>org.apache.tapestry.contrib.table.model.simple.ColumnComparator
>	at java.io.ObjectOutputStream.writeObject0
>(ObjectOutputStream.java:1075)
>	at java.io.ObjectOutputStream.defaultWriteFields
>(ObjectOutputStream.java:1369)
>	at java.io.ObjectOutputStream.writeSerialData
>(ObjectOutputStream.java:1341)
>	at java.io.ObjectOutputStream.writeOrdinaryObject
>(ObjectOutputStream.java:1284)
>	at java.io.ObjectOutputStream.writeObject0
>(ObjectOutputStream.java:1073)
>	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
>	at org.apache.tapestry.util.io.SerializableAdaptor.squeeze
>(SerializableAdaptor.java:85)
>	at org.apache.tapestry.util.io.DataSqueezerImpl.squeeze
>(DataSqueezerImpl.java:169)
>	at $DataSqueezer_10551b42519.squeeze($DataSqueezer_10551b42519.java)
>	at org.apache.tapestry.components.ForBean.storeSourceData
>(ForBean.java:120)
>	at org.apache.tapestry.components.ForBean.renderComponent
>(ForBean.java:206)
>	at org.apache.tapestry.AbstractComponent.render
>(AbstractComponent.java:628)
>	at org.apache.tapestry.BaseComponent.renderComponent
>(BaseComponent.java:92)
>
>
>-------------------------------
>
>Source files : 
>
>-----page class -------
>
>This is where i set the comparator : 
>
>public ITableColumn getBirthDateColumn() {
>		SimpleTableColumn birthDateColumn = new SimpleTableColumn
>("birthDate","Birth Date",new BirthDateColumnEvaluator() ,true);
>                //if this line is commented i don't get the exception anymore
>		birthDateColumn.setColumnComparator(new BirthDateComparator());
>		return birthDateColumn;
>		
>	}
>-----------------
>
>
>
>BirthDateComparator.java implements Comparable and also Serializable.
>
>
>--------html page ----------
><table class="mytable" jwcid="table@contrib:Table" source="ognl:dataItems" 
>	columns="SSN:SSN,firstName:firstName,lastName:lastName,=birthDateColumn
> , height:height,weight:weight"
>	rowsClass="ognl:evenOdd.next"
>	pageSize="6"
>	initialSortColumn="birthDate">
>----------------
>
>
>So it apears that ColumnComparator should be made Serializable .... is it so ? 
>(or i did  mistake ....)
>
>
>Thanks a lot !
>
>, Alex
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>
I ran into the same problem.  I had to make my comparator implmenetation 
not be an anonymous inner class and made sure it implements 
Serilizable.  I made my class a private static class by the way.  This 
was not needed under 3.0, but seems to be needed under 4.0.

scott.

-- 

Scott F. Walter 	Scott F. Walter
Principal Consultant
Vivare, Inc.

E: scott.walter@vivare.com
E: scott@scottwalter.com
Visit scottwalter.com <http://scottwalter.com> --Point.  Click.  Explore!




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org