StackOverflowError when requesting WADL
---------------------------------------

                 Key: CXF-4125
                 URL: https://issues.apache.org/jira/browse/CXF-4125
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.4.6
         Environment: $ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

<jaxb.version>2.2.4</jaxb.version>
<jaxb2.basics.version>0.6.3</jaxb2.basics.version>
<jaxb2.plugin.version>0.8.0</jaxb2.plugin.version>
            Reporter: Chris Eineke


My JAX-RS service throws a StackOverflowException when requesting the WADL:


java.lang.StackOverflowError
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:314)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1560)
        at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at 
sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:113)
        at 
sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
        at 
sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
        at 
sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:388)
        at 
sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:199)
        at 
sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:87)
        at 
sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
        at java.lang.reflect.Method.declaredAnnotations(Method.java:714)
        at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:707)
        at 
java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:193)
        at 
org.apache.cxf.jaxrs.utils.InjectionUtils.canPropertyBeIgnored(InjectionUtils.java:1070)
        at 
org.apache.cxf.jaxrs.utils.InjectionUtils.getParametersFromBeanClass(InjectionUtils.java:1059)
        at 
org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:547)
        at 
org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:558)
        at 
org.apache.cxf.jaxrs.model.wadl.WadlGenerator.doWriteBeanParam(WadlGenerator.java:558)
        ... (last line repeated about 990 times)

I've tracked the problem down to a particular method signature:

@GET @Path("/foo") FooResult 
previewLayoutGroupToLocationAssignment(@QueryParam("") Foo foo);

where Foo is:

public class Foo extends com.foo.FooTO { ... }

and FooTO is generated by JAXB:

@XmlType(name = "", propOrder = {
   ...
})
@XmlRootElement(name = "foo")
public class LayoutGroupAssignment
    implements Equals, HashCode, ToString
{
    @XmlElement(type = Long.class)
    protected List<Long> a;
    @XmlElement(required = true, type = String.class)
    @XmlJavaTypeAdapter(Adapter1 .class)
    @XmlSchemaType(name = "date")
    protected DateTime b;
    @XmlElement(required = true, type = String.class)
    @XmlJavaTypeAdapter(Adapter1 .class)
    @XmlSchemaType(name = "date")
    protected DateTime c;
    ...
}

I refer to the XSD in the jaxrs:schemaLocations section of my application 
context and I configure the WadlGenerator in the jaxrs:providers section as 
follows:

<jaxrs:providers>
  <bean class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
    <property name="applicationTitle" value="FooService"/>
    <property name="singleResourceMultipleMethods" value="false"/>
    <property name="addResourceAndMethodIds" value="true"/>
  </bean>
</jaxrs:providers>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to