[ 
https://issues.apache.org/jira/browse/WICKET-1403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597792#action_12597792
 ] 

javadoc edited comment on WICKET-1403 at 5/18/08 1:33 AM:
---------------------------------------------------------------

In the meantime, i found this little nasty hack to get the state serialized.

The Problem is, that Guice´s Type is not Serializable right now. The solution 
was to store it in the Application´s MetaData, which is of course lost when 
restarting the Application.

What i do here (see Attachment: GuiceProxyTargetLocator.java) is using XStream 
in order to 'serialize' the Type to XML, which then can be serialized normally, 
so that the MetaData-stuff can be dropped.

This is of course not a valid solution to the above problem, as it introduces a 
dependency to XStream, but it temporarily makes the roundtrip with guice 
possible.

To anyone using this hack: note that XStream does not necessarily behave 
consistently on any JVM:
http://xstream.codehaus.org/faq.html#Compatibility.

I also asked the Guice-guys to make Type Serializable, which would solve the 
whole thing.

      was (Author: javadoc):
    In the meantime, i found this little nasty hack to get the state serialized.

The Problem is, that Guice´s Type is not Serializable right now. The solution 
was to store it in the Application´s MetaData, which is of course lost when 
restarting the Application.

What i do here is using XStream in order to 'serialize' the Type to XML, which 
then can be serialized normally, so that the MetaData-stuff can be dropped.

This is of course not a valid solution to the above problem, as it introduces a 
dependency to XStream, but it temporarily makes the roundtrip with guice 
possible.

To anyone using this hack: note that XStream does not necessarily behave 
consistently on any JVM:
http://xstream.codehaus.org/faq.html#Compatibility.

I also asked the Guice-guys to make Type Serializable, which would solve the 
whole thing.
  
> Reinjection fails after Server restart
> --------------------------------------
>
>                 Key: WICKET-1403
>                 URL: https://issues.apache.org/jira/browse/WICKET-1403
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-guice
>    Affects Versions: 1.3.1
>         Environment: Resin 3.1.5 with persistent sessions enabled,
> Apache Tomcat 6.0.16 with persistent sessions enabled 
>            Reporter: uwe schaefer
>            Assignee: Alastair Maw
>            Priority: Minor
>         Attachments: example.zip, GuiceProxyTargetLocator.java
>
>
> Please see attached testcase. 
> Steps to reproduce: 
> * start it with mvn resin:run, go to http://localhost:8080/example
> * click a few times
> * stop & restart 
> * reload the page (everything fine here (means reload obviously succeeds)
> * click again, you´ll face
> {code}
> Caused by: java.lang.NullPointerException: type
>       at com.google.inject.util.Objects.nonNull(Objects.java:35)
>       at com.google.inject.TypeLiteral.<init>(TypeLiteral.java:69)
>       at 
> com.google.inject.TypeLiteral$SimpleTypeLiteral.<init>(TypeLiteral.java:181)
>       at com.google.inject.TypeLiteral.get(TypeLiteral.java:169)
>       at 
> org.apache.wicket.guice.GuiceProxyTargetLocator.locateProxyTarget(GuiceProxyTargetLocator.java:61)
>       at 
> org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:412)
>       at org.apache.wicket.proxy.$Proxy13.foo(Unknown Source)
>       at org.codesmell.HomePage$1.onClick(HomePage.java:25)
>       at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:214)
>       ... 21 more
> {code}
> GuiceProxyTargetLocator does not seem to be coded to cope with this. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to