dev@javaserverfaces.java.net

Re: Anyone else encountering issues resolving JSF2 validators with Jetty?

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Fri, 11 Dec 2009 11:09:42 -0800

How is the validator packaged (WEB-INF/classes or WEB-INF/lib)?



On 12/10/09 5:54 PM, Lincoln Baxter III wrote:
> package com.ocpsoft.socialpm.validator;
>
> import java.util.ResourceBundle;
>
> import javax.faces.application.FacesMessage;
> import javax.faces.component.UIComponent;
> import javax.faces.context.FacesContext;
> import javax.faces.validator.FacesValidator;
> import javax.faces.validator.Validator;
> import javax.faces.validator.ValidatorException;
>
> import com.ocpsoft.socialpm.jsf.FacesSpringContextAware;
> import com.ocpsoft.util.ResourceBundleUtil;
> import com.ocpsoft.util.StringValidations;
>
> @FacesValidator("usernameValidator")
> public class UsernameValidator extends FacesSpringContextAware
> implements Validator
> {
> private final ResourceBundle messages =
> ResourceBundleUtil.loadBundle("messages.validationBundle");
>
> @Override
> public void validate(final FacesContext context, final UIComponent
> component, final Object value)
> throws ValidatorException
> {
> String field = value.toString();
> if (!StringValidations.isAlphanumeric(field) ||
> !StringValidations.minLength(4, field)
> || !StringValidations.maxLength(15, field))
> {
> FacesMessage msg = new
> FacesMessage(messages.getString("usernameInvalidMsg"));
> throw new ValidatorException(msg);
> }
> }
>
> }
>
>
>
>
>
>
> 665779 [12716179_at_qtp-14199075-0] INFO com.ocpsoft.pretty.PrettyFilter
> - Forwarding mapped request [/register] to JSF viewId
> [/faces/register.xhtml]
> Dec 10, 2009 8:44:20 PM com.sun.faces.application.ApplicationImpl
> createValidator
> SEVERE: JSF1005: Cannot instantiate validator of type usernameValidator
> 2009-12-10 20:44:20.683::WARN: /socialpm-ui/register
> com.ocpsoft.socialpm.exceptions.SiteRuntimeException:
> javax.servlet.ServletException: javax.servlet.ServletException:
> javax.servlet.ServletException: Expression Error: Named Object:
> usernameValidator not found.
> at
> com.ocpsoft.socialpm.jsf.filter.ExceptionFilter.doFilter(ExceptionFilter.java:78)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:915)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> Caused by: javax.servlet.ServletException:
> javax.servlet.ServletException: javax.servlet.ServletException:
> Expression Error: Named Object: usernameValidator not found.
> at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:79)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:112)
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:86)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.session.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:68)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:97)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:110)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:89)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.www.BasicProcessingFilter.doFilterHttp
> <http://www.BasicProcessingFilter.doFilterHttp>(BasicProcessingFilter.java:174)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilterHttp(AbstractAuthenticationProcessingFilter.java:197)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:102)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilterHttp(SecurityContextPersistenceFilter.java:77)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:171)
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> com.ocpsoft.socialpm.jsf.filter.ExceptionFilter.doFilter(ExceptionFilter.java:65)
> ... 17 more
> Caused by: javax.servlet.ServletException:
> javax.servlet.ServletException: Expression Error: Named Object:
> usernameValidator not found.
> at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:79)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:102)
> at
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:86)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.session.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:53)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:97)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:117)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:89)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.www.BasicProcessingFilter.doFilterHttp
> <http://www.BasicProcessingFilter.doFilterHttp>(BasicProcessingFilter.java:174)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilterHttp(AbstractAuthenticationProcessingFilter.java:197)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.authentication.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:102)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilterHttp(SecurityContextPersistenceFilter.java:55)
> at
> org.springframework.security.web.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:44)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
> at
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:171)
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> com.ocpsoft.servlet.filter.ResponseTimeLoggingFilter.doFilter(ResponseTimeLoggingFilter.java:37)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
> at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
> at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:67)
> ... 54 more
> Caused by: javax.servlet.ServletException: Expression Error: Named
> Object: usernameValidator not found.
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:323)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
> at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:74)
> ... 100 more
> Caused by: javax.faces.FacesException: Expression Error: Named Object:
> usernameValidator not found.
> at
> com.sun.faces.application.ApplicationImpl.createValidator(ApplicationImpl.java:1493)
> at
> com.sun.faces.facelets.tag.jsf.ValidatorTagHandlerDelegateImpl.createValidator(ValidatorTagHandlerDelegateImpl.java:234)
> at
> com.sun.faces.facelets.tag.jsf.ValidatorTagHandlerDelegateImpl.applyAttachedObject(ValidatorTagHandlerDelegateImpl.java:128)
> at
> com.sun.faces.facelets.tag.jsf.ValidatorTagHandlerDelegateImpl.applyNested(ValidatorTagHandlerDelegateImpl.java:201)
> at
> com.sun.faces.facelets.tag.jsf.ValidatorTagHandlerDelegateImpl.apply(ValidatorTagHandlerDelegateImpl.java:83)
> at
> javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
> at
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
> at
> javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
> at
> com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
> at
> javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
> at
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
> at
> javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
> at
> com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
> at
> javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
> at
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
> at
> com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:97)
> at
> com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:172)
> at
> com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:386)
> at
> com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:357)
> at
> com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:102)
> at
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
> at
> javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:120)
> at
> com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:204)
> at
> javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:114)
> at
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
> at
> com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
> at
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
> at
> com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:149)
> at
> com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
> at
> javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:91)
> at
> com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:75)
> at
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:301)
> at
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:360)
> at
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:339)
> at
> com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:191)
> at
> com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:149)
> at
> com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
> at
> com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:75)
> at
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:301)
> at
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:360)
> at
> com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:339)
> at
> com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:191)
> at
> com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:149)
> at
> com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
> at
> com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:75)
> at
> com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:145)
> at
> com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:715)
> at
> com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
> at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
> ... 103 more
> 665803 [12716179_at_qtp-14199075-0] INFO com.ocpsoft.pretty.PrettyFilter
> - Forwarding mapped request [/error] to JSF viewId [/faces/error.xhtml]
> 665864 [12716179_at_qtp-14199075-0] INFO
> com.ocpsoft.servlet.filter.ResponseTimeLoggingFilter - Reponse
> completed in: 0.06 - /socialpm-ui/faces/error.xhtml
> 665865 [12716179_at_qtp-14199075-0] INFO
> com.ocpsoft.servlet.filter.ResponseTimeLoggingFilter - Reponse
> completed in: 0.062 - /socialpm-ui/error
>
>
> ---
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>