Mình đang học webservice theo link này https://www.javatpoint.com/jax-ws-example-document-style
Nhưng khi run thì bị lỗi như này:
SEVERE: null
java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:558)
at com.sun.xml.ws.model.Injector.<clinit>(Injector.java:105)
at com.sun.xml.ws.model.WrapperBeanGenerator.createRequestWrapperBean(WrapperBeanGenerator.java:295)
at com.sun.xml.ws.model.RuntimeModeler.getRequestWrapperClass(RuntimeModeler.java:375)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:801)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:731)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:491)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:320)
at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:100)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:120)
at com.sun.xml.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:882)
at com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:899)
at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:862)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:451)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:420)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:475)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:479)
at javax.xml.ws.Service.getPort(Service.java:240)
at demo.HelloWorldClient.main(HelloWorldClient.java:16)
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
at java.base/java.lang.Class.getMethod(Class.java:2195)
at com.sun.xml.ws.model.Injector$3.run(Injector.java:109)
at com.sun.xml.ws.model.Injector$3.run(Injector.java:105)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
... 20 more
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.sun.xml.ws.model.WrapperBeanGenerator.createRequestWrapperBean(WrapperBeanGenerator.java:295)
at com.sun.xml.ws.model.RuntimeModeler.getRequestWrapperClass(RuntimeModeler.java:375)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:801)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:731)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:491)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:320)
at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:100)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:120)
at com.sun.xml.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:882)
at com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:899)
at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:862)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:451)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:420)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:475)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:479)
at javax.xml.ws.Service.getPort(Service.java:240)
at demo.HelloWorldClient.main(HelloWorldClient.java:16)
Caused by: javax.xml.ws.WebServiceException: java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
at com.sun.xml.ws.model.Injector.<clinit>(Injector.java:123)
... 19 more
Suppressed: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @3745e5c6
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at com.sun.xml.ws.model.Injector.getMethod(Injector.java:133)
at com.sun.xml.ws.model.Injector.access$000(Injector.java:62)
at com.sun.xml.ws.model.Injector$1.run(Injector.java:79)
at com.sun.xml.ws.model.Injector$1.run(Injector.java:75)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at com.sun.xml.ws.model.Injector.<clinit>(Injector.java:74)
... 19 more
Caused by: java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:558)
at com.sun.xml.ws.model.Injector.<clinit>(Injector.java:105)
... 19 more
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
at java.base/java.lang.Class.getMethod(Class.java:2195)
at com.sun.xml.ws.model.Injector$3.run(Injector.java:109)
at com.sun.xml.ws.model.Injector$3.run(Injector.java:105)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
... 20 more