Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.4
-
None
-
jaxb-api-2.1.jar, jaxb-impl-2.1.11.jar
Description
We have a bunch of web services started programmatically using:
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceClass(serviceInterface);
factory.setServiceBean(serviceBean);
factory.setAddress(url);
...
factory.create();
Some of the services include a method which return type is generics:
public interface Service<DTO extends Entity<? extends Serializable>, QS extends QuerySummary> extends ... { QueryResult<DTO, QS> read(Query query, UserId uc); ... }
After upgrading CXF to version 2.2.4 they no longer start. The exception thrown is:
java.lang.reflect.GenericSignatureFormatError at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103) at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:233) at sun.reflect.generics.parser.SignatureParser.parseTypeArgument(SignatureParser.java:319) at sun.reflect.generics.parser.SignatureParser.parseTypeArguments(SignatureParser.java:284) at sun.reflect.generics.parser.SignatureParser.parseSimpleClassTypeSignature(SignatureParser.java:260) at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignatureSuffix(SignatureParser.java:270) at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature(SignatureParser.java:244) at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:228) at sun.reflect.generics.parser.SignatureParser.parseTypeArgument(SignatureParser.java:319) at sun.reflect.generics.parser.SignatureParser.parseTypeArguments(SignatureParser.java:284) at sun.reflect.generics.parser.SignatureParser.parseSimpleClassTypeSignature(SignatureParser.java:260) at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignatureSuffix(SignatureParser.java:270) at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature(SignatureParser.java:244) at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:228) at sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:359) at sun.reflect.generics.parser.SignatureParser.parseTypeSig(SignatureParser.java:157) at sun.reflect.generics.repository.FieldRepository.parse(FieldRepository.java:34) at sun.reflect.generics.repository.FieldRepository.parse(FieldRepository.java:24) at sun.reflect.generics.repository.AbstractRepository.<init>(AbstractRepository.java:56) at sun.reflect.generics.repository.FieldRepository.<init>(FieldRepository.java:30) at sun.reflect.generics.repository.FieldRepository.make(FieldRepository.java:48) at java.lang.reflect.Field.getGenericInfo(Field.java:85) at java.lang.reflect.Field.getGenericType(Field.java:223) at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:288) at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:244) at org.apache.cxf.jaxb.JAXBContextInitializer.begin(JAXBContextInitializer.java:151) at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:109) at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:322) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:398) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:525) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:461) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:212) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:163) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:117) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:167) at com.xxx.ServiceServerFactory.create(ServiceServerFactory.java:53)
After some debugging (namely setting a breakpoint in JAXBContextInitializer.walkReferences) I could only observe that:
- under 2.2.3, the breakpoint was at JAXBContextInitializer.walkReferences:271, the f (Field) value is:
private com.xxx.queryresult.QueryResult com.xxx.jaxws_asm.ReadResponse.queryResult
and its f.signature is NULL
- under 2.2.4, the breakpoint was at JAXBContextInitializer.walkReferences:288, the f (Field) value is:
private com.xxx.queryresult.QueryResult com.xxx.jaxws_asm.ReadResponse.queryResult
which is the same, but its f.signature is very different:
Lcom/xxx/queryresult/QueryResult<Lcom/xxx/DTOEntity<null>;Lcom/xxx/QuerySummary;>;