geronimo-xbean-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kohsuke Kawaguchi (JIRA)" <>
Subject [jira] Created: (XBEAN-71) qdox dies because it cannot resolve javax/servlet/ServletContext
Date Tue, 23 Jan 2007 22:59:49 GMT
qdox dies because it cannot resolve javax/servlet/ServletContext

                 Key: XBEAN-71
             Project: XBean
          Issue Type: Bug
          Components: maven-plugin
    Affects Versions: 2.7
            Reporter: Kohsuke Kawaguchi

When one of my classes implement Spring's ServletContextAware interface, qdox used by XBean
dies. The call stack below:

java.lang.NoClassDefFoundError: javax/servlet/ServletContext
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(
        at java.lang.Class.privateGetPublicMethods(
        at java.lang.Class.getMethods(
        at com.thoughtworks.qdox.JavaDocBuilder.createBinaryClass(
        at com.thoughtworks.qdox.JavaDocBuilder.getClassByName(
        at com.thoughtworks.qdox.model.ClassLibrary.getClassByName(
        at com.thoughtworks.qdox.model.Type.getJavaClass(
        at com.thoughtworks.qdox.model.JavaClass.getImplementedInterfaces(
        at org.apache.xbean.spring.generator.QdoxMappingLoader.loadElement(
        at org.apache.xbean.spring.generator.QdoxMappingLoader.loadElements(
        at org.apache.xbean.spring.generator.QdoxMappingLoader.loadNamespaces(
        at org.apache.xbean.spring.generator.QdoxMappingLoader.loadNamespaces(
        at org.apache.xbean.maven.XBeanMojo.execute(
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
        at org.apache.maven.DefaultMaven.doExecute(
        at org.apache.maven.DefaultMaven.execute(
        at org.apache.maven.cli.MavenCli.main(

The root cause of this is in qdox, and for that I filed

The reason this problem occurs is that maven-xbean-plugin depends on spring (via xbean-spring),
so when qdox sees references to spring classes in my sources, it ends up loading that class
in maven-xbean-plugin's classloader as java.lang.Class object (in the above case that was

Yet the dependency specified in the xbean-spring module is


and this uber spring jar's POM doesn't declare any other dependency. So while introspecting
methods and fields on ServletContextAware, it tries to load ServletContext, and it dies there.

This bug in qdox is particularly bad with maven-xbean-plugin because in maven-xbean-plugin,
the sources that are being compiled are meant to be used with Spring. So there's a rather
big chance of them using some Spring interfaces.

It looks like the workaround is to use more recent versions of spring, such as 1.2.8, whose
POM includes all the additional dependencies.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message