Re: [Wicket-user] Wicket requiring one of my Spring managed beans to have a default constructor
Not directly related to your question, but you might like to know that the name property of @SpringBean defaults to your field name, so you could have written it like this... @SpringBean private ContentSettings contentSettings; @SpringBean private LearningItemRepository learningItemRepository; jk On Wed, May 09, 2007 at 05:36:52PM -0500, Matt Welch wrote: I am using the @SpringBean annotation to instantiate Spring dependencies in my wicket pages but I have one page that is giving me a error that I'm having trouble dealing with. Here's an example. The Wicket page class: public class Viewer extends WebPage { @SpringBean(name = contentSettings) private ContentSettings contentSettings; @SpringBean(name = learningItemRepository) private LearningItemRepository learningItemRepository; public Viewer() { //add some simple components to the page } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Wicket requiring one of my Spring managed beans to have a default constructor
Thanks. That's great information to have. I now have a couple of clear directions I can go to solve the issue. On 5/9/07, Igor Vaynberg [EMAIL PROTECTED] wrote: if your class is an interface then wicket will create a jdk proxy. if your class is not an interface then we cannot create this proxy, so wicket uses cglib to create a proxy from a concrete class. having this empty constructor must be a cglib requirement. -igor - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Wicket requiring one of my Spring managed beans to have a default constructor
I am using the @SpringBean annotation to instantiate Spring dependencies in my wicket pages but I have one page that is giving me a error that I'm having trouble dealing with. Here's an example. The Wicket page class: public class Viewer extends WebPage { @SpringBean(name = contentSettings) private ContentSettings contentSettings; @SpringBean(name = learningItemRepository) private LearningItemRepository learningItemRepository; public Viewer() { //add some simple components to the page } } The vast majority of the time, my Spring managed beans are implementations of interfaces and not standalone concrete classes, however, in this particular situation I have about a dozen or so beans that don't need to follow that pattern. LearningRepository is an interface with a concrete implementation. ContentSettings on the other hand is a standalone concrete class. Both classes are properly setup in my Spring configuration xml files and I have a suite of unit tests which load the classes using Spring so I know that they should work. In fact, LearningRepository does work fine, but I'm getting an error from Wicket with regards to the the ContentSettings class: - 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:138) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue (AnnotProxyFieldValueFactory.java:102) at org.apache.wicket.injection.Injector.inject(Injector.java:109) at org.apache.wicket.injection.ConfigurableInjector.inject( ConfigurableInjector.java:40) at org.apache.wicket.injection.ComponentInjector.onInstantiation( ComponentInjector.java:54) at org.apache.wicket.Application.notifyComponentInstantiationListeners( Application.java:914) at org.apache.wicket.Component.init(Component.java:606) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:111) at org.apache.wicket.Page.init(Page.java:195) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:97) at com.ptc.fusion.web.pages.FusionBasePage.init(FusionBasePage.java:18) at com.ptc.fusion.web.pages.viewer.Viewer.init(Viewer.java:41) at com.ptc.fusion.web.pages.viewer.Viewer$1.getPage(Viewer.java:79) at org.apache.wicket.markup.html.link.PageLink.onClick(PageLink.java:153) at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:222) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.wicket.RequestListenerInterface.invoke( RequestListenerInterface.java:186) at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents (ListenerInterfaceRequestTarget.java:73) at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents( AbstractRequestCycleProcessor.java:90) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java :962) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1035) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1114) at org.apache.wicket.RequestCycle.request(RequestCycle.java:474) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:248) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java :122) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter( ServletHandler.java:1065) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal (OpenSessionInViewFilter.java:173) at org.springframework.web.filter.OncePerRequestFilter.doFilter( OncePerRequestFilter.java:77) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter( ServletHandler.java:1065) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java :185) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391) at org.mortbay.jetty.handler.ContextHandlerCollection.handle( ContextHandlerCollection.java:146) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java :114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:285) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete( HttpConnection.java:751)
Re: [Wicket-user] Wicket requiring one of my Spring managed beans to have a default constructor
you have to have an empty constructor. afaik it doesnt have to be public. this is so that cglib can create a proxy, i dont think there is a way around it. -igor On 5/9/07, Matt Welch [EMAIL PROTECTED] wrote: I am using the @SpringBean annotation to instantiate Spring dependencies in my wicket pages but I have one page that is giving me a error that I'm having trouble dealing with. Here's an example. The Wicket page class: public class Viewer extends WebPage { @SpringBean(name = contentSettings) private ContentSettings contentSettings; @SpringBean(name = learningItemRepository) private LearningItemRepository learningItemRepository; public Viewer() { //add some simple components to the page } } The vast majority of the time, my Spring managed beans are implementations of interfaces and not standalone concrete classes, however, in this particular situation I have about a dozen or so beans that don't need to follow that pattern. LearningRepository is an interface with a concrete implementation. ContentSettings on the other hand is a standalone concrete class. Both classes are properly setup in my Spring configuration xml files and I have a suite of unit tests which load the classes using Spring so I know that they should work. In fact, LearningRepository does work fine, but I'm getting an error from Wicket with regards to the the ContentSettings class: - 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:138) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue (AnnotProxyFieldValueFactory.java:102) at org.apache.wicket.injection.Injector.inject(Injector.java :109) at org.apache.wicket.injection.ConfigurableInjector.inject( ConfigurableInjector.java:40) at org.apache.wicket.injection.ComponentInjector.onInstantiation( ComponentInjector.java:54) at org.apache.wicket.Application.notifyComponentInstantiationListeners ( Application.java:914) at org.apache.wicket.Component.init(Component.java:606) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:111) at org.apache.wicket.Page.init( Page.java:195) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:97) at com.ptc.fusion.web.pages.FusionBasePage.init(FusionBasePage.java:18) at com.ptc.fusion.web.pages.viewer.Viewer .init(Viewer.java:41) at com.ptc.fusion.web.pages.viewer.Viewer$1.getPage(Viewer.java:79) at org.apache.wicket.markup.html.link.PageLink.onClick(PageLink.java:153) at org.apache.wicket.markup.html.link.Link.onLinkClicked (Link.java:222) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.wicket.RequestListenerInterface.invoke( RequestListenerInterface.java:186) at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents( ListenerInterfaceRequestTarget.java:73) at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents( AbstractRequestCycleProcessor.java:90) at org.apache.wicket.RequestCycle.processEventsAndRespond ( RequestCycle.java:962) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1035) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1114) at org.apache.wicket.RequestCycle.request(RequestCycle.java :474) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java :248) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java :122) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter ( ServletHandler.java:1065) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal (OpenSessionInViewFilter.java:173) at org.springframework.web.filter.OncePerRequestFilter.doFilter ( OncePerRequestFilter.java:77) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter( ServletHandler.java:1065) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java :365) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java :185) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java :181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391) at org.mortbay.jetty.handler.ContextHandlerCollection.handle( ContextHandlerCollection.java:146) at org.mortbay.jetty.handler.HandlerCollection.handle ( HandlerCollection.java:114) at
Re: [Wicket-user] Wicket requiring one of my Spring managed beans to have a default constructor
Thanks for that confirmation, Igor. I guess I was just a little surprised because none of my other classes that are instantiated using the same technique have an empty constructor. I guess that there must be something at play there having to do with the fact that those other classes are implementations of interfaces as opposed to being a standalone concrete classes the way ContentSettings is. -Matt On 5/9/07, Igor Vaynberg [EMAIL PROTECTED] wrote: you have to have an empty constructor. afaik it doesnt have to be public. this is so that cglib can create a proxy, i dont think there is a way around it. -igor - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Wicket requiring one of my Spring managed beans to have a default constructor
if your class is an interface then wicket will create a jdk proxy. if your class is not an interface then we cannot create this proxy, so wicket uses cglib to create a proxy from a concrete class. having this empty constructor must be a cglib requirement. -igor On 5/9/07, Matt Welch [EMAIL PROTECTED] wrote: Thanks for that confirmation, Igor. I guess I was just a little surprised because none of my other classes that are instantiated using the same technique have an empty constructor. I guess that there must be something at play there having to do with the fact that those other classes are implementations of interfaces as opposed to being a standalone concrete classes the way ContentSettings is. -Matt On 5/9/07, Igor Vaynberg [EMAIL PROTECTED] wrote: you have to have an empty constructor. afaik it doesnt have to be public. this is so that cglib can create a proxy, i dont think there is a way around it. -igor - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user