Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8155588

org.apache.jasper.JasperException: Unable to compile class for JSP

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_91"
      Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
      Java HotSpot(TM) Client VM (build 25.91-b14, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.10586]

      A DESCRIPTION OF THE PROBLEM :
      My java servlet (Tomcat 6.26 ) application reads html (jsp actually) file with embedded keywords and replaces them with generated html/javascript/CSS web page code and directs user browser to the generated resulting web page. The code snippet doing this is here:

      File formFile = new File(m_Request.getSession().getServletContext().getRealPath(""), getServletName() + ".jsp");
      util_APIs.waitForFile(formFile.getParentFile(), true);
      BufferedWriter bw = new BufferedWriter(new FileWriter(formFile));
      bw.write(sOut);
      bw.close();

      RequestDispatcher rd = m_Request.getRequestDispatcher("/" + formFile.getName());
      rd.forward(m_Request, m_Response);

      The last line of the code above generates the exception below:


      [2016-04-27 11:48:20:589] Exception: org.apache.jasper.JasperException: Unable to compile class for JSP:

      An error occurred at line: 1 in the generated java file
      The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

      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:349)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      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:646)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
      at com.adeda.adedapi.HtmlForm.HtmlFormProcessor.run(HtmlFormProcessor.java:105)
      at com.adeda.adedapi.servlet.ServletExtender.runButLoadPropertiesFirst(ServletExtender.java:102)
      at com.adeda.adedapi.servlet.ServletExtender.process(ServletExtender.java:307)
      at com.adeda.adedapi.util.DefaultProcessorThread.run(DefaultProcessorThread.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

      I trace the effect to a both recently released (Apr 18) JDK/JRE 8u91 and 8u92. Once I revert to the JDK/JRE 8u77 or earlier - everything works without a hitch. I verified all configurations and compared system properties within the code running 8u77 versu 8u91. The only difference which makes or breaks my application is the JDK/JRE version

      REGRESSION. Last worked in version 8u77

      ADDITIONAL REGRESSION INFORMATION:
      C:\Users\mgmagi>java -version
      java version "1.8.0_77"
      Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
      Java HotSpot(TM) Client VM (build 25.77-b03, mixed mode, sharing)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      html/jsp code is generated by servlet and corresponding web page properly displayed in browser
      ACTUAL -
      Exception thrown:
      An error occurred at line: 1 in the generated java file
      The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

      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:349)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      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:646)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
      at com.adeda.adedapi.HtmlForm.HtmlFormProcessor.run(HtmlFormProcessor.java:105)
      at com.adeda.adedapi.servlet.ServletExtender.runButLoadPropertiesFirst(ServletExtender.java:102)
      at com.adeda.adedapi.servlet.ServletExtender.process(ServletExtender.java:307)
      at com.adeda.adedapi.util.DefaultProcessorThread.run(DefaultProcessorThread.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An error occurred at line: 1 in the generated java file
      The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

      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:349)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      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:646)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
      at com.adeda.adedapi.HtmlForm.HtmlFormProcessor.run(HtmlFormProcessor.java:105)
      at com.adeda.adedapi.servlet.ServletExtender.runButLoadPropertiesFirst(ServletExtender.java:102)
      at com.adeda.adedapi.servlet.ServletExtender.process(ServletExtender.java:307)
      at com.adeda.adedapi.util.DefaultProcessorThread.run(DefaultProcessorThread.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Can't be provided.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The only work around is to go back older JDK/JRE version and pray that the glitch will go away with the new release

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            psonal Pallavi Sonal
            Reporter:
            webbuggrp Webbug Group
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: