Hi guys,
I'm still stuck trying to use jasper. I'm getting null pointer exceptions
thrown by org.apache.jasper.compiler.Compiler.

2002-06-25 11:56:12 - ERROR-the file '\admin\clear.jsp' generated the
following
general exception: java.lang.NullPointerException
java.lang.NullPointerException
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:57)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:153)
        at org.apache.jasper.JspC.parseFile(JspC.java:427)
        at org.apache.jasper.JspC.parseFiles(JspC.java:747)
        at org.apache.jasper.JspC.main(JspC.java:762)

I'm not sure why the null pointer exception occurs apparantly when trying to
create the output file.
The following code from the head revision of Compiler.java suggests to me
the the JSPCompilationContext is not correctly initialised by my command. I
still get the error when I pass in the class name using -c argument to JspC

   /**
     * Compile the jsp file from the current engine context
     */
    public void generateJava()
        throws FileNotFoundException, JasperException, Exception
    {
        // Setup page info area
        pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader()));

        String javaFileName = ctxt.getServletJavaFileName();

        // Setup the ServletWriter
        // We try UTF8 by default. If it fails, we use the java encoding
        // specified for JspServlet init parameter "javaEncoding".

        String javaEncoding = "UTF8";
        OutputStreamWriter osw = null;
        try {
            osw = new OutputStreamWriter(new FileOutputStream(javaFileName),
                                         javaEncoding);
      ..........

Example command follows. "..." to shorten cp for readable example.

D:\jdk1.3.1_03\jre\bin\java.exe
-classpath
"C:\...\lib\servlet.jar;C:\...\lib\ant.jar;C:\...\lib\jasper-compiler.jar;C:
\...\lib\jasper-runtime.jar;C:\...\lib\xmlParserAPIs.jar;C:\...\lib\xercesIm
pl.jar;C:\...\lib\j2ee.jar;C:\...\lib\log4j-1.2.jar;C:\...\lib\db2java.zip;C
:\...\lib\log4j-1.2.jar;.C:\...\lib\various.jar;"
org.apache.jasper.JspC
-d "C:\...\build\generated"
-p com.fu.bar.jsp
-v9
-uriroot "C:\...\source\site"
-uribase "C:\...\source\site"
-die9
"C:\...\source\site\admin\error.jsp"

also tried above command with "-c error" and "-c error.class" before the jsp
file name.

The platform is W2K.

I hope that some-one experienced with jasper or ant jspc can help me with
this. I'd appreciate it.

Dave


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to