Re: wicket serialization problem of guice proxies

2010-05-18 Thread Uwe Schäfer

Am 18.05.2010 23:40, schrieb Christoph Grün:


I am using Wicket 1.4.8 with Guice 1.0 and Warp Persist/Hibernate.
When injecting DAOs directly into Wicket components, it works fine (I inject
the DAO Interface). However, I would like to inject them, next to other
objects, also in classes that do some business logic. Those classes are
themselves injected in Wicket pages.


we use a helper class with

public static void injectMembers(final Object o)
{
Application application = Application.get();
Assert.isNotNull(application, "Application is not attached");
Injector injector = getInjector(application);

new GuiceComponentInjector(application, injector).inject(o);

}

to inject into arbritary objects that end up in wicket space.

cu uwe

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket serialization problem of guice proxies

2010-05-18 Thread Igor Vaynberg
either use the wicket-guice module to inject into wicket pages, or
something like salve.googlecode.com to do the injection for you.

-igor

On Tue, May 18, 2010 at 2:40 PM, Christoph Grün  wrote:
> Hi all,
>
>
>
> I am using Wicket 1.4.8 with Guice 1.0 and Warp Persist/Hibernate.
>
> When injecting DAOs directly into Wicket components, it works fine (I inject
> the DAO Interface). However, I would like to inject them, next to other
> objects, also in classes that do some business logic. Those classes are
> themselves injected in Wicket pages.
>
>
>
> As these classes are injected in Wicket, Wicket tries to serialize them as
> well.
>
> For example I have the class PoiLoader that is injected in a Wicket page.
>
> @Singleton
>
> public class PoiLoader {
>
>    private Multimap poisRelatedToSpecificTouristType =
> ArrayListMultimap.create();
>
>
>
>    protected IVectorDao daoVector;
>
>
>
>    private WorkManager workManager;
>
>
>
>    private Map pois = Maps.newHashMap();
>
>
>
> }
>
>
>
> In this setting, none of the fields can be serialized and throw an   - Error
> serializing object class ecgroup.web.pages.RecommenderPage [object=[Page
> class = ecgroup.web.pages.RecommenderPage, id = 1, version = 0]]
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException
> .
>
>
>
> I need the Warp Persist Workmanager in order to do some data loading /
> initialization during Wicket startup. How can I tackle the serialization
> problems?
>
>
>
> Thanks a lot,
>
> Chris
>
>
>
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



wicket serialization problem of guice proxies

2010-05-18 Thread Christoph Grün
Hi all,

 

I am using Wicket 1.4.8 with Guice 1.0 and Warp Persist/Hibernate.

When injecting DAOs directly into Wicket components, it works fine (I inject
the DAO Interface). However, I would like to inject them, next to other
objects, also in classes that do some business logic. Those classes are
themselves injected in Wicket pages.

 

As these classes are injected in Wicket, Wicket tries to serialize them as
well. 

For example I have the class PoiLoader that is injected in a Wicket page.

@Singleton

public class PoiLoader {

private Multimap poisRelatedToSpecificTouristType =
ArrayListMultimap.create();

 

protected IVectorDao daoVector;

 

private WorkManager workManager;

 

private Map pois = Maps.newHashMap();

 

}

 

In this setting, none of the fields can be serialized and throw an   - Error
serializing object class ecgroup.web.pages.RecommenderPage [object=[Page
class = ecgroup.web.pages.RecommenderPage, id = 1, version = 0]]
org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException
.

 

I need the Warp Persist Workmanager in order to do some data loading /
initialization during Wicket startup. How can I tackle the serialization
problems?

 

Thanks a lot,

Chris