JDK-8169981 : wsgen -wsdl can't generate WebMethod in schema for the parent class of a WebService class
  • Type: Bug
  • Component: xml
  • Sub-Component: jax-ws
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2016-11-18
  • Updated: 2017-02-14
  • Resolved: 2017-02-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Description
Run wsgen t.Foo2 -wsdl against the following java files:
Foo1.java:
package t;
import javax.jws.WebService;
import javax.jws.WebMethod;

public class Foo1 {
    @WebMethod
    public String method1(String str) {
        return str;
    }
}

Foo2.java:
package t;
import javax.jws.WebService;
import javax.jws.WebMethod;

@WebService
public class Foo2 extends Foo1{
    @WebMethod
    public String method3(String str) {
        return str;
    }
}

generate Foo2Service_schema1.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://t/" xmlns:tns="http://t/" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="method3" type="tns:method3"/>

  <xs:element name="method3Response" type="tns:method3Response"/>

  <xs:complexType name="method3">
    <xs:sequence>
      <xs:element name="arg0" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="method3Response">
    <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

and a  Foo2Service_schema2.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="arg0" nillable="true" type="xs:string"/>

  <xs:element name="return" nillable="true" type="xs:string"/>
</xs:schema>


method1 is lost in the schema.
Comments
JDK-8174735 changes solves this issue. 'wsgen t.Foo2 ...' reproducer correctly generates method1 in schema. Closing as duplicate
14-02-2017

JAXWS-RI sync review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-February/046386.html Changes related to the JDK-8170370 and this bug: http://cr.openjdk.java.net/~aefimov/jaxws-integrations/8174735/00/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java.udiff.html http://cr.openjdk.java.net/~aefimov/jaxws-integrations/8174735/00/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/Injector.java.udiff.html http://cr.openjdk.java.net/~aefimov/jaxws-integrations/8174735/00/jdk/src/java.base/share/lib/security/default.policy.udiff.html
14-02-2017

This issue will be resolved when JAXWS-RI sync process will be completed. It is currently in progress. We will patch the policy files as part of sync process.
10-02-2017

Thank you for the advise, Mandy. It helped to resolve test failure. com.sun.org.apache.xml.internal.resolver and com.sun.org.apache.xml.internal.resolver.tools can be removed (it was addressed by using new Catalog API). I guess that we will be able to remove com.sun.org.apache.xerces.internal when JDK-8166745 is resolved. The overall changes to default.policy: --- a/src/java.base/share/lib/security/default.policy Mon Jan 30 14:38:08 2017 -0800 +++ b/src/java.base/share/lib/security/default.policy Thu Feb 02 03:47:29 2017 +0300 @@ -70,6 +70,8 @@ grant codeBase "jrt:/java.xml.bind" { permission java.lang.RuntimePermission + "accessClassInPackage.sun.misc"; + permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.*"; permission java.lang.RuntimePermission "accessClassInPackage.com.sun.istack.internal"; @@ -103,15 +105,14 @@ grant codeBase "jrt:/java.xml.ws" { permission java.lang.RuntimePermission - "accessClassInPackage.com.sun.org.apache.xml.internal.resolver"; - permission java.lang.RuntimePermission - "accessClassInPackage.com.sun.org.apache.xml.internal.resolver.tools"; + "accessClassInPackage.sun.misc"; permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.*"; permission java.lang.RuntimePermission "accessClassInPackage.com.sun.istack.internal"; permission java.lang.RuntimePermission "accessClassInPackage.com.sun.istack.internal.*"; + // Can be removed when JDK-8166745 is resolved permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.*"; permission java.lang.RuntimePermission "accessDeclaredMembers";
02-02-2017

This change will need to update jdk/src/java.base/share/lib/security/default.policy and grant "accessClassInPackage.sun.misc" permission to java.xml.ws. While you are going to update default.policy, can you check if java.xml.ws are still referencing these packages? Can you take out the ones that java.xml.ws no longer accesses? permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xml.internal.resolver"; permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xml.internal.resolver.tools"; permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.*";
31-01-2017

Patch with backported fixes for both Injector's is attached.
31-01-2017

For the consistent approach the JAXB injector part should be backported too: JDK-8170042
31-01-2017

Standalone JDK-8170370 fix was backported to 9 and jdk.unsupported module was added as dependency of java.xml.ws. For complete list of changes, please, see JDK-8170370_backported.patch. The reproducer app was executed over the fixed JDK9 and 'wsgen' generated the correct schema file with 'method1' inside (see Foo2Service_schema_withBackportedFix.xsd) We can integrate this patch now OR wait for the next synchronization with JAXWS-RI. What is the better way to handle it?
31-01-2017

Thanks for the analysis but java.base cannot open java.lang to the java.xml.ws (java.xml.ws is an upgradeable module). The proposal to disable this optimization is a temporary solution until JAX-WS is updated to use Unsafe.defineClass. We can do that now or later when the changes are in jdk9/dev - see JDK-8170370.
27-11-2016

The following changeset temporary disabled the code injection in jake/jaxws: changeset: 864:86edc7b0ab09 user: alanb date: Tue Aug 30 14:53:53 2016 +0100 summary: Tempoarily disable code injection in JAXB and JAX-WS --- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java Sat Aug 27 15:32:31 2016 -0700 +++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java Tue Aug 30 14:53:53 2016 +0100 @@ -347,6 +347,7 @@ } private boolean noWrapperGen() { + if (Runtime.version().major() >= 9) return true; With code injection disabled the WrapperComposite.class is returned by RuntimeModeler::getRequestWrapperClass instead of dynamically creating response class with WrapperBeanGenerator::wrapperRequestWrapperBean. With WrapperComposite in use the dummy Foo2Service_schema2.xsd schema is generated. The code injection can be re-enabled but com.sun.xml.internal.ws.model.Injector needs to grant access to java.lang.ClassLoader protected methods. These modifications solves this issue and wsgen from jake repo generates the wsdl and xsd file: --- old/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/Injector.java 2016-11-25 02:54:52.445463206 +0300 +++ new/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/Injector.java 2016-11-25 02:54:52.357461334 +0300 @@ -55,6 +55,7 @@ @Override public Method[] run() { return new Method[]{ + // jdk.base needs to open java.lang to java.xml.ws to make these methods accessible getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer. getMethod(ClassLoader.class, "resolveClass", Class.class), getMethod(ClassLoader.class, "getPackage", String.class), --- old/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java 2016-11-25 02:54:52.833471460 + +++ new/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java 2016-11-25 02:54:52.741469503 + @@ -347,7 +347,6 @@ } private boolean noWrapperGen() { - if (Runtime.version().major() >= 9) return true; Object o = config.properties().get(SuppressDocLitWrapperGeneration); return (o!= null && o instanceof Boolean) ? ((Boolean) o) : false; } --- old/jdk/src/java.base/share/classes/module-info.java 2016-11-25 02:54:53.193479118 +0300 +++ new/jdk/src/java.base/share/classes/module-info.java 2016-11-25 02:54:53.089476905 +0300 @@ -315,4 +315,9 @@ provides java.nio.file.spi.FileSystemProvider with jdk.internal.jrtfs.JrtFileSystemProvider; + + // com.sun.xml.internal.ws.model.Injector needs to grant access to + // java.lang.ClassLoader methods + opens java.lang to java.xml.ws; + }
25-11-2016

Thanks for confirming, this will have to diagnosed and fixed before we integrate into JDK 9.
21-11-2016

This issue only happened on jake build.
21-11-2016

Frank - does this duplicate with regular builds of JDK 9 or is it specific to jake builds?
20-11-2016