6 Replies Latest reply on Feb 21, 2010 6:52 PM by Matthew Robinson

    JSP compilation problem with JBoss 5.1.0

    Max Vilner Newbie

      Hi all,

       

      I'm trying to migrate one of our apps from JBoss 4.0.4 to 5.1.0. The app deploys fine, but when I try to access it I get a JSP compilation error:

       

      2010-02-12 11:39:38,237 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/tms].[jsp]] (http-127.0.0.1-8888-3) Servlet.service() for servlet jsp threw exception
      org.apache.jasper.JasperException: Unable to compile class for JSP:

       

      An error occurred at line: 6 in the generated java file
      The import com.rebt.tms.web.util cannot be resolved

       

      An error occurred at line: 21 in the jsp file: /jsp/base-layout.jsp
      RoleBasedView cannot be resolved to a type
      18:     if (request.getAttribute(ConstantsRequestKeys.REQUEST_USER_ROLES_VIEW) == null) {
      19:         User user = (User) session.getAttribute(ConstantsSessionKeys.SESSION_USER_KEY);
      20:         if(user != null){
      21:             RoleBasedView view = new RoleBasedView(user, request);
      22:             request.setAttribute(ConstantsRequestKeys.REQUEST_USER_ROLES_VIEW, view);
      23:         }
      24:     }

       


      An error occurred at line: 21 in the jsp file: /jsp/base-layout.jsp
      RoleBasedView cannot be resolved to a type
      18:     if (request.getAttribute(ConstantsRequestKeys.REQUEST_USER_ROLES_VIEW) == null) {
      19:         User user = (User) session.getAttribute(ConstantsSessionKeys.SESSION_USER_KEY);
      20:         if(user != null){
      21:             RoleBasedView view = new RoleBasedView(user, request);
      22:             request.setAttribute(ConstantsRequestKeys.REQUEST_USER_ROLES_VIEW, view);
      23:         }
      24:     }

       


      Stacktrace:
          at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
          at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
          at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:335)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
          at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
          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:717)
          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:444)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
          at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
          at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
          at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
          at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:302)
          at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
          at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
          at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          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:444)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
          at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
          at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
          at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
          at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
          at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
          at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
          at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          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:444)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
          at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:696)
          at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:667)
          at org.apache.struts.taglib.logic.ForwardTag.doForward(ForwardTag.java:121)
          at org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:105)
          at org.apache.jsp.jsp.welcome_jsp._jspx_meth_logic_005fforward_005f0(welcome_jsp.java:93)
          at org.apache.jsp.jsp.welcome_jsp._jspService(welcome_jsp.java:65)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          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:717)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at com.rebt.tms.web.filter.RequestCharEncodingFilter.doFilter(RequestCharEncodingFilter.java:54)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at com.rebt.tms.web.filter.SpaceTrimmerFilter.doFilter(SpaceTrimmerFilter.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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
          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:829)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:619)

       

      The import tag in the mentioned JSP is in order, and the same code runs with no issues on JBoss 4. Is there any configuration that I'm missing? Please help.

       

      Thanks,

       

      Max

        • 1. Re: JSP compilation problem with JBoss 5.1.0
          Wolfgang Knauf Master

          Hi,

           

          did you check that your deployed WAR contains "com.rebt.tms.web.util.RoleBasedView.class" (at least I assume that this is the missing file) in "WEB-INF\classes"? Maybe some problem with the build process?

           

          Best regards

           

          Wolfgang

          • 2. Re: JSP compilation problem with JBoss 5.1.0
            Max Vilner Newbie

            Thank you for the comment, Wolfgang.

             

            Of course this was the first thing I checked, but it seems that everything is in place, the build is correct. Somehow the Tomcat JSP compiler has trouble locating the classes. By the way, the war is exploded if that makes any difference.

             

            Max

            • 3. Re: JSP compilation problem with JBoss 5.1.0
              Max Vilner Newbie

              It appears that the problem is with the com.rebt.tms.web.util package itself. Any class from that package referenced in the JSP does not resolve. But if RoleBasedView class is moved to a different package the page compilies without a problem. So I decides to rename the package to "com.rebt.tms.web.utils" and bingo - the problem dissapeared!

              However my woes are still far from over. I'm now getting other JSP compilation errors in the other pages of the application. It seems that JSP compiler in JBoss 5.1 got stricter and the code that compiled and executed fine in JBoss 4 is now not good enogh. Looks like migrating to 5.1 will require major JSP code upgrade which might be too costly at this point.

              I'm still curious to know what is wrong with "util" in the package name and why "utils" is better. Any ideas?

               

              Thanks,

               

              Max

              • 4. Re: JSP compilation problem with JBoss 5.1.0
                Wolfgang Knauf Master

                Hi,

                 

                I never heard of such a problem, but everything is possible ;-). If you can reproduce it with a simple sample, you might create a JBoss JIRA (or even a Tomcat bug report, if this also happens for a standard Tomcat server).

                 

                Do you use a validating IDE like Eclipse or NetBeans to build your project? If yes: does this one show errors in your JSPs?

                 

                Best regards

                 

                Wolfgang

                • 5. Re: JSP compilation problem with JBoss 5.1.0
                  Max Vilner Newbie

                  Yes I use Eclipse and there are no JSP errors shown except for some warnings. Unfortunately I don't have time right now to experiment further in order to isolate the problem in the simple sample app. Maybe sometime in the future.

                  The whole point of this migration however is to move to a version of JBoss that will have a fix for Tomcat session management bug that was greatly affecting our production systems. We found that JBoss 4.2.2 has that fix and our applications deploy on it as is and run perfectly. So we will go with it.

                   

                  Thank you, Wolfgang, for taking the time to contribute to this discussion.

                   

                  Be well,

                   

                  Max

                  • 6. Re: JSP compilation problem with JBoss 5.1.0
                    Matthew Robinson Newbie

                    Hello Max.

                     

                    I was wondering if you have had/are having any problems with the JSP validator showing errors against JavaScript with embedded scriplet code?  JSP seems to run OK though.

                     

                    Also are you using the Tiles framework in your Project?  I am having a problem whereby my Eclipse Galileo Project linked to JBOSS using the JBOSS Tools fails to load the Tiles Processor, but when I deploy the WAR file manually all is OK.

                     

                    Kind Regards,

                    Matt.