4 Replies Latest reply on Sep 15, 2009 10:16 AM by tjansto

    jsp pages won't compile, servlets run fine

      evening folks,
      i am migrating an application for jboss 4.x to jboss 5.1. i have gotten most of the migration issues worked out, but am facing one i have not been able to locate an answer for. we deploy an ear file that contains the core classes we use, and the after that a war file is deployed. the war file contains a mixture of custom classes not found in the ear, some servlets, and some jsp pages. when the servlets are accessed, all runs fine, but when trying to compile the jps pages, i get an error to the effect of "only a type can be imported a.b.c.d resolves to a package" other posts indicate that that error resolves down to a class not found error, but i can't see why it isn't being located. the servlet references to the exact same class, as i said, works fine. i did make sure that the EARClassLoaderDeployer property "isolated" was set to"false", so it seems as though the classes should be available for both the servlets and the jsp pages. any ideas of where to look?

      again, thanks as always,
      tom

        • 1. Re: jsp pages won't compile, servlets run fine
          jaikiran

          Please post the entire exception stacktrace and also the location of the jar file where that a.b.c.d class is located. Also which specific vendor and version of JDK are you using?

          • 2. Re: jsp pages won't compile, servlets run fine

            version is 1.6 in a ubuntu 8.04 environment, here's the full version info:
            root# /usr/lib/jvm/jdk1.6.0/bin/java -version
            java version "1.6.0"
            Java(TM) SE Runtime Environment (build 1.6.0-b105)
            Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)

            and the stack trace info is as shown below. the a.b.c.d class i referred to in the post (abbreviated it earlier for, well, for brevity), are the classes that are called out in the stack trace. as for the location of those classes, they are in an ear file that gets deployed (10base.ear), before the war that contains these jsp files (20app.war) gets deployed. they are not located somewhere specifically in the class path. i am trying to take advantage of the classes already having been loaded from the 10base.ear for availability to use in the 20app.war file, and they are, but again, only for the servlets, but not the jsp pages. i didn't mention it earlier, but jsp pages in the 20app.war that rely on classes contained within that war itself (WEB-INF/classes) also do work fine (as one would expect). and again, in the jboss 4.x environment these deployed and ran without these problems.

            04:58:39,077 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
            org.apache.jasper.JasperException: Unable to compile class for JSP:

            An error occurred at line: 16 in the generated java file
            Only a type can be imported. com.evolved.radweb.domain.User resolves to a package

            An error occurred at line: 17 in the generated java file
            Only a type can be imported. com.evolved.radweb.ui.DataTable resolves to a package

            An error occurred at line: 35 in the jsp file: /application/jsp/DictationWorklist.jsp
            DataTable cannot be resolved to a type
            32: Long userId = null;
            33: String userName = null;
            34: String userMessage = null;
            35: DataTable worklistDT = null;
            36: Application radwebApplication = null;
            37:
            38: User user = null;


            An error occurred at line: 38 in the jsp file: /application/jsp/DictationWorklist.jsp
            User cannot be resolved to a type
            35: DataTable worklistDT = null;
            36: Application radwebApplication = null;
            37:
            38: User user = null;
            39:
            40: String orgId = request.getParameter("orgId");
            41: String searchOption = request.getParameter("searchOption") != null ? request.getParameter("searchOption") : "FILMED";


            An error occurred at line: 61 in the jsp file: /application/jsp/DictationWorklist.jsp
            User cannot be resolved to a type
            58: userId = (Long) sessionInfo.get(ClientSessionTracker.WEB_USER_ID);
            59: userName = (String) sessionInfo.get(ClientSessionTracker.WEB_USER_NAME);
            60: if (s.getAttribute(USER_SESSION) != null) {
            61: user = (User) s.getAttribute(USER_SESSION);
            62: }else {
            63: user = User.getUserById(userId.intValue());
            64: s.setAttribute(USER_SESSION, user);


            An error occurred at line: 63 in the jsp file: /application/jsp/DictationWorklist.jsp
            User cannot be resolved
            60: if (s.getAttribute(USER_SESSION) != null) {
            61: user = (User) s.getAttribute(USER_SESSION);
            62: }else {
            63: user = User.getUserById(userId.intValue());
            64: s.setAttribute(USER_SESSION, user);
            65: }
            66: if (s.getAttribute(APPLICATION_SESSION) != null) {


            An error occurred at line: 74 in the jsp file: /application/jsp/DictationWorklist.jsp
            DataTable cannot be resolved to a type
            71: radwebApplication = bureaucrat.getApplication();
            72: s.setAttribute(APPLICATION_SESSION, radwebApplication);
            73: }
            74: worklistDT = (DataTable) s.getAttribute(WORKLIST_SESSION);
            75: // worklistDT = null;
            76: if (worklistDT == null) {
            77: worklistDT = DataTable.getDataTable("DictationWorklist");


            An error occurred at line: 77 in the jsp file: /application/jsp/DictationWorklist.jsp
            DataTable cannot be resolved
            74: worklistDT = (DataTable) s.getAttribute(WORKLIST_SESSION);
            75: // worklistDT = null;
            76: if (worklistDT == null) {
            77: worklistDT = DataTable.getDataTable("DictationWorklist");
            78: String[] columnNames = new String[] {
            79: Exam.LINKED_EXAMS_ID, Exam.LOCK, Exam.PRIORITYDESC, Exam.PATIENTNAMEUS,
            80: Exam.MRN, Exam.ACCESSIONNUMBER, Exam.ORDERSOURCEDESC,


            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.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.jboss.web.tomcat.service.sso.ClusteredSingleSignOn.invoke(ClusteredSingleSignOn.java:672)
            at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
            at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:436)
            at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:384)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            at java.lang.Thread.run(Thread.java:619)

            • 3. Re: jsp pages won't compile, servlets run fine
              jaikiran

               

              as for the location of those classes, they are in an ear file


              Where exactly in the ear? Try placing that jar in the .ear/lib folder so that it becomes available to all components in the ear.


              • 4. Re: jsp pages won't compile, servlets run fine

                that took care of it. thank you jaikiran