0

I have a simple web service project. Here is code:

package mypack;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.Endpoint;
 
@WebService
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class Demo {
 
@WebMethod
public String sayHello(String msg){
return "Hello "+msg;
}
 
public static void main(String[] args){
Endpoint.publish("http://localhost:8888/DemoWS", new Demo());
}
} 

Here is the list of dependencies which reside in my classpath folder:

istack-commons-runtime-4.1.1.jar javax.activation-api-1.2.0.jar javax.annotation-api-1.3.2.jar javax.xml.soap-api-1.4.0.jar jaxb-api-2.3.1.jar jaxb-runtime-2.3.1.jar jaxb-xjc-2.3.1.jar jaxws-api-2.3.1.jar jsr181-api-1.0-MR1.jar maven-jaxb2-plugin-0.15.1.jar rt-2.3.1.jar saaj-impl-1.5.1.jar streambuffer-1.5.3.jar

I am using -classpath to compile and run. Compiles without problem, however when executing, it gives an error:

>java -cp ".;*" mypack.Demo

com.sun.xml.ws.model.Injector 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:573)

I did try to add dependencies which are mentioned here, but no success: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)

Kai
  • 1
  • 1

0 Answers0