You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Paul Derbyshire <de...@globalserve.net> on 2000/05/21 05:36:47 UTC

Mystery NullPointerException with standalone usage.

I have installed Cocoon on a Windows 98 system (yeah, yuck, ugh, bleah, I
know, once I have a linmodem I'll be moving it to my Linux partition
believe you me) by unzipping the "zip" file of the "latest release" at C:\,
so it created C:\Cocoon-1.7.4 and assorted subdirectories. The directory
structure was preserved. I modified my JDK class path to include all the
jars in the lib directory, save for the stylebook and ants ones which the
documentation implies are only needed for building, and to include the
cocoon.jar in the bin directory. After ensuring I was in a command prompt
where the environment changes (specifically, classpath) had taken effect, I
invoked Cocoon on a sample XML file with an associated XSL file as a test.
It failed: NullPointerException. Some FAQing around revealed I had to
ensure it could fond the cocoon-dir/conf/cocoon.properties file, so I
modified the little invoker batch file I created to call it with the
appropriate -p option. Now I continue to get a NullPointerException, but in
a different location.

D:\WOL>java org.apache.cocoon.Cocoon -p
C:\Cocoon-1.7.4\conf\cocoon.properties D
:\wol\wolsrc\test\Test1.xml D:\wol\wolsrc\test\Test1.html
Exception in thread "main" java.lang.NullPointerException
        at org.apache.cocoon.Engine.handle(Engine.java:234)
        at org.apache.cocoon.EngineWrapper.handle(EngineWrapper.java:85)
        at org.apache.cocoon.Cocoon.main(Cocoon.java:267)

Being the type to poke and prod and sometimes even hack a little at
misbehaving open source stuff, I attacked the javadoc files in doc, and
determined that EngineWrapper.handle should not be being invoked in a
standalone context, only in a servlet environment. The command-line utility
usage form seems to be malfunctioning. I also determined that I am
supremely underqualified to figure out & fix this myself. :-)

Has anyone else encountered this? How did they resolve it? Getting,
figuring out how to configure and install, and then using Apache is a
method of last resort here -- right now I'm mainly interested in turning
XML data over here into Web pages, with eventual migration to an
Apache+Cocoon based delivery once I have my always-on broadband connection
and some working content and am thus better-equipped to operate a
full-blown site complete with server... Use of standalone Cocoon seems the
obvious route of migration!

A cursory search of the archives of this list failed to turn up anything.
(I did not find a search engine in the archive section and was thus forced
to invoke the crufty little substring search in the browser on the archive
contents page, and could therefore search message subjects only.)

System info:

AMD K6-II @ 400MHZ with 64 megabytes of RAM (should be plenty, and I am not
     getting either excruciating slowness or OutOfMemoryError)
Windows 98 (yeah, boo, hiss, but I'm tethered to it by the damn WinModem the
     computer OEM thoughtfully provided along with Windows 98, until, that is,
     I manage to replace it)
JDK 1.3 final (C:\jdk1.3\lib\tools.jar is on my classpath, and anyways it's
not
     a NoClassDefFound error, it's a NullPointerException in a method that
     AFAIK shouldn't even be being invoked)
HotSpot JVM 1.3 (are there known issues with Cocoon and HotSpot? Your Web page
     implies Cocoon 2 will be designed for HotSpot, whereas HotSpot is fine
     with Cocoon 1 and Cocoon 1 is merely not as optimized for it as it could
     be)

Also, the test XML file contains a cocoon-format directive that I added on
reading the documentation. It specifies a presentation as "text\html". There
is an xsl:output tag in there, a legacy from fooling around with DocProc
(which appears to be a nonfunctioning, obsolescent predecessor to Cocoon),
which I am given to understand is ignored by Cocoon. (Quick check: yes, if
this is commented out of the style sheet, Cocoon still explodes.) I do
indeed have the style-sheet set up to pass the processing directive:

<xsl:template match="comment()|processing-instruction()">
 <xsl:copy>
  <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

which is the first template in the style sheet and is copied verbatim from
your own Web site.


Please suggest how to remedy the problem. If possible, suggest a remedy
that does not involve fooling around with getting, configuring, and
installing Apache -- I'd be locked for a week into an hourly cycle of boot
into Linux, try to make it work, get an exception or other problem, try to
fix it myself, fail, reboot into Windows, log on, post a mailing list
message, wait for half an hour for some response, any response, reboot into
Linux, try the new suggestion... Not my idea of fun, or of productivity.

I must say this project looks good over all, even if it evidently has a few
quirks to work out in the less-common command line usage. The idea of using
style sheets and XSP to dynamically generate some of the Java code is
brilliant (but I've always had an inordinate fascination for anything that
involves self-modifying code :-)). The whole XML/XSL content and
presentation separating scheme is brilliant in fact, as is Java, and in the
project over here, the primary design documentation lists 3 main project
objectives and proceeds in three paragraphs to use them to prove that
first, we must use Java, and second, we must use XML, and third, we must
use Cocoon. :-)

Java is good. XML is good. Cocoon looks good. Once I've got non-Winmodem
net access on this box, Linux and Apache will be good, and Windows 98 will
become the provervial poor cousin...



-- 
   .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
-()  <  circles, and bark is not smooth, nor does lightning travel in a
   `*'  straight line."    -------------------------------------------------
        -- B. Mandelbrot  |http://surf.to/pgd.net derbyshire@globalserve.net
_____________________ ____|________                          Paul Derbyshire
Programmer & Humanist|ICQ: 10423848|