You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Mark M. Egan" <eg...@umn.edu> on 2005/05/28 03:49:50 UTC

Bug?: JspCompilationContext.createCompiler(JspCompilationContext.java:220)

I am trying to embed tomcat in an application.  I am using Sun Java 1.5 and 
Tomcat 5.5.9.  During the tomcat startup, I receive the following error:

SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
         at 
org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:220)


I looked at the JspCompilationContext.java code and found the block where 
the NullPointerException occurs:

     /**
      * Create a "Compiler" object based on some init param data. This
      * is not done yet. Right now we're just hardcoding the actual
      * compilers that are created.
      */
     public Compiler createCompiler() throws JasperException {
         if (jspCompiler != null ) {
             return jspCompiler;
         }
         jspCompiler = null;
         if (options.getCompiler() == null) {
             jspCompiler = 
createCompiler("org.apache.jasper.compiler.JDTCompiler");
             if (jspCompiler == null) {
                 jspCompiler = 
createCompiler("org.apache.jasper.compiler.AntCompiler");
             }
         } else {
             jspCompiler = 
createCompiler("org.apache.jasper.compiler.AntCompiler");
             if (jspCompiler == null) {
                 jspCompiler = 
createCompiler("org.apache.jasper.compiler.JDTCompiler");
             }
         }
         jspCompiler.init(this, jsw);
         return jspCompiler;
     }

     private static Compiler createCompiler(String className) {
         Compiler compiler = null;
         try {
             compiler = (Compiler) Class.forName(className).newInstance();
         } catch (Throwable t) {
             // Log ?
             // FIXME: log
         }
         return compiler;
     }

I was somewhat concerned by the comments within the block.  I thought I 
would ask if there is an open bug in this area before I continued picking 
apart my own code.  Is this a bug in Tomcat?  If so, is there a 
work-around?  If not, how should I proceed?

Thank you in advance,
Mark 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Bug?: JspCompilationContext.createCompiler(JspCompilationContext.java:220)

Posted by "Mark M. Egan" <eg...@umn.edu>.
I answered my own question.  I was not including an important .jar file in 
the CLASSPATH.

At 08:49 PM 5/27/2005, you wrote:
>I am trying to embed tomcat in an application.  I am using Sun Java 1.5 
>and Tomcat 5.5.9.  During the tomcat startup, I receive the following error:
>
>SEVERE: Servlet.service() for servlet jsp threw exception
>java.lang.NullPointerException
>         at 
> org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:220)
>
>
>I looked at the JspCompilationContext.java code and found the block where 
>the NullPointerException occurs:
>
>     /**
>      * Create a "Compiler" object based on some init param data. This
>      * is not done yet. Right now we're just hardcoding the actual
>      * compilers that are created.
>      */
>     public Compiler createCompiler() throws JasperException {
>         if (jspCompiler != null ) {
>             return jspCompiler;
>         }
>         jspCompiler = null;
>         if (options.getCompiler() == null) {
>             jspCompiler = 
> createCompiler("org.apache.jasper.compiler.JDTCompiler");
>             if (jspCompiler == null) {
>                 jspCompiler = 
> createCompiler("org.apache.jasper.compiler.AntCompiler");
>             }
>         } else {
>             jspCompiler = 
> createCompiler("org.apache.jasper.compiler.AntCompiler");
>             if (jspCompiler == null) {
>                 jspCompiler = 
> createCompiler("org.apache.jasper.compiler.JDTCompiler");
>             }
>         }
>         jspCompiler.init(this, jsw);
>         return jspCompiler;
>     }
>
>     private static Compiler createCompiler(String className) {
>         Compiler compiler = null;
>         try {
>             compiler = (Compiler) Class.forName(className).newInstance();
>         } catch (Throwable t) {
>             // Log ?
>             // FIXME: log
>         }
>         return compiler;
>     }
>
>I was somewhat concerned by the comments within the block.  I thought I 
>would ask if there is an open bug in this area before I continued picking 
>apart my own code.  Is this a bug in Tomcat?  If so, is there a 
>work-around?  If not, how should I proceed?
>
>Thank you in advance,
>Mark
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org