Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8169496

JAXB.newInstance needs to spec that classesToBeBound may be deeply reflected on

XMLWordPrintable

      JAXBContext.newInstance spec needs to be updated to make it clear that classesToBeBound must be open to the java.xml.bind.

      The following is one example from testing JAX-WS where the java.xml.ws module did not know to open a package to java.xml.bind.

      java.lang.ExceptionInInitializerError
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.addressing.WsaTube.getTubeHelper(WsaTube.java:124)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.addressing.WsaTube.<init>(WsaTube.java:90)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.addressing.WsaServerTube.<init>(WsaServerTube.java:84)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.addressing.W3CWsaServerTube.<init>(W3CWsaServerTube.java:52)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.api.pipe.ServerTubeAssemblerContext.createWsaTube(ServerTubeAssemblerContext.java:215)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.assembler.jaxws.AddressingTubeFactory.createTube(AddressingTubeFactory.java:47)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.assembler.TubeCreator.createTube(TubeCreator.java:81)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.assembler.MetroTubelineAssembler.createServer(MetroTubelineAssembler.java:177)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:178)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.server.EndpointFactory.create(EndpointFactory.java:322)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.server.EndpointFactory.create(EndpointFactory.java:317)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:149)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:563)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:545)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:308)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:240)
      at com.sun.ts.lib.server.endpoint.EndpointData.publish(EndpointData.java:59)
      at com.sun.ts.lib.server.WSDataProvider.getWSData(WSDataProvider.java:59)
      at com.sun.ts.lib.server.JAXWSServer.publishEndpoints(JAXWSServer.java:195)
      at com.sun.ts.lib.server.JAXWSServer.run(JAXWSServer.java:100)
      at com.sun.ts.lib.server.JAXWSHttpServer.run(JAXWSHttpServer.java:112)
      at com.sun.ts.lib.server.JAXWSHttpServer.run(JAXWSHttpServer.java:49)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:537)
      at com.sun.jck.lib.ExecJCKTestSameJVMCmd$SimpleTest.run(ExecJCKTestSameJVMCmd.java:425)
      at com.sun.jck.lib.ExecJCKTestSameJVMCmd.execute(ExecJCKTestSameJVMCmd.java:379)
      at com.sun.jck.lib.ExecJCKTestSameJVMCmd.run(ExecJCKTestSameJVMCmd.java:298)
      at com.sun.javatest.agent.Agent$Task.executeCommand(Agent.java:847)
      at com.sun.javatest.agent.Agent$Task.execute(Agent.java:790)
      at com.sun.javatest.agent.Agent$Task.handleRequest(Agent.java:645)
      at com.sun.javatest.agent.Agent.handleRequestsUntilClosed(Agent.java:416)
      at com.sun.javatest.agent.Agent.access$000(Agent.java:60)
      at com.sun.javatest.agent.Agent$1.run(Agent.java:282)
      at java.base/java.lang.Thread.run(Thread.java:844)
      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String com.sun.xml.internal.ws.addressing.ProblemAction.action accessible: module java.xml.ws does not "opens com.sun.xml.internal.ws.addressing" to module java.xml.bind
      at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:424)
      at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:198)
      at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
      at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.runtime.reflect.Accessor$FieldReflection.<init>(Accessor.java:233)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.runtime.reflect.Accessor$FieldReflection.<init>(Accessor.java:221)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.AccessorFactoryImpl.createFieldAccessor(AccessorFactoryImpl.java:55)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.createFieldSeed(RuntimeClassInfoImpl.java:250)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.createFieldSeed(RuntimeClassInfoImpl.java:71)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.findFieldProperties(ClassInfoImpl.java:393)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:296)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:171)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:246)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:88)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:69)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:212)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:83)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:69)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:360)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:375)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:439)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:277)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:124)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1123)
      at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:147)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:537)
      at java.xml.bind@9-ea/javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:275)
      at java.xml.bind@9-ea/javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:265)
      at java.xml.bind@9-ea/javax.xml.bind.ContextFinder.find(ContextFinder.java:390)
      at java.xml.bind@9-ea/javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:665)
      at java.xml.bind@9-ea/javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:609)
      at java.xml.ws@9-ea/com.sun.xml.internal.ws.addressing.WsaTubeHelperImpl.<clinit>(WsaTubeHelperImpl.java:47)
      ... 36 more

            rgrigoriadi Roman Grigoriadi (Inactive)
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: