Re: problems with spring integration
This works like a charm - thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3421269.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problems with spring integration
Hi, I believe the problem to your [Could not instantiate bean class [de.Test]: No default constructor found;] is that your are setting up a Wicket Page (without default constructor) as a managed bean in Spring, when what you actually mean was to define your [UserService] as the Spring bean. Spring doesn't to managed the Wicket pages specifically, just bind your services and then use the @SpringBean annotation on it and you will be fine. On Wed, Mar 30, 2011 at 12:56 PM, hrbaer [via Apache Wicket] < ml-node+3418488-701454310-65...@n4.nabble.com> wrote: > Just to summarize my status: > > I've added *addComponentInstantiationListener( new > SpringComponentInjector(this) );* to the init method of my xxxApplication > file, I added * class="de.service.UserService">* to my applicationContext and > withing my WebPage I have this code: > > public class Test extends WebPage { > > @SpringBean > private UserService userService; > > public Test( PageParameters params ) { > > (...) > > } > > If I add > > > > to the applicationContext I get the error "Could not instantiate bean class > [de.Test]: No default constructor found;" > > If I don't add this line I get the error message "*WicketMessage: Can't > instantiate page using constructor public > de.Test(org.apache.wicket.PageParameters) and argument > Root cause: > java.lang.ClassNotFoundException: net.sf.cglib.proxy.Callback (...)*" > > At the moment I'm at a loss. Every help would be appreciated. > > > ---------- > If you reply to this email, your message will be added to the discussion > below: > > http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3418488.html > To start a new topic under Apache Wicket, email > ml-node+1842946-398011874-65...@n4.nabble.com > To unsubscribe from Apache Wicket, click > here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>. > > -- Sincerely, JC (http://www.linkedin.com/in/jcgarciam) --Anyone who has never made a mistake has never tried anything new.-- -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3418767.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problems with spring integration
Hi, For this error: *java.lang.ClassNotFoundException: net.sf.cglib.proxy.Callback (...)* you can add the cglib-nodep library . I think, this link ( http://javajeedevelopment.blogspot.com/2011/03/integrating-spring-security-3-with.html) can help you. Thanks 2011/3/30 hrbaer > Just to summarize my status: > > I've added addComponentInstantiationListener( new > SpringComponentInjector(this) ); to the init method of my xxxApplication > file, I added to my applicationContext and withing my WebPage I have this > code: > > public class Test extends WebPage { > > @SpringBean >private UserService userService; > >public Test( PageParameters params ) { > >(...) > > } > > If I add > > > > to the applicationContext I get the error "Could not instantiate bean class > [de.Test]: No default constructor found;" > > If I don't add this line I get the error message "WicketMessage: Can't > instantiate page using constructor public > de.Test(org.apache.wicket.PageParameters) and argument > Root cause: > java.lang.ClassNotFoundException: net.sf.cglib.proxy.Callback (...)" > > At the moment I'm at a loss. Every help would be appreciated. > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3418488.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: problems with spring integration
Just to summarize my status: I've added addComponentInstantiationListener( new SpringComponentInjector(this) ); to the init method of my xxxApplication file, I added to my applicationContext and withing my WebPage I have this code: public class Test extends WebPage { @SpringBean private UserService userService; public Test( PageParameters params ) { (...) } If I add to the applicationContext I get the error "Could not instantiate bean class [de.Test]: No default constructor found;" If I don't add this line I get the error message "WicketMessage: Can't instantiate page using constructor public de.Test(org.apache.wicket.PageParameters) and argument Root cause: java.lang.ClassNotFoundException: net.sf.cglib.proxy.Callback (...)" At the moment I'm at a loss. Every help would be appreciated. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3418488.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problems with spring integration
No, I don't. So adding wicket-ioc.jar to my project solves this problem. But because of the fact I don't have a default constructor I get an exception. My constructor looks like public Test( PageParameters params ){ ... }. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3418449.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problems with spring integration
Are you using maven? If so, you should have all the dependencies you need. If not, you'll need wicket-ioc.jar On Wed, Mar 30, 2011 at 11:23 AM, hrbaer wrote: > I added wicket-spring-annot to my project, removed all of the previous spring > code and just added getComponentInstantiationListeners().add(new > SpringComponentInjector(this)); to the init method of my xxxApplication > class. > > But now I'm getting an error: > The type org.apache.wicket.injection.ComponentInjector cannot be resolved. > It is indirectly referenced from required .class files > > Any idea? > Thanks in advance. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3418401.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problems with spring integration
I added wicket-spring-annot to my project, removed all of the previous spring code and just added getComponentInstantiationListeners().add(new SpringComponentInjector(this)); to the init method of my xxxApplication class. But now I'm getting an error: The type org.apache.wicket.injection.ComponentInjector cannot be resolved. It is indirectly referenced from required .class files Any idea? Thanks in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3418401.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problems with spring integration
When you use spring there needs to be a wicket application bean defined in your applicationContext.xml, I believe the default name is "wicketApplication". So you can instruct it to be autowired by type and then use the @Autowired annotation to get services injected into the application. However for most cases this is not what you want. You need to consider the serialization aspects of wicket. The primary danger is that your service gets serialized with a Page or Panel and that the serialization cascades and serializes the entire spring container and all other beans. The page is serialized after each request including ajax requests. The normal approach is to use the @SpringBean annotation within Component inheriting classes (like Page and Panel) as this will wrap your service class in a light weight proxy that can be serialized quickly and still allow the bean lookup from the application context to occur on deserialization. The only trick is that the assignment occurs in the parent class so you need to not initialize your services to anything (otherwise you initialize the variable in the base class and it is then cleared in the current class). Do: @SpringBean (name="service") private Service service; Don't do this: @SpringBean (name="service") private Service service = null; Regards, Mike Hi all, I did some research within the forum but I didn't find the answer yet :( I tried to integrate Spring (using https://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach Spring + WICKET ) but I still have an error. I added the following lines to my web.xml: wicket org.apache.wicket.protocol.http.WicketServlet applicationFactoryClassName org.apache.wicket.spring.SpringWebApplicationFactory 1 contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener Within my xxxApplication file I added: public class HomeApplication extends AuthenticatedWebApplication { private UserService userService; public void setUserService( UserService userService ) { this.userService = userService; } public UserService getUserService() { return this.userService; } (...) And within my java file there is: public class Test extends WebPage { private UserService getUserService() { return ( (xxxApplication) getApplication()).getUserService(); } (...) } So if I start the server I invoke the setter of the method setUserService of my xxxApplication class. But once I call getUserService() of my java file the return value is null!? Any ideas? Thanks in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3416484.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
problems with spring integration
Hi all, I did some research within the forum but I didn't find the answer yet :( I tried to integrate Spring (using https://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach Spring + WICKET ) but I still have an error. I added the following lines to my web.xml: wicket org.apache.wicket.protocol.http.WicketServlet applicationFactoryClassName org.apache.wicket.spring.SpringWebApplicationFactory 1 contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener Within my xxxApplication file I added: public class HomeApplication extends AuthenticatedWebApplication { private UserService userService; public void setUserService( UserService userService ) { this.userService = userService; } public UserService getUserService() { return this.userService; } (...) And within my java file there is: public class Test extends WebPage { private UserService getUserService() { return ( (xxxApplication) getApplication()).getUserService(); } (...) } So if I start the server I invoke the setter of the method setUserService of my xxxApplication class. But once I call getUserService() of my java file the return value is null!? Any ideas? Thanks in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problems-with-spring-integration-tp3416484p3416484.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org