Hi

I´m using Guice with Wicket and i´m quite happy with it. Now I have a problem with the IOC, and i think, i´d need some help there :)

I have a service-class X

public class X{
 @Inject public X(Y y)
 {
  ...
 }
}

bound like this:

bind(X.class).in(MyScopes.SOMETHING);
bind(Y.class).to(SomeYImpl.class);


I´m trying to use it in a page:

public class P extends WebPage{
 @Inject
 private X x;

 public P(){
  ...
  x.foo();
 }
}

What i see is this:

java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
     at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:718)
     at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
     at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
     at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:164) at org.apache.wicket.guice.GuiceComponentInjector.inject(GuiceComponentInjector.java:112) at org.apache.wicket.guice.GuiceComponentInjector.onInstantiation(GuiceComponentInjector.java:193) at org.apache.wicket.Application.notifyComponentInstantiationListeners(Application.java:973)
     at org.apache.wicket.Component.<init>(Component.java:865)
     at org.apache.wicket.MarkupContainer.<init>(MarkupContainer.java:104)
     at org.apache.wicket.Page.<init>(Page.java:230)

The obvious problem can be found in LazyInitProxyFactory:

CGLibInterceptor handler = new CGLibInterceptor(type, locator);

Enhancer e = new Enhancer();
e.setInterfaces(new Class[] { Serializable.class, ILazyInitProxy.class,
IWriteReplace.class });
e.setSuperclass(type);
e.setCallback(handler);
return e.create(); // <-- !

Is it currently impossible to use constructor injection ?

cu uwe
--

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 0
F  + 49 761 3 85 59 550
E  [EMAIL PROTECTED]
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to