javax.xml.ws.WebServiceException:org.apache.cxf.service.factory.ServiceConstructionException

时间:2013-12-11 10:12:51

标签: java spring web-services cxf

我试图在eclipse中使用java-first方法创建Web Service,我收到以下错误:

  

警告:处理ContextClosedEvent的ApplicationListener抛出异常       org.springframework.beans.factory.BeanCreationNotAllowedException:创建名为'cxf'的bean时出错:当这个工厂的单例处于销毁状态时不允许使用单例bean创建(不要在destroy方法实现中从BeanFactory请求bean!)           在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:209)

以下是我的界面。

@WebService    
public interface CountryCityManager {

    @WebMethod(operationName = "queryOrder", action = "urn:QueryOrder")
    @RequestWrapper(className = "nz.org.tcf.jaxws.QueryOrder", localName = "queryOrder", targetNamespace = "http://test.eg.org")
    @ResponseWrapper(className = "nz.org.tcf.jaxws.QueryOrderResponse", localName = "queryOrderResponse", targetNamespace = "http://test.eg.org")
    @WebResult(name = "return")
    public Country [] queryOrder( @WebParam(name = "arg0") Country query);


    @WebMethod(operationName = "insertCity", action = "urn:InsertCity")
    @RequestWrapper(className = "nz.org.tcf.jaxws.InsertCity", localName = "insertCity", targetNamespace = "http://test.eg.org")
    @ResponseWrapper(className = "nz.org.tcf.jaxws.InsertCityResponse", localName = "insertCityResponse", targetNamespace = "http://test.eg.org")
    @WebResult(name = "return")
    public String insertCity(  @WebParam(name = "arg0") Country params);

}

以下是实施。

@WebService(endpointInterface="test.eg.org.CountryCityManager")
public class CountryCityMgrImpl implements CountryCityManager {

    public CountryCityMgrImpl(){}

    @Override
    public Country[] queryOrder(Country query)
    {
        ApplicationContext context =  new ClassPathXmlApplicationContext("Beans.xml");
        CountryJDBCTemplate CountryJDBCTemplate = (CountryJDBCTemplate)context.getBean("CountryJDBCTemplate");
        Country [] countryRS = null;
          List<Country> countries = CountryJDBCTemplate.listCountries();
          int i=0;
          for (Country record : countries) {
             countryRS[i]=record;
             i++;
             System.out.print("ID : " + record.getId() );
             System.out.println(", Name : " + record.getName() );

          }
        return countryRS;
    }

    @Override
    public String insertCity(Country params) {

        return "To be implemented...";
    }    
}

0 个答案:

没有答案