Hi,

On Wed, Feb 6, 2019 at 7:55 PM Vit Rozkovec <vit.rozko...@gmail.com> wrote:

> Hi,
>
> have any of you tried to inject Jdbi [1] via Guice to your component
> hierarchy? I cannot do so without using intermediate Jdbi supplier.
>

Using supplier/provider is perfectly fine!


>
> Please see this issue:
>
> https://github.com/jdbi/jdbi/issues/1451
>
> I've tried to turn off wrapping in proxies for Guice, but it gives me:
>
> org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException:
> The object type is not Serializable!
> A problem occurred while checking object with type: org.jdbi.v3.core.Jdbi
>

As you already know this is not good. The appication should not
(de)serialize the Jdbi instance between requests.


>
> with wrapInProxies set to true in GuiceComponentInjector the exception is:
>
> java.lang.IllegalArgumentException: No visible constructors in class
> org.jdbi.v3.core.Jdbi
>

You can try to add Objenesis to the classpath. LazyInitProxyFactory will
use it instead of CGLIB if it is available.
CGLIB requires the constructor.


>
> I see where it comes from: LazyInitProxyFactory
>
> It seems to me that it is possible only to make happy Guice or Wicket,
> but not both.
>

Just use supplier/provider!


>
> Any hints appreciated.
>
> Thank you.
>
> Vit
>
>
> [1] http://jdbi.org/
>
>

Reply via email to