Re: OT: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt
I've posted my problem on tomcat mailing list and got some answers. For future reference and for anyone following this heres a link to post (on nabble archive): http://old.nabble.com/app-throws-java.lang.NoClassDefFoundError-sometimes%2C-and-sometimes-it-doesnt-to30662304.html
Re: Custom IUnauthorizedComponentInstantiationListener
hi, could u describe the proposed solution more deeply please. Idon't know, what more i should do with my iauthorizationstrategy , it has only 2 boolean methods and i don't see anything, i could improve there. Btw i use RoleAuthorizationStrategy, which is a CompoundAuthorizationStrategy. thanks, Juraj if you want to hide unauthorized components you should use iauthorizationstrategy and veto component's RENDER action -igor On Wed, Jan 5, 2011 at 1:42 AM, Durodevelma...@yahoo.com wrote: Hi, i am trying to customize the behavior, when in a page a component is found, that the current user is not authorized to while he is authorized to the page. This by default throws an exception and i want to change it so, that the component is simply not displayed. So i did this: in my web application, that is subclass of AuthenticatedWebApplication i have this init() method: @Override protected void init() { super.init(); // we customize the default behavior, when there is an component in page, that // this user can't access. Default is an exception thrown, we just set the // component not visible getSecuritySettings().setUnauthorizedComponentInstantiationListener( new IUnauthorizedComponentInstantiationListener() { @Override public void onUnauthorizedInstantiation(Component component) { if (component instanceof Page) { onUnauthorizedPage((Page) component); } else { component.detach(); } } }); } as i can see, if the unauthorized object is a page, than i call onUnauthorizedPage((Page) component) which redirects to login page, else i destroy the component. What comes out as result is that the user after accessing protected page is redirected to login page, logs in and is authentificated but than somehow the session is destroyed and new is created for some reason which results in loosing the authentication and login page is displayed again. So the user actually can't log in and always ends only in the login page. thanks for help in advance, Juraj __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.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 __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: multiple feedback panels in same page
This does not work for me: final FormString form = new FormString(form); ComponentFeedbackMessageFilter filter = new ComponentFeedbackMessageFilter(form); FeedbackPanel feedback = new FeedbackPanel(feedback, filter); feedback.setEscapeModelStrings(false); add(feedback); None of the field level validation messages of the form go into this feedback panel - which seems like a bug. I could create a feedback panel for every field - that works fine, but this is a) too much work b) you lose the errors on a long form - you need them at the top of the form as well. So I dont see why anyone would add a feedback panel to a form if it doesnt actually catch any of the field validation. Or are you supposed to write some code on each field, catch this, and manually write to the forms feedback panel using form.info(xx)? If I use ContainerFeedbackMessageFilter then I get the feedback messages in all my feedback panels - including my global one for the separate global login form which is also pants. Any ideas how to have 2 separate feedbacks for 2 separate forms, plus a global one for anything outside this? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/multiple-feedback-panels-in-same-page-tp1886384p3217563.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: multiple feedback panels in same page
Hey i think this is documented, thats who I got to know. Basically a 2 step process. You create a Behavior like: /** * This class defines a behavior so that in Feedback (on validation errors) individual * fields can be marked by the markup provided by the {@link this#getErrorMarkup()} * @author Arjun Dhar * * @param T */ public class MarkErrorFieldBehaviorT extends AbstractBehavior { private static final long serialVersionUID = 1L; @SuppressWarnings(unchecked) @Override public void onRendered(Component component) { FormComponentT fc = (FormComponentT) component; if (!fc.isValid()) { Response response = component.getResponse(); response.write(getErrorMarkup()); } } /** * Provide HTML markup to mark the error fieldbr/ * Example: lt;span style='color: red'gt;*lt;/spangt; * * @return */ protected String getErrorMarkup() { return nbsp;X; } } ..and for your field all you have to do is .add(new MarkErrorFieldBehaviorDouble()) -- add the behavior to it. In my case I'm happy with X appearing. Adapt it to put the field name or whatever text you want! -Arjun -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/multiple-feedback-panels-in-same-page-tp1886384p3217575.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
Spring Security: SecurityContext changes
Hi everyone. I am using spring security 3 with auth-roles and wicket 1.5M3, and I have a real basic implementation following the cwiki guide. It works but brokes easily: just clicking on a Home link continuosly cause the stored authentication object to get lost, in fact the SecurityContextImpl instance returned by the SecurityContextHolder (using, as of default, the ThreadLocalSecurityContextHolderStrategy) is different and of course contains a null Authentication and not the one I stored at login and that has been used for a short while. See a little log that prints the actual SecurityContext used in my implementation of AuthenticatedWebSession: 1. context: org.springframework.security.core.context.SecurityContextImpl@24c1c9c7: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@24c1c9c7: Principal: org.springframework.security.core.userdetails.User@621fc8c7: Username: daniele.dellafiore; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ADMIN; Credentials: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ADMIN 2. (the immediate next call, seconds later) context: org.springframework.security.core.context.SecurityContextImpl@: Null authentication See, different instance. How can this happen apparently random? What should I check? I used this guide: https://cwiki.apache.org/WICKET/spring-security-and-wicket-auth-roles.html following Spring security version 3 and wicket 1.4 path The only difference is that I still use in the app init() getComponentInstantiationListeners().add(new SpringComponentInjector(this, context)); where context var is autowired and this is my web.xml (substantially identical to the cwiki one) context-param param-namecontextConfigLocation/param-name param-value classpath*:web-application.xml classpath*:security.xml /param-value /context-param listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener filter filter-namefenotipi/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationFactoryClassName/param-name param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value /init-param /filter filter-mapping filter-namefenotipi/filter-name url-pattern/*/url-pattern /filter-mapping session-config session-timeout60/session-timeout /session-config -- Daniele Dellafiore http://danieledellafiore.net - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Custom IUnauthorizedComponentInstantiationListener
Juraj, ... public boolean isActionAuthorized(Component component, Action action) { return action != Component.RENDER || shouldRender(component); } private boolean shouldRender(Component component){ // your logic to check if the current user should see component } ... This is a terse and basic implementation to make the technique clear; you should get the idea and be able to extend it to fulfil your specific requirements.. Regards - Cemal jWeekend Training, Consulting, Development http://jWeekend.com On 14 January 2011 10:04, Duro develma...@yahoo.com wrote: hi, could u describe the proposed solution more deeply please. Idon't know, what more i should do with my iauthorizationstrategy , it has only 2 boolean methods and i don't see anything, i could improve there. Btw i use RoleAuthorizationStrategy, which is a CompoundAuthorizationStrategy. thanks, Juraj if you want to hide unauthorized components you should use iauthorizationstrategy and veto component's RENDER action -igor On Wed, Jan 5, 2011 at 1:42 AM, Durodevelma...@yahoo.com wrote: Hi, i am trying to customize the behavior, when in a page a component is found, that the current user is not authorized to while he is authorized to the page. This by default throws an exception and i want to change it so, that the component is simply not displayed. So i did this: in my web application, that is subclass of AuthenticatedWebApplication i have this init() method: @Override protected void init() { super.init(); // we customize the default behavior, when there is an component in page, that // this user can't access. Default is an exception thrown, we just set the // component not visible getSecuritySettings().setUnauthorizedComponentInstantiationListener( new IUnauthorizedComponentInstantiationListener() { @Override public void onUnauthorizedInstantiation(Component component) { if (component instanceof Page) { onUnauthorizedPage((Page) component); } else { component.detach(); } } }); } as i can see, if the unauthorized object is a page, than i call onUnauthorizedPage((Page) component) which redirects to login page, else i destroy the component. What comes out as result is that the user after accessing protected page is redirected to login page, logs in and is authentificated but than somehow the session is destroyed and new is created for some reason which results in loosing the authentication and login page is displayed again. So the user actually can't log in and always ends only in the login page. thanks for help in advance, Juraj __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.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 __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.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: Free wicket from component hierarchy hell
I've done some work based on Igor's implementation of component queuing. It can be found here : https://github.com/koutsoub/wicket/tree/component-queuing https://github.com/koutsoub/wicket/tree/component-queuing The code is written against the 1.4.x branch, i'm also working on making it compatible with 1.5 trunk Right now the following are supported: queue method extracts hierarchy from markup files using queue and add method together nested queue methods (queue works like add) queue method working on ListItem You can have a look at ComponentQueuingTest.java with some tests with basic usage i'll raise an issue in jira with a patch during weekend Feedback and suggestions are appreciated especially more testing scenarios -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Free-wicket-from-component-hierarchy-hell-tp3027705p3218010.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: Spring Security: SecurityContext changes
Debugging deeper, it seems that in class ThreadLocalSecurityContextHolderStrategy the field ThreadLocalSecurityContext contextHolder when called for the stored SecurityContext instance with contextHolder.get(); returns null at some point so a new instance is created. This is so strange, it's the threadLocal that does not find the stored instance? How can this happen? On Fri, Jan 14, 2011 at 5:18 PM, ilde...@gmail.com ilde...@gmail.com ww can this happen? -- Daniele Dellafiore http://danieledellafiore.net - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Spring Security: SecurityContext changes
Try using the HTTP Session Integration stuff. On Fri, Jan 14, 2011 at 11:53 AM, ilde...@gmail.com ilde...@gmail.com wrote: Debugging deeper, it seems that in class ThreadLocalSecurityContextHolderStrategy the field ThreadLocalSecurityContext contextHolder when called for the stored SecurityContext instance with contextHolder.get(); returns null at some point so a new instance is created. This is so strange, it's the threadLocal that does not find the stored instance? How can this happen? On Fri, Jan 14, 2011 at 5:18 PM, ilde...@gmail.com ilde...@gmail.com ww can this happen? -- Daniele Dellafiore http://danieledellafiore.net - 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: Spring Security: SecurityContext changes
On Fri, Jan 14, 2011 at 5:54 PM, James Carman ja...@carmanconsulting.com wrote: Try using the HTTP Session Integration stuff. What you are referring to? Anyway, I found a way to fix that, pure spring stlye: try till it works, even if you do not understand why and how :) I just added the old style web.xml additional config: filter filter-namespringSecurityFilterChain/filter-name filter-classorg.springframework.web.filter.DelegatingFilterProxy/filter-class /filter filter-mapping filter-namespringSecurityFilterChain/filter-name url-pattern/*/url-pattern /filter-mapping And now seems to work fine. The cwiki guide says is only necessary to secure static resources but either theres some bug or the statement is false. -- Daniele Dellafiore http://danieledellafiore.net - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
[Ljava.lang.String; cannot be cast to java.lang.String - BookmarkablePageRequestTargetUrlCodingStrategy
Sorry about my previous title. I'm not sure what's causing this, but I've spoken with some of my clients, who spawned these errors and they weren't manipulating the querystrings.. So I'm not sure how two pagemap paramenters are getting in there.. D/ On Jan 13, 2011, at 11:40 AM, Douglas Ferguson wrote: I see the stack trace below in my production logs quite often. I'm not sure what is causing it but it seems that this error need not happen. I.E. Why Cast this to a string when it could easily be String[] if somebody messes with the query string? Seem like a parameters.removeFirst() method could prevent this.. String pageMapNameEncoded = (String)parameters.remove(WebRequestCodingStrategy.PAGEMAP); if (requestParameters.getPageMapName() == null) { requestParameters.setPageMapName(pageMapNameEncoded); } [Ljava.lang.String; cannot be cast to java.lang.String java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String at org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:91) at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.targetForRequest(WebRequestCodingStrategy.java:537) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:191) at org.apache.wicket.protocol.https.HttpsRequestCycleProcessor.resolve(HttpsRequestCycleProcessor.java:219) at com.conducive.wicket.PRManagerApplication$8.resolve(PRManagerApplication.java:709) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:317) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Ljava.lang.String; cannot be cast to java.lang.String - BookmarkablePageRequestTargetUrlCodingStrategy
do their apache logs contain a sample of the url that caused this error? would be helpful to see one. -igor On Fri, Jan 14, 2011 at 3:12 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Sorry about my previous title. I'm not sure what's causing this, but I've spoken with some of my clients, who spawned these errors and they weren't manipulating the querystrings.. So I'm not sure how two pagemap paramenters are getting in there.. D/ On Jan 13, 2011, at 11:40 AM, Douglas Ferguson wrote: I see the stack trace below in my production logs quite often. I'm not sure what is causing it but it seems that this error need not happen. I.E. Why Cast this to a string when it could easily be String[] if somebody messes with the query string? Seem like a parameters.removeFirst() method could prevent this.. String pageMapNameEncoded = (String)parameters.remove(WebRequestCodingStrategy.PAGEMAP); if (requestParameters.getPageMapName() == null) { requestParameters.setPageMapName(pageMapNameEncoded); } [Ljava.lang.String; cannot be cast to java.lang.String java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String at org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:91) at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.targetForRequest(WebRequestCodingStrategy.java:537) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:191) at org.apache.wicket.protocol.https.HttpsRequestCycleProcessor.resolve(HttpsRequestCycleProcessor.java:219) at com.conducive.wicket.PRManagerApplication$8.resolve(PRManagerApplication.java:709) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:317) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source) - 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: [Ljava.lang.String; cannot be cast to java.lang.String - BookmarkablePageRequestTargetUrlCodingStrategy
This looks like it must have been one of them. - - [13/Jan/2011:14:26:34 -0600] GET /?wicket:interface=:26::INewBrowserWindowListener:: HTTP/1.1 302 - http://app.buzzstream.com/link_partners/wicket:pageMapName/link_partners/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/wicket:pageMapName/resources; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 GTB7.1 ( .NET CLR 3.5.30729) - - [13/Jan/2011:14:26:34 -0600] GET /?wicket:interface=wicket-8:27 HTTP/1.1 200 3163 http://app.buzzstream.com/link_partners/wicket:pageMapName/link_partners/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/wicket:pageMapName/resources; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 GTB7.1 ( .NET CLR 3.5.30729) On Jan 14, 2011, at 5:23 PM, Igor Vaynberg wrote: do their apache logs contain a sample of the url that caused this error? would be helpful to see one. -igor On Fri, Jan 14, 2011 at 3:12 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Sorry about my previous title. I'm not sure what's causing this, but I've spoken with some of my clients, who spawned these errors and they weren't manipulating the querystrings.. So I'm not sure how two pagemap paramenters are getting in there.. D/ On Jan 13, 2011, at 11:40 AM, Douglas Ferguson wrote: I see the stack trace below in my production logs quite often. I'm not sure what is causing it but it seems that this error need not happen. I.E. Why Cast this to a string when it could easily be String[] if somebody messes with the query string? Seem like a parameters.removeFirst() method could prevent this.. String pageMapNameEncoded = (String)parameters.remove(WebRequestCodingStrategy.PAGEMAP); if (requestParameters.getPageMapName() == null) { requestParameters.setPageMapName(pageMapNameEncoded); } [Ljava.lang.String; cannot be cast to java.lang.String java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String at org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:91) at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.targetForRequest(WebRequestCodingStrategy.java:537) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:191) at org.apache.wicket.protocol.https.HttpsRequestCycleProcessor.resolve(HttpsRequestCycleProcessor.java:219) at com.conducive.wicket.PRManagerApplication$8.resolve(PRManagerApplication.java:709) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:317) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source) - 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 - To unsubscribe, e-mail:
Can't get a SortableDataProvider class to accept DI of service class
The class SortableDataProvider throws a NPE. The PersonService and the GUIService that should be getting injected both end up being null values. I've tried both annotations @Autowired and @SpringBean. Neither seems to work. I turned on logging and I can see in the log that SortableDataProvider being injected but obviously it isn't happening. Not sure how to diagnose this problem? Any Ideas? Lee Here is the SortableDataProvider Class: package org.seelink.web2.ui.user; import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; import org.apache.wicket.model.IModel; import org.seelink.web2.model.role.Person; import org.seelink.web2.serv.GuiService; import org.seelink.web2.serv.PersonService; import org.seelink.web2.ui.appadm.DetachablePersonModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.io.Serializable; import java.util.Iterator; /** * Created by IntelliJ IDEA. * User: lchalupa * Date: 1/12/11 * Time: 4:31 PM * To change this template use File | Settings | File Templates. */ @Component(sortablePersonDataProvider) public class SortablePersonDataProvider extends SortableDataProviderPerson implements Serializable{ @Autowired(required=true) private PersonService personService; @Autowired(required=true) private GuiService guiService; /** * constructor */ public SortablePersonDataProvider() { // set default sort setSort(lastName, true); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int) */ public IteratorPerson iterator(int first, int count) { return getPersonService().findPersonSubset(first, count, getSort()); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#size() */ public int size() { if (personService == null ) throw new RuntimeException(personService is null value); return getPersonService().personCount(); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#model(java.lang.Object) */ public IModelPerson model(Person object) { return new DetachablePersonModel(object); } public PersonService getPersonService() { System.out.println(Person Service getter); return personService; } public void setPersonService(PersonService personService) { this.personService = personService; System.out.println(Person Service setter); } public GuiService getGuiService() { System.out.println(Gui Service getter); return guiService; } public void setGuiService(GuiService guiService) { this.guiService = guiService; System.out.println(Gui Service setter); } } Here is the stackTrace: Caused by: java.lang.NullPointerException at org.seelink.web2.ui.user.SortablePersonDataProvider.iterator(SortablePersonDataProvider.java:47) at org.apache.wicket.markup.repeater.data.DataViewBase$ModelIterator.init(DataViewBase.java:109) at org.apache.wicket.markup.repeater.data.DataViewBase.getItemModels(DataViewBase.java:76) at org.apache.wicket.markup.repeater.AbstractPageableView.getItemModels(AbstractPageableView.java:107) at org.apache.wicket.markup.repeater.RefreshingView.onPopulate(RefreshingView.java:94) at org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131) at org.apache.wicket.markup.repeater.AbstractPageableView.onBeforeRender(AbstractPageableView.java:121) at org.apache.wicket.Component.internalBeforeRender(Component.java:1073) at org.apache.wicket.Component.beforeRender(Component.java:1107) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) Here is the log entries that show the Beans getting injected: DEBUG - DefaultListableBeanFactory - Creating shared instance of singleton bean 'sortablePersonDataProvider' DEBUG - DefaultListableBeanFactory - Creating instance of bean 'sortablePersonDataProvider' DEBUG - InjectionMetadata - Found injected element on class [org.seelink.web2.ui.user.SortablePersonDataProvider]: AutowiredFieldElement for private org.seelink.web2.serv.PersonService org.seelink.web2.ui.user.SortablePersonDataProvider.personService DEBUG - InjectionMetadata - Found injected element on class [org.seelink.web2.ui.user.SortablePersonDataProvider]: AutowiredFieldElement for private org.seelink.web2.serv.GuiService org.seelink.web2.ui.user.SortablePersonDataProvider.guiService DEBUG - DefaultListableBeanFactory - Eagerly caching bean 'sortablePersonDataProvider' to allow for resolving potential circular references DEBUG - InjectionMetadata - Processing injected method of bean 'sortablePersonDataProvider': AutowiredFieldElement for private
Re: Can't get a SortableDataProvider class to accept DI of service class
Only components are automatically injected. Google a bit On Jan 14, 2011 8:08 PM, lchalupa lchal...@seelink.org wrote: The class SortableDataProvider throws a NPE. The PersonService and the GUIService that should be getting injected both end up being null values. I've tried both annotations @Autowired and @SpringBean. Neither seems to work. I turned on logging and I can see in the log that SortableDataProvider being injected but obviously it isn't happening. Not sure how to diagnose this problem? Any Ideas? Lee Here is the SortableDataProvider Class: package org.seelink.web2.ui.user; import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; import org.apache.wicket.model.IModel; import org.seelink.web2.model.role.Person; import org.seelink.web2.serv.GuiService; import org.seelink.web2.serv.PersonService; import org.seelink.web2.ui.appadm.DetachablePersonModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.io.Serializable; import java.util.Iterator; /** * Created by IntelliJ IDEA. * User: lchalupa * Date: 1/12/11 * Time: 4:31 PM * To change this template use File | Settings | File Templates. */ @Component(sortablePersonDataProvider) public class SortablePersonDataProvider extends SortableDataProviderPerson implements Serializable{ @Autowired(required=true) private PersonService personService; @Autowired(required=true) private GuiService guiService; /** * constructor */ public SortablePersonDataProvider() { // set default sort setSort(lastName, true); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int) */ public IteratorPerson iterator(int first, int count) { return getPersonService().findPersonSubset(first, count, getSort()); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#size() */ public int size() { if (personService == null ) throw new RuntimeException(personService is null value); return getPersonService().personCount(); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#model(java.lang.Object) */ public IModelPerson model(Person object) { return new DetachablePersonModel(object); } public PersonService getPersonService() { System.out.println(Person Service getter); return personService; } public void setPersonService(PersonService personService) { this.personService = personService; System.out.println(Person Service setter); } public GuiService getGuiService() { System.out.println(Gui Service getter); return guiService; } public void setGuiService(GuiService guiService) { this.guiService = guiService; System.out.println(Gui Service setter); } } Here is the stackTrace: Caused by: java.lang.NullPointerException at org.seelink.web2.ui.user.SortablePersonDataProvider.iterator(SortablePersonDataProvider.java:47) at org.apache.wicket.markup.repeater.data.DataViewBase$ModelIterator.init(DataViewBase.java:109) at org.apache.wicket.markup.repeater.data.DataViewBase.getItemModels(DataViewBase.java:76) at org.apache.wicket.markup.repeater.AbstractPageableView.getItemModels(AbstractPageableView.java:107) at org.apache.wicket.markup.repeater.RefreshingView.onPopulate(RefreshingView.java:94) at org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131) at org.apache.wicket.markup.repeater.AbstractPageableView.onBeforeRender(AbstractPageableView.java:121) at org.apache.wicket.Component.internalBeforeRender(Component.java:1073) at org.apache.wicket.Component.beforeRender(Component.java:1107) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) Here is the log entries that show the Beans getting injected: DEBUG - DefaultListableBeanFactory - Creating shared instance of singleton bean 'sortablePersonDataProvider' DEBUG - DefaultListableBeanFactory - Creating instance of bean 'sortablePersonDataProvider' DEBUG - InjectionMetadata - Found injected element on class [org.seelink.web2.ui.user.SortablePersonDataProvider]: AutowiredFieldElement for private org.seelink.web2.serv.PersonService org.seelink.web2.ui.user.SortablePersonDataProvider.personService DEBUG - InjectionMetadata - Found injected element on class [org.seelink.web2.ui.user.SortablePersonDataProvider]: AutowiredFieldElement for private org.seelink.web2.serv.GuiService org.seelink.web2.ui.user.SortablePersonDataProvider.guiService DEBUG - DefaultListableBeanFactory - Eagerly caching bean 'sortablePersonDataProvider' to allow for resolving potential circular references DEBUG - InjectionMetadata - Processing injected method of bean 'sortablePersonDataProvider': AutowiredFieldElement for private org.seelink.web2.serv.PersonService org.seelink.web2.ui.user.SortablePersonDataProvider.personService DEBUG - DefaultListableBeanFactory - Returning cached instance of singleton
Re: Can't get a SortableDataProvider class to accept DI of service class
1. Replace @Autowired with @SpringBean (do not forget to configure spring instanciation listener in WebApplication) 2. Call InjectorHolder.getInstance().inject(this) from SortableDataProvider ctor. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Can-t-get-a-SortableDataProvider-class-to-accept-DI-of-service-class-tp3218602p3218766.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
Changing/Accessing name of ListItem in ListView
Hi, when using a ListView, the name uses the following format to Render. loop name:index:field id In onSubmit(..); this is fine if you know the order of the list. However say if the primary data Structure is a hashmap then its more convenient/elegant to retrieve by Name. I can change the name of the attribute but Wicket does not recognize it when one does get(componentId). Using ListView.getList() I can access the Model, but this does not help getting the access to the individual components. Looks like the only way is to use a numberic counter and construct the Component ID's to access it one my one. Is there a way to change the component Id ..or perhaps access these by name? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Changing-Accessing-name-of-ListItem-in-ListView-tp3218777p3218777.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