java.lang.ClassCastException in ListMultipleChoice
Hi guys, I have a simple question. I´m using a ListMultipleChoice in my form. The selected items should be binded to Car.color as ListCar cars. If I bind the ListMultipleChoice to cars, I´ll get a java.lang.ClassCastException because wicket trys to map a ListString to ListCar. java.lang.ClassCastException: java.lang.String cannot be cast to com.***.***.Car Any ideas??? Thanks for your help
AW: AW: java.lang.ClassCastException in ListMultipleChoice
once again trying to send this mail thanks! Von: Agent Mahone maho...@yahoo.de An: us...@wicket..apache.org Gesendet: Freitag, den 6. Februar 2009, 01:06:50 Uhr Betreff: AW: java.lang.ClassCastException in ListMultipleChoice Hi, here my example: ### CarSearchPanel ### // create formular Form form = new Form(form); BoundCompoundPropertyModel model = new BoundCompoundPropertyModel(new CarSearchModel()); form.setModel(model); ... // add cars ChoiceRenderer carRenderer = new ChoiceRenderer(); carRenderer..put(1, Mercedes);// key, value carRenderer.put(2, BMW); carRenderer.put(3, Porsche); ListMultipleChoice listMultipleChoice = new ListMultipleChoice(cars, new Model(), renderer.getKeys(), renderer);// multiple selections possible form.add(model.bind(listMultipleChoice, cars)); ... ### CarSearchModel ### private ListCar cars; public ListCar getCars() { return cars; } public void setCars(ListCar cars) { this.cars = cars; } In SearchDao class, I iterate through a List of Car objects. java.lang.ClassCastException: java.lang.String cannot be cast to com.myproject.model.core.Car at com.myproject.dao.SearchDao$7.doInHibernate(SearchDao.java:332) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339) at com.myproject.dao.SearchDao.searchCars(SearchDao..java:313) at com.myproject.usecase.core.search.SearchUseCase.searchCar(SearchUseCase.java:91) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416) at org..apache.wicket.proxy.$Proxy6.searchCar(Unknown Source) at com.myproject.web.component.content.search.car.CarSearchPanel$4.onFormSubmit(CarSearchPanel.java:174) at com.myproject.web.markup.button.FormSubmitButton$3..onSubmit(FormSubmitButton.java:117) at org.apache.wicket.ajax.markup..html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:72) at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:128) at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:163) at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:297) at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:100) at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353) at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:145) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) 2009-02-06 00:35:51,109 ERROR [http-8080-2] com.myproject.web.MyApplication: java.lang.String cannot be cast to com.myproject.model.core.Car Von: Stefan Lindner lind...@visionet.de An: users@wicket.apache.org Gesendet: Donnerstag
AW: integration Spring/Wicket/Hibernate problem with injection bean
Thanks for ur quick response. I already read this article. But I don´t like this approach calling this creation Proxy stuff when I need it for from a Wicket-Bean. private ContactDao dao = LazyInitProxyFactory.createProxy(ContractDao.class, new IProxyTargetLocator() { public Object locateProxyTarget() { return ((MyApplication)Application.get()).getSpringContext().getBean(contactDao); } } } I´m knew to it and I´m struggeling for the right solution. Is there no possibility to tell spring or wicket to do that in the background. I´m just don´t want to care about it... is it now a dao bean or simple bean or this special kind of wicket bean which I have to instantiate in another way. What I want is simple to set this stuff in the applicationContext file. And that spring does the injection throug the setter-method. Thanks in advance for ur comments. I apprciate it very much. Cheers Phil __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com
Wicket and Mootools?
Hi all What is the best way to integrate mootools in wicket ? Does Mootools slow down the application? Does somebody had good expierence with it? Thanks in advane for any comments __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com
AW: Wicket and Mootools?
O, thank u very much for ur comments. I have some questions to you: 1. What is the package mini under contribution package for? What is the difference to package contribution/wicket-mootools??? 2. I also noticed that wicket offers you scriptaculous and jquery. Is there any comparsion between that frameworks? I´ve seen that scriptaculous is much more easier to understand and difinitely to use. Thanks again for any comments - Ursprüngliche Mail Von: Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] An: users@wicket.apache.org Gesendet: Donnerstag, den 18. September 2008, 09:50:32 Uhr Betreff: Re: Wicket and Mootools? You can also check out the new addition to wicket stuff minis, the mootips integration.. Agent Mahone wrote: Hi all What is the best way to integrate mootools in wicket ? Does Mootools slow down the application? Does somebody had good expierence with it? Thanks in advane for any comments __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com
AjaxRequestTarget is null in Internet Explorer 6
Hi all I´m struggeling with the AjaxFallbackLink the target object is null, if it runs to the onClick() method. In Firefox and Opera it works fine!!! class MyPanel extends Panel { private AjaxFallbackLink link; public MyPanel() { this.link = AjaxFallbackLink(link); add(link); } public void onClick(AjaxRequestTarget target) { if (target == null) { System.out.println(my target is: + target); //target is null } else { System.out.println(my target is: + target); target.appendJavascript(alert('is working');); } } ... } class MyPage extends WebPage { private MyPanel myPanel; public MyPage() { this.myPanel = new MyPanel(myPanel); add(myPanel); } } If I add the AjaxFallbackLink to a WebPage instead to a Panel it works pretty fine. What I do is: - call the page and click the link - refresh the page through F5 - once again click the link __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com
AW: SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1
Hello guys The only thing what I was trying to do was, to execute some code if a time out occurs. (mark that user is not anymore available or online). How then can I achieve this behaviour? Am I forced to use the classic instantiation through the new operator? Or is there any other solution? Von: Igor Vaynberg [EMAIL PROTECTED] An: users@wicket.apache.org Gesendet: Dienstag, den 11. November 2008, 18:48:24 Uhr Betreff: Re: SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1 wouldnt say its a bug, looks like a method invocation is done on a wicket-spring proxy outside a wicket request and it cannot find the application when it tries to resolve the application context. those proxies are not mean to be used outside wicket requests. -igor On Tue, Nov 11, 2008 at 7:11 AM, Martijn Dashorst [EMAIL PROTECTED] wrote: I guess org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51) has a bug because it assumes it is always called inside the scope of a wicket request. Martijn On Tue, Nov 11, 2008 at 12:59 PM, Agent Mahone [EMAIL PROTECTED] wrote: Hi guys I´m just trying to execute some code after a session timeout occurs. I´m using spring / wicket / hibernate frameworks. Why do I get this error WicketRuntimeException: There is no application attached to current thread http-8080-1? I´m not getting it...I appreciate any hints. Thanks in advance !!! Here is my application class: public class MyApplication extends SpringWebApplication implements HttpSessionListener { protected void init() { //some code } public Session newSession(Request request, Response response) { return new MySession(request); } public ClassIndexPage getHomePage() { return IndexPage.class; } public Object getBean(Class? clazz, String beanName) { return createSpringBeanProxy(clazz, beanName); } @Override public void sessionCreated(HttpSessionEvent arg0) { //nothing sepcial } @Override public void sessionDestroyed(HttpSessionEvent arg0) { String sessionId = arg0.getSession().getId(); IRegistrationLoginUseCase bean = (ILoginService)getBean(ILoginService.class, loginService); bean.logout(sessionId); } Here is my error stack trace: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread http-8080-1 at org.apache.wicket.Application.get(Application.java:166) at org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51) at org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:176) at org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:162) at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:412) at org.apache.wicket.proxy.$Proxy3.logout(Unknown Source) at com.studentcv.web.MyApplication.sessionDestroyed(StudentCVApplication.java:82) at org.apache.catalina.session.StandardSession.expire(StandardSession.java:702) at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592) at org.apache.catalina.connector.Request.doGetSession(Request.java:2287) at org.apache.catalina.connector.Request.getSession(Request.java:2075) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833) at org.apache.wicket.protocol.http.AbstractHttpSessionStore.getSessionId(AbstractHttpSessionStore.java:180) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:303) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) -- Become a Wicket expert
SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1
Hi guys I´m just trying to execute some code after a session timeout occurs. I´m using spring / wicket / hibernate frameworks. Why do I get this error WicketRuntimeException: There is no application attached to current thread http-8080-1? I´m not getting it...I appreciate any hints. Thanks in advance !!! Here is my application class: public class MyApplication extends SpringWebApplication implements HttpSessionListener { protected void init() { //some code } public Session newSession(Request request, Response response) { return new MySession(request); } public ClassIndexPage getHomePage() { return IndexPage.class; } public Object getBean(Class? clazz, String beanName) { return createSpringBeanProxy(clazz, beanName); } @Override public void sessionCreated(HttpSessionEvent arg0) { //nothing sepcial } @Override public void sessionDestroyed(HttpSessionEvent arg0) { String sessionId = arg0.getSession().getId(); IRegistrationLoginUseCase bean = (ILoginService)getBean(ILoginService.class, loginService); bean.logout(sessionId); } Here is my error stack trace: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread http-8080-1 at org.apache.wicket.Application.get(Application.java:166) at org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51) at org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:176) at org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:162) at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:412) at org.apache.wicket.proxy.$Proxy3.logout(Unknown Source) at com.studentcv.web.MyApplication.sessionDestroyed(StudentCVApplication.java:82) at org.apache.catalina.session.StandardSession.expire(StandardSession.java:702) at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592) at org.apache.catalina.connector.Request.doGetSession(Request.java:2287) at org.apache.catalina.connector.Request.getSession(Request.java:2075) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833) at org.apache.wicket.protocol.http.AbstractHttpSessionStore.getSessionId(AbstractHttpSessionStore.java:180) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:303) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)
AW: SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1
Hello Igor, I just right now came back to my point. Followed your hint and thinking once about it. You´re right, it works with vanilla spring :-) Thank you very much for your great help!!! Von: Igor Vaynberg [EMAIL PROTECTED] An: users@wicket.apache.org Gesendet: Dienstag, den 11. November 2008, 23:45:33 Uhr Betreff: Re: SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1 you can retrieve the application context via the servlet context and use vanilla spring to do whatever it is you are trying to do. you only need the proxies when dealing from inside wicket - which you do not appear to be doing. -igor On Tue, Nov 11, 2008 at 1:06 PM, Agent Mahone [EMAIL PROTECTED] wrote: Hello guys The only thing what I was trying to do was, to execute some code if a time out occurs. (mark that user is not anymore available or online). How then can I achieve this behaviour? Am I forced to use the classic instantiation through the new operator? Or is there any other solution? Von: Igor Vaynberg [EMAIL PROTECTED] An: users@wicket.apache.org Gesendet: Dienstag, den 11. November 2008, 18:48:24 Uhr Betreff: Re: SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1 wouldnt say its a bug, looks like a method invocation is done on a wicket-spring proxy outside a wicket request and it cannot find the application when it tries to resolve the application context. those proxies are not mean to be used outside wicket requests. -igor On Tue, Nov 11, 2008 at 7:11 AM, Martijn Dashorst [EMAIL PROTECTED] wrote: I guess org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51) has a bug because it assumes it is always called inside the scope of a wicket request. Martijn On Tue, Nov 11, 2008 at 12:59 PM, Agent Mahone [EMAIL PROTECTED] wrote: Hi guys I´m just trying to execute some code after a session timeout occurs. I´m using spring / wicket / hibernate frameworks. Why do I get this error WicketRuntimeException: There is no application attached to current thread http-8080-1? I´m not getting it...I appreciate any hints. Thanks in advance !!! Here is my application class: public class MyApplication extends SpringWebApplication implements HttpSessionListener { protected void init() { //some code } public Session newSession(Request request, Response response) { return new MySession(request); } public ClassIndexPage getHomePage() { return IndexPage.class; } public Object getBean(Class? clazz, String beanName) { return createSpringBeanProxy(clazz, beanName); } @Override public void sessionCreated(HttpSessionEvent arg0) { //nothing sepcial } @Override public void sessionDestroyed(HttpSessionEvent arg0) { String sessionId = arg0.getSession().getId(); IRegistrationLoginUseCase bean = (ILoginService)getBean(ILoginService.class, loginService); bean.logout(sessionId); } Here is my error stack trace: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread http-8080-1 at org.apache.wicket.Application.get(Application.java:166) at org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51) at org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:176) at org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:162) at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:412) at org.apache.wicket.proxy.$Proxy3.logout(Unknown Source) at com.studentcv.web.MyApplication.sessionDestroyed(StudentCVApplication.java:82) at org.apache.catalina.session.StandardSession.expire(StandardSession.java:702) at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592) at org.apache.catalina.connector.Request.doGetSession(Request.java:2287) at org.apache.catalina.connector.Request.getSession(Request.java:2075) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833) at org.apache.wicket.protocol.http.AbstractHttpSessionStore.getSessionId(AbstractHttpSessionStore.java:180) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:303) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233