简体   繁体   English

无法为Service类创建对象

[英]Creation of Object for Service class is not working

public CI[] getCIDetailsTest(String ci_type,String selectedCI) throws Exception{ 公共CI [] getCIDetailsTest(String ci_type,String selectedCI)引发异常{

        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 那是我在Java文件中的语句

But, to my surprise it was unable to create Service Object.. 但是,令我惊讶的是,它无法创建服务对象。

It is printing first println statement and not printing second println statement. 它正在打印第一个println语句,而不在打印第二个println语句。 That means It was unable to creat Service object. 这意味着它无法创建Service对象。

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 math3-commons-3.2.jar
  2. XStream-1.4.4.jar XStream-1.4.4.jar
  3. jaxws-api-2.2.5.jar jaxws-api-2.2.5.jar

The problem is the version of JAX-WS API . 问题是JAX-WS API的版本。 The classloader for your application first loaded the version included in Java SE or Java EE. 应用程序的类加载器首先加载Java SE或Java EE中包含的版本。

For Java SE 6 or Java EE 5, JAX-WS API 2.1. 对于Java SE 6 or Java EE 5, JAX-WS API 2.1. The constructors in javax.xml.ws.Service : javax.xml.ws.Service中的构造函数:

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

For Java SE 7 or Java EE 6, JAX-WS API 2.2. 对于Java SE 7 or Java EE 6, JAX-WS API 2.2. The constructors in javax.xml.ws.Service : 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): 有三种可能的解决方案(取决于它是Web应用程序还是独立应用程序):

  1. Use Java SE 7 or Java EE 6 . 使用Java SE 7 or Java EE 6
  2. Re-run wsdl2java with argument -frontend jaxws21 to generate JAX-WS 2.1 compliant code instead. 使用参数-frontend jaxws21重新运行wsdl2java,以生成兼容JAX-WS 2.1代码。
  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. 它还必须具有公共构造函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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