简体   繁体   中英

Creation of Object for Service class is not working

public CI[] getCIDetailsTest(String ci_type,String selectedCI) throws Exception{

        String endpoint = getProperty(customerID+"_endpoint");
        System.out.println("reached here .......done.."+endpoint);
        //here failed 
        Service service = new Service();
        System.out.println("reached here .......done..........."+service);

That is my statements in Java file

But, to my surprise it was unable to create Service Object..

It is printing first println statement and not printing second println statement. That means It was unable to creat Service object.

Is it jar problem? If it is jar problem, Which jar to be included?

Friends, Kindly Help me out to resolve this issue....

you should add this jar:

  1. math3-commons-3.2.jar
  2. XStream-1.4.4.jar
  3. jaxws-api-2.2.5.jar

The problem is the version of JAX-WS API . The classloader for your application first loaded the version included in Java SE or Java EE.

For Java SE 6 or Java EE 5, JAX-WS API 2.1. The constructors in javax.xml.ws.Service :

javax.xml.ws.Service.Service(URL, QName)

For Java SE 7 or Java EE 6, JAX-WS API 2.2. The constructors in javax.xml.ws.Service :

javax.xml.ws.Service.Service(URL, QName)
javax.xml.ws.Service.Service(URL, QName, WebServiceFeature...)  // You need this!

There are three possible solutions (depends on whether it is a web application or standalone application):

  1. Use Java SE 7 or Java EE 6 .
  2. Re-run wsdl2java with argument -frontend jaxws21 to generate JAX-WS 2.1 compliant code instead.
  3. Change the classloader for load first the classes included in the application.

you should refer this link

Are you sure the Service is (a not) abstract class and not an interface. It must also have a public constructor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM