SYNOPSIS
--------
ModelerException from wsgen
OPERATING SYSTEMS
-----------------
All
FULL JDK VERSIONS
-----------------
Java 6 and above, including latest JDK 8 build.
Also reproducible with the latest JAX-WS RI.
PROBLEM DESCRIPTION
-------------------
If an implementation class extends a class which has the web method definition declared in the end point interface, wsgen fails with a ModelerException.
The problem does not occur it we implement the web method in the sub class, but, according to the JAX-WS specification, we should not have to implement a web method that is implemented in the super class.
The relevant part of the specification is JSR-181 section 4.1, which says:
The complete name of the service endpoint interface defining the
service's abstract Web Service contract. This annotation allows the
developer to separate the interface contract from the implementation. If
this annotation is present, the service endpoint interface is used to
determine the abstract WSDL contract (portType and bindings). The
service endpoint interface MAY include JSR-181 annotations to customize
the mapping from Java to WSDL. The service implementation bean MAY
implement the service endpoint interface, but is not REQUIRED to do so.
REPRODUCTION INSTRUCTIONS
-------------------------
1) unzip wsgen_recreate.zip
2) cd src
3) javac *.java
4) wsgen -keep -d gen -s src -cp .; -wsdl TestSubImpl
wsgen will fail with the following Exception (this specific trace is from 7u9):
com.sun.tools.internal.ws.processor.modeler.ModelerException: modeler error: Methods in an endpointInterface must be implemented in the implementation class. Interface Class:TestInterface Implementation Class:TestSubImpl Method: method(java.lang.String)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.onError(WebServiceAP.java:229)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.classImplementsSEI(WebServiceVisitor.java:556)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisitor.java:523)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:322)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:113)
at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:113)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:319)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:260)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:84)
at com.sun.tools.apt.comp.Apt.main(Apt.java:480)
at com.sun.tools.apt.main.AptJavaCompiler.compile(AptJavaCompiler.java:270)
at com.sun.tools.apt.main.Main.compile(Main.java:1127)
at com.sun.tools.apt.main.Main.compile(Main.java:989)
at com.sun.tools.apt.Main.processing(Main.java:113)
at com.sun.tools.apt.Main.process(Main.java:103)
at com.sun.tools.apt.Main.process(Main.java:85)
at com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:207)
at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:120)
at com.sun.tools.internal.ws.WsGen.main(WsGen.java:42)
error: compilation failed, errors should have been reported
TESTCASE
--------
Attached.
WORKAROUND
----------
Override the webmethod again in the sub class, even if it is overridden in the super class.