1 Reply Latest reply on Jan 14, 2009 2:29 PM by Mika Jylha

    Error org.apache.catalina.connector.RequestFacade cannot be

    Mika Jylha Newbie

      I have a web application that we are currently porting to java 6. It runs fine with older versions of JBoss 4.2 but not on 5.0.0.GA. We have been able to get it running on tomcat 6.0.18 and java 6, as well as Websphere 7.

      Below is the stack dump when we hit the app. The error is in some filter code. Has anyone seen this error before? Is this a bug or are we missing something?

      2009-01-14 14:06:09,718 INFO [org.jboss.bootstrap.microcontainer.ServerImpl] (main) JBoss (Microcontainer) [5.0.0.GA (build: SVNTag=JBoss_5_0_0_GA date=200812042120)] Started in 1m:44s:750ms
      2009-01-14 14:06:43,406 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/SUITCASEV3.2.0].[jsp]] (http-127.0.0.1-8080-1) Servlet.service() for servlet jsp threw exception
      java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to javax.servlet.http.HttpServletRequest
       at com.wgd.servlets.LanguageFilter.doFilter(LanguageFilter.java:34)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)
      2009-01-14 14:06:43,656 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/SUITCASEV3.2.0].[jsp]] (http-127.0.0.1-8080-1) Servlet.service() for servlet jsp threw exception
      java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletResponse"
       at org.apache.jsp.error_jsp._jspService(error_jsp.java:43)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
       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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:446)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
       at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:416)
       at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:270)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)
      2009-01-14 14:06:43,656 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] (http-127.0.0.1-8080-1) Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/error.jsp]
      javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletResponse"
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
       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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:446)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
       at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:416)
       at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:270)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletResponse"
       at org.apache.jsp.error_jsp._jspService(error_jsp.java:43)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
       ... 18 more


      And the spot in the java code where the error is thrown:
      package com.wgd.servlets;
      
      import java.io.IOException;
      
      import javax.servlet.FilterChain;
      import javax.servlet.FilterConfig;
      import javax.servlet.ServletException;
      import javax.servlet.ServletRequest;
      import javax.servlet.ServletResponse;
      import javax.servlet.http.HttpServletRequest;
      
      import com.wgd.logging.LogUtil;
      import com.wgd.user.CaseUser;
      import com.wgd.util.ActiveLanguage;
      
      /**
       * servlet.Filter implement for setting the ActiveLanguage in the thread.
       */
      public class LanguageFilter extends WgdFilter {
       private static final String INIT_PARAM_SESSION_KEY = "user.session.key";
       private static String sessionKey = "";
      
       /* (non-Javadoc)
       * @see javax.servlet.Filter#destroy()
       */
       @Override
       public void destroy() {}
      
       /* (non-Javadoc)
       * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
       */
       public void doFilter(ServletRequest request, ServletResponse response,
       FilterChain filterChain) throws IOException, ServletException {
       String uri = ((HttpServletRequest)request).getRequestURI();
      
       if( filterUrl(uri) ){
       // ***
       // Dies on the following line
       //
       CaseUser user = (CaseUser) ((HttpServletRequest)request).getSession().getAttribute(sessionKey);
       // ***
       if( user == null ){
       ActiveLanguage.setLanguage(ActiveLanguage.DEFAULT_LANGUAGE.intValue());
       LogUtil.info(LanguageFilter.class, "Failed to find CaseUser in session under "
       + sessionKey +
       " , request.uri = " + uri +
       " setting default Language : " + ActiveLanguage.DEFAULT_LANGUAGE);
       }else{
       ActiveLanguage.setLanguage(user.getLangPreff());
       }
       // LogUtil.debug(LanguageFilter.class, "Active Language : " + ActiveLanguage.getLanguage());
       }
       filterChain.doFilter(request, response);
      
       }
      
      etc....