问题描述
服务端ICustomerDao类packagecom.crm.idao;importjava.util.List;importjavax.jws.WebService;importcom.crm.entity.Customer;@WebServicepublicinterfaceICustomerDao{publicListgetCustomers();publicStringpring(intid);}ICustomerDao.aegis.xml文件<?xmlversion="1.0"encoding="UTF-8"?><mappings><mapping><methodname="getCustomers"><return-typecomponentType="com.crm.entity.Customer"/></method></mapping></mappings>客户端:ICustomerTest类packagecom.test.service;publicclassCustomerTest{privateICustomerDaocd;publicICustomerDaogetCd(){returncd;}publicvoidsetCd(ICustomerDaocd){this.cd=cd;}publicvoidprint(){System.out.println(cd.pring(1));System.out.println(cd.getCustomers().size());}}test2类packagetest;importorg.springframework.context.ApplicationContext;importorg.springframework.context.support.ClassPathXmlApplicationContext;importcom.test.service.CustomerTest;importcom.test.service.TestServices;publicclasstest2{/***@paramargs*/publicstaticvoidmain(String[]args){String[]str=newString[]{"resource/app*.xml"};ApplicationContextac=newClassPathXmlApplicationContext(str);CustomerTestct=(CustomerTest)ac.getBean("customerTest");ct.print();}}服务端tomcat运行时没有出错。运行test2类时报错:信息:Destroyingsingletonsinorg.springframework.beans.factory.support.DefaultListableBeanFactory@102799c:definingbeans[userInfoService,testService];rootoffactoryhierarchyExceptioninthread"main"org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'userInfoService'definedinfile[D:J2EElianxispringxfireclt1binresourceapplicationContext.xml]:Invocationofinitmethodfailed;nestedexceptionisjava.net.ConnectException:Connectionrefused:connectCausedby:java.net.ConnectException:Connectionrefused:connectatjava.net.PlainSocketImpl.socketConnect(NativeMethod)atjava.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)atjava.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)atjava.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)atjava.net.Socket.connect(Socket.java:519)atjava.net.Socket.connect(Socket.java:469)atsun.net.NetworkClient.doConnect(NetworkClient.java:157)atsun.net.www.http.HttpClient.openServer(HttpClient.java:394)atsun.net.www.http.HttpClient.openServer(HttpClient.java:529)atsun.net.www.http.HttpClient.<init>(HttpClient.java:233)atsun.net.www.http.HttpClient.New(HttpClient.java:306)atsun.net.www.http.HttpClient.New(HttpClient.java:323)atsun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)atsun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)atsun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)atsun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)atjava.net.URL.openStream(URL.java:1009)atorg.codehaus.xfire.util.Resolver.tryFileSystem(Resolver.java:83)atorg.codehaus.xfire.util.Resolver.<init>(Resolver.java:47)atorg.codehaus.xfire.util.Resolver.<init>(Resolver.java:35)atorg.codehaus.xfire.spring.remoting.XFireClientFactoryBean.makeClient(XFireClientFactoryBean.java:496)atorg.codehaus.xfire.spring.remoting.XFireClientFactoryBean.createClient(XFireClientFactoryBean.java:412)atorg.codehaus.xfire.spring.remoting.XFireClientFactoryBean.afterPropertiesSet(XFireClientFactoryBean.java:119)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)atorg.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)atorg.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)attest.test2.main(test2.java:17)