Reputation: 4877
I inherited a Java 1.7 webapp based on Apache Cocoon, which (deployed on Tomcat) seems to work for static pages, but for dynamic ones the browser shows me the following:
An error has occured
java.lang.NullPointerException:
Cocoon stacktrace[hide]
java.lang.NullPointerException
context:/model-runs/sitemap.xmap - 284:46 <map:serialize type="html">
context:/model-runs/sitemap.xmap - 281:35 <map:transform type="i18n">
context:/model-runs/sitemap.xmap - 273:74 <map:transform type="xslt">
context:/model-runs/sitemap.xmap - 272:79 <map:transform type="xslt">
context:/model-runs/sitemap.xmap - 271:65 <map:generate type="serverpages">
context:/sitemap.xmap - 1162:63 <map:mount>
How does one go about debugging this? I am able to run the project from within Eclipse, also in debug mode, but I don't know where to "set the breakpoint". Any pointers appreciated!
Upvotes: 0
Views: 42
Reputation: 798
What you got is a Cocoon stacktrace, not a Java one.
It is unlikely that the standard Java debugging approach would be what you need here : Cocoon is much of a configuration-based framework, and finding out the cause of that kind of error will most certainly require you to get into those configuration files, and the pipelines of processing they configure.
If I can still remember, here, the pipeline stage that launched the error is on top (quite standard). You get a line/column pointer to the (XML) description of the stage (here html serialization) that raised the error.
Now, is the NPE caused by the serializer not being found, by it not finding some resource it requires as per its configuration, by it receiving null from the previous (i18n) stage, or who knows what other cause?
I would start by studying both stages (html serializers, then i18n) config in sitemap.xml
to get my first debugging steps' check list.
Upvotes: 2