You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Steve Krulewitz <sh...@mm.st> on 2004/03/09 22:51:15 UTC
Troubleshooting problem with Sysdeo Tomcat Eclipse plugin
Hey folks --
I just spent some time debugging a problem (which turned out to be a
classpath issue, as always) and I just wanted to share my experience.
First of all, the way I develop with Cocoon is that I build the cocoon
jar, and jars for all the blocks I use, and I copy these jars plus all
the jars from lib/core and the blocks/*/lib dirs into my own webapp
development area.
I've been using the Sysdeo Tomcat Eclipse plugin with Cocoon for a few
days now and it has been working very well. I've been able to hot
update the actions and things I've been working on. However, when
hitting one particular pipeline that uses the JXTemplateGenerator, I
would get a blank page. View source, and nothing at all. No exceptions
on the console, nothing in the log files. The code running in Tomcat
separately worked fine, so it must have something to do with the Sysdeo
Tomcat environment.
After some stepping through code, it seems like there was a problem
getting an instance of the JXTemplateGenerator. It was very hard to
pinpoint because the invokeNodes methods in the
AbstractParentProcessingNode class just seems to silently swallow any
exception that is thrown by the node it is invoking:
try {
for (int i = 0; i < nodes.length; i++) {
if (nodes[i].invoke(env, context)) {
// Success
return true;
}
}
}
finally {
// No success
context.popMap();
}
return false;
After editing this code and catching the exception, I was able to
quickly tell that is was a NoClassDefFoundError, and that it had
something to do with Commons Loggings stuff. Turns out I didn't have
the commons-logging-1.0.3.jar in my classpath. The reason why I didn't
notice this before is because my Tomcat install has this jar in its
server/lib dir.
A few observations:
- Should commons-logging-1.0.3.jar be in lib/core rather than
lib/optional? In my case, the JXTemplateGenerator wouldn't run without it.
- Should the invokeNodes() method in AbstractParentProcessingNode just
ignore the exception? Maybe it should be caught and logged?
cheers,
-steve
Re: Troubleshooting problem with Sysdeo Tomcat Eclipse plugin
Posted by Steve Krulewitz <sh...@mm.st>.
> The code above does not actively ignore the exception, even less
> silently swallow anything. Errors are uncecked type exceptions in Java.
> I don't presume you suggest this is the place you want to log any
> throwable down the execution path? If I were to take a guess, this one
> will end up in the catalina.log or something similar.
You are totally right -- sometimes when you stare at something long
enough, you start to see things that are not there :) I was expecting
that log to appear on the Eclipse console. However, I had a look at the
log files and lo and behold:
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at
org.apache.commons.jexl.util.Introspector.<clinit>(Introspector.java:78)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at
org.apache.cocoon.generation.JXTemplateGenerator.class$(JXTemplateGenerator.java:535)
at
org.apache.cocoon.generation.JXTemplateGenerator.<clinit>(JXTemplateGenerator.java:933)
So forget the exception handling thing, but it does seem like
commons-logging-1.0.3.jar needs to be in lib/core since jexl is.
thanks,
-steve
Re: Troubleshooting problem with Sysdeo Tomcat Eclipse plugin
Posted by Unico Hommes <un...@hippo.nl>.
Steve Krulewitz wrote:
> Hey folks --
>
> I just spent some time debugging a problem (which turned out to be a
> classpath issue, as always) and I just wanted to share my experience.
>
> First of all, the way I develop with Cocoon is that I build the cocoon
> jar, and jars for all the blocks I use, and I copy these jars plus all
> the jars from lib/core and the blocks/*/lib dirs into my own webapp
> development area.
>
> I've been using the Sysdeo Tomcat Eclipse plugin with Cocoon for a few
> days now and it has been working very well. I've been able to hot
> update the actions and things I've been working on. However, when
> hitting one particular pipeline that uses the JXTemplateGenerator, I
> would get a blank page. View source, and nothing at all. No
> exceptions on the console, nothing in the log files. The code running
> in Tomcat separately worked fine, so it must have something to do with
> the Sysdeo Tomcat environment.
>
> After some stepping through code, it seems like there was a problem
> getting an instance of the JXTemplateGenerator. It was very hard to
> pinpoint because the invokeNodes methods in the
> AbstractParentProcessingNode class just seems to silently swallow any
> exception that is thrown by the node it is invoking:
>
> try {
> for (int i = 0; i < nodes.length; i++) {
> if (nodes[i].invoke(env, context)) {
> // Success
> return true;
> }
> }
> }
> finally {
> // No success
> context.popMap();
> }
> return false;
>
> After editing this code and catching the exception, I was able to
> quickly tell that is was a NoClassDefFoundError, and that it had
> something to do with Commons Loggings stuff. Turns out I didn't have
> the commons-logging-1.0.3.jar in my classpath. The reason why I
> didn't notice this before is because my Tomcat install has this jar in
> its server/lib dir.
>
> A few observations:
>
> - Should commons-logging-1.0.3.jar be in lib/core rather than
> lib/optional? In my case, the JXTemplateGenerator wouldn't run
> without it.
>
> - Should the invokeNodes() method in AbstractParentProcessingNode just
> ignore the exception? Maybe it should be caught and logged?
>
The code above does not actively ignore the exception, even less
silently swallow anything. Errors are uncecked type exceptions in Java.
I don't presume you suggest this is the place you want to log any
throwable down the execution path? If I were to take a guess, this one
will end up in the catalina.log or something similar.
--
Unico
Re: Troubleshooting problem with Sysdeo Tomcat Eclipse plugin
Posted by Torsten Curdt <tc...@vafer.org>.
> After editing this code and catching the exception, I was able to
> quickly tell that is was a NoClassDefFoundError, and that it had
> something to do with Commons Loggings stuff. Turns out I didn't have
> the commons-logging-1.0.3.jar in my classpath. The reason why I didn't
> notice this before is because my Tomcat install has this jar in its
> server/lib dir.
Hm...
AFAIU only the commons-logging-api.jar should be in the
container's lib directory and the commons-logging.jar
should reside in the WEB-INF/lib. ...at least for the
commons-logging classloading concept. Or did I get this
wrong?
> A few observations:
>
> - Should commons-logging-1.0.3.jar be in lib/core rather than
> lib/optional? In my case, the JXTemplateGenerator wouldn't run without it.
Sounds reasonable to me then
> - Should the invokeNodes() method in AbstractParentProcessingNode just
> ignore the exception? Maybe it should be caught and logged?
Could you create a patch and file it to bugzilla?
cheers
--
Torsten