Note that there are some explanatory texts on larger screens.

plurals
  1. POException during processing of event of type AFTER_FILTER_EVENT
    primarykey
    data
    text
    <p>I've googled this so many times now, without any luck. Hope you are able to help me.</p> <p>I have a web project that uses JSF Mojarra 2.1, Primefaces 3.1. The project uses Spring Security for handling authentication.</p> <p>The project is running on Glassfish 3.1.1, so I'm using the JSF version provided.</p> <p>The problem is that after I logon, I get the following Exception when the main.xhtml page should be rendered.</p> <pre><code>java.lang.RuntimeException: WEB5001: Exception during processing of event of type AFTER_FILTER_EVENT for web module StandardEngine[glassfish-web].StandardHost[server].StandardContext[/sormAdmin2] at com.sun.web.server.J2EEInstanceListener.handleAfterEvent(J2EEInstanceListener.java:344) at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:112) at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:314) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:273) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:662) </code></pre> <p>Caused by: org.glassfish.api.invocation.InvocationException at org.glassfish.api.invocation.InvocationManagerImpl.postInvoke(InvocationManagerImpl.java:190) at com.sun.web.server.J2EEInstanceListener.handleAfterEvent(J2EEInstanceListener.java:339) ... 28 more</p> <p>On the login-page:</p> <pre><code>$&lt;h:panelGrid columns="2" cellpadding="5" styleClass="messageGrid"&gt; &lt;h:outputLabel for="username" value="Username:" /&gt; &lt;p:inputText value="#{loginBean.username}" id="username" required="true" label="username" /&gt; &lt;h:outputLabel for="password" value="Password:" /&gt; &lt;p:password value="#{loginBean.password}" id="password" required="true" label="password" feedback="false" /&gt; &lt;f:facet name="footer"&gt; &lt;p:commandButton value="Login" action="#{loginBean.login}" /&gt; &lt;/f:facet&gt; &lt;h:messages&gt;&lt;/h:messages&gt; &lt;/h:panelGrid&gt; </code></pre> <p>The LoginBean:</p> <pre><code>package this.is.my.mb; import java.io.Serializable; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import javax.servlet.http.HttpSession; import this.is.my.ejb.beans.session.remote.UserRemote; import this.is.my.ejb.ejb.vo.User; import this.is.my.utils.EJBHandler; import org.apache.commons.lang.NotImplementedException; import org.primefaces.component.layout.LayoutUnit; import org.primefaces.context.RequestContext; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; @ManagedBean(name = "loginBean", eager=true) @SessionScoped public class LoginBean implements Serializable { @PostConstruct public void init() { //checkUser(); } /** * */ private static final long serialVersionUID = 1L; private UserRemote userRemote; private User user; private String username; private String password; public LoginBean() { layoutCenter = new LayoutUnit(); layoutLeft = new LayoutUnit(); layoutRight = new LayoutUnit(); //layoutLogin = new LayoutUnit(); } public String login() { FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", getUsername()); boolean loggedIn = true; String redirectTo = "/user/main.xhtml?faces-redirect=true"; try { EJBHandler ejbHandler2 = new EJBHandler(); userRemote = ejbHandler2.getUserRemote(); if(userRemote != null) user = userRemote.sjekkBruker(getUsername(), getPassword()); if(user != null) { System.out.println("User != null: accessLevel: " + user.getAccessLevel()); Authentication rfesult = new Authentication() { @Override public String getName() { // TODO Auto-generated method stub return username; } @Override public boolean isAuthenticated() { return true; } @Override public Object getPrincipal() { throw new NotImplementedException(); } @Override public Object getDetails() { throw new NotImplementedException(); } @Override public Collection&lt;GrantedAuthority&gt; getAuthorities() { GrantedAuthority ga = new GrantedAuthority() { private static final long serialVersionUID = 1132123132132L; @Override public String getAuthority() { return "ROLE_USER"; } }; GrantedAuthority g2a = new GrantedAuthority() { private static final long serialVersionUID = 1132123132132L; @Override public String getAuthority() { return "ROLE_STATS"; } }; GrantedAuthority g3a = new GrantedAuthority() { private static final long serialVersionUID = 1132123132132L; @Override public String getAuthority() { return "ROLE_ADMIN"; } }; Collection&lt;GrantedAuthority&gt; list = new ArrayList&lt;GrantedAuthority&gt;(); if(user.getAccessLevel() == 3 || user.getAccessLevel() == 1) { list.add(ga); } if(user.getAccessLevel() == 2 || user.getAccessLevel() == 1) { list.add(g2a); } if(user.getAccessLevel() == 1) { list.add(g3a); } return list; } @Override public Object getCredentials() { throw new NotImplementedException(); } @Override public void setAuthenticated(boolean arg0) throws IllegalArgumentException { throw new NotImplementedException(); } }; checkUser(); SecurityContextHolder.getContext().setAuthentication(rfesult); if(user.getAccessLevel() == 2) { // user only has access to statistics redirectTo = "/stats/getstats.jsf?faces-redirect=true"; } if(user.getAccessLevel() &lt; 1) { redirectTo = "/login/login.xhtml?faces-redirect=true"; msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Login failed", "Wrong username and/or password"); loggedIn = false; } } else { msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Login failed", "Wrong username and/or password"); loggedIn = false; redirectTo = null; System.out.println("User == null"); } } catch (SQLException e) { e.printStackTrace(); } FacesContext.getCurrentInstance().addMessage(null, msg); RequestContext context = RequestContext.getCurrentInstance(); if(context != null) context.addCallbackParam("loggedIn", loggedIn); System.out.println(redirectTo); return redirectTo; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getUsername() { checkUser(); return username;}} </code></pre> <p>My web.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt; &lt;display-name&gt;JavaServerFaces&lt;/display-name&gt; &lt;!-- Change to "Production" when you are ready to deploy --&gt; &lt;context-param&gt; &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt; &lt;param-value&gt;Development&lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- for EL 2.2--&gt; &lt;context-param&gt; &lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt; &lt;param-value&gt;com.sun.el.ExpressionFactoryImpl&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt; /WEB-INF/applicationContext*.xml &lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.security.web.session.HttpSessionEventPublisher&lt;/listener-class&gt; &lt;/listener&gt; &lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;error-page&gt; &lt;exception-type&gt;javax.faces.application.ViewExpiredException&lt;/exception-type&gt; &lt;location&gt;/login.xhtml&lt;/location&gt; &lt;/error-page&gt; &lt;session-config&gt; &lt;session-timeout&gt;300&lt;/session-timeout&gt; &lt;/session-config&gt; &lt;context-param&gt; &lt;param-name&gt;javax.faces.DEFAULT_SUFFIX&lt;/param-name&gt; &lt;param-value&gt;.xhtml&lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- Welcome page --&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;!-- JSF mapping --&gt; &lt;servlet&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;!-- Map these files with JSF --&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.faces&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;context-param&gt; &lt;param-name&gt;primefaces.THEME&lt;/param-name&gt; &lt;param-value&gt;redmond&lt;/param-value&gt; &lt;/context-param&gt; &lt;mime-mapping&gt; &lt;extension&gt;png&lt;/extension&gt; &lt;mime-type&gt;image/png&lt;/mime-type&gt; &lt;/mime-mapping&gt; &lt;/web-app&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload