It's annonymous classes biting you. Your instance of
RenderedDynamicImageResource has an implicit reference to Image, which
isn't serializable (and which isn't something you want to keep as
component state anyway). To fix, try to move the image creation to the
render method, so that no references will be lingering around.

Eelco


On 7/14/06, Ayodeji Aladejebi <[EMAIL PROTECTED]> wrote:
>
>
> Eem..can some please helpme out here...
> I was tryin to do some back end image processing by applying some filtering
> to my image in wicket..there is a static utility class with this basic
> routines:
>
> public static WebResource adjustImage(URL imageURL, String hex){
>         BufferedDynamicImageResource bimg =  new
> BufferedDynamicImageResource();
>         try {
>             BufferedImage nimg = ImageIO.read(imageURL.openStream());
>             ImageFilter colorfilter = new BiasSwapFilter(hex);
>             final Image img = createImage(new
> FilteredImageSource(nimg.getSource(),
>                     colorfilter));
>
>             return new RenderedDynamicImageResource(img.getWidth(null),
> img.getHeight(null)) {
>                 protected boolean render(Graphics2D graphics2D) {
>                     graphics2D.drawImage(img,0,0,null);
>                     return true;
>                 }
>             };
>         } catch (IOException ex) {
>             ex.printStackTrace();
>         }
>         return bimg;
>
>     }
>
>  public static Image createImage(FilteredImageSource filteredImageSource) {
>         return
> Toolkit.getDefaultToolkit().createImage(filteredImageSource);
>     }
>
> ANyway while running to see my output, wicket gave me this error....i just
> can seem to understand......
>
>
>
>
> WicketMessage: Internal error cloning object. Make sure all dependent
> objects implement Serializable. Class:
> net.cowblock.dabar.pages.StartPage
>
> Root cause:
>
> java.io.NotSerializableException:
> sun.awt.image.ToolkitImage
>  at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1149)
>  at
>
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1502)
>  at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1467)
>  at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java
:1385)
>  at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1143)
>  at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1502)
>  at
> java.io.ObjectOutputStream.writeSerialData
(ObjectOutputStream.java:1467)
>  at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1385)
>  at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1143)
>  at
> java.io.ObjectOutputStream.defaultWriteFields
(ObjectOutputStream.java:1502)
>  at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1467)
>  at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1385)
>  at
> java.io.ObjectOutputStream.writeObject0
(ObjectOutputStream.java:1143)
>  at
> java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1331)
>  at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1139)
>  at
> java.io.ObjectOutputStream.defaultWriteFields
(ObjectOutputStream.java:1502)
>  at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1467)
>  at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1385)
>  at
> java.io.ObjectOutputStream.writeObject0
(ObjectOutputStream.java:1143)
>  at
> java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1331)
>  at
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1139)
>  at
> java.io.ObjectOutputStream.defaultWriteFields
(ObjectOutputStream.java:1502)
>  at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1467)
>  at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1385)
>  at
> java.io.ObjectOutputStream.writeObject0
(ObjectOutputStream.java:1143)
>  at
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:325)
>  at
> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:56)
>  at wicket.Session.setAttribute
(Session.java:914)
>  at wicket.PageMap.put(PageMap.java:519)
>  at wicket.Session.touch(Session.java:720)
>  at wicket.Page.renderPage(Page.java:422)
>  at
> wicket.request.target.component.BookmarkablePageRequestTarget.respond
(BookmarkablePageRequestTarget.java:226)
>  at
> wicket.request.compound.DefaultResponseStrategy.respond(DefaultResponseStrategy.java:49)
>  at
> wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond
(AbstractCompoundRequestCycleProcessor.java:66)
>  at
> wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:852)
>  at
> wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:879)
>  at wicket.RequestCycle.step
(RequestCycle.java:960)
>  at wicket.RequestCycle.steps(RequestCycle.java:1034)
>  at wicket.RequestCycle.request(RequestCycle.java:453)
>  at
> wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:215)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java
:362)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>  at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>  at
> org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:126)
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>  at
>
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>  at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>  at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
(Http11Protocol.java:744)
>  at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>  at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java
:80)
>  at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>  at java.lang.Thread.run(Thread.java:626)
>
> Complete stack:
>
> wicket.WicketRuntimeException: Internal error cloning object. Make sure all
> dependent objects implement Serializable. Class:
>
net.cowblock.dabar.pages.StartPage
>  at
> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62)
>  at wicket.Session.setAttribute(Session.java:914)
>  at wicket.PageMap.put(PageMap.java
:519)
>  at wicket.Session.touch(Session.java:720)
>  at wicket.Page.renderPage(Page.java:422)
>  at
> wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:226)
>  at
> wicket.request.compound.DefaultResponseStrategy.respond(DefaultResponseStrategy.java:49)
>  at
> wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond(AbstractCompoundRequestCycleProcessor.java
:66)
>  at
> wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:852)
>  at
> wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:879)
>  at wicket.RequestCycle.step(RequestCycle.java:960)
>  at wicket.RequestCycle.steps(RequestCycle.java:1034)
>  at wicket.RequestCycle.request(RequestCycle.java:453)
>  at
> wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:215)
>
>
> What could be wrong?
>
> thanks
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to