BeanCreationException:创建名为'EmpInfo'的bean时出错

时间:2013-01-09 05:16:48

标签: spring cxf

[HTTP:101216]Servlet: "cxf" failed to preload on startup in Web application: "TestSpring-0.0.1-SNAPSHOT.war". org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EmpInfo': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403) at 

我的cxf.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
   xmlns:jaxws="http://cxf.apache.org/jaxws"
   xsi:schemaLocation="http://www.springframework.org/schema/beans  
   http://www.springframework.org/schema/beans/spring-beans.xsd 
   http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
   <!--  <jaxws:endpoint id="EmpInfo"
          implementor="#EmpInfoImpl"
          address="/EmpInfo"/> -->

           <jaxws:endpoint id="EmpInfo"
          implementor="com.test.example.impl.EmpInfoImpl"
          address="/EmpInfo"/>
    <!--  <bean id="EmpInfoImpl" class="com.test.example.impl.EmpInfoImpl" >
     <property name="emplist" ref="EmpList" />

 </bean>

 <bean id="EmpList" class="com.test.example.impl.EmployeeList" /> -->
      </beans>

@WebService(serviceName="EmpInfo",endpointInterface="com.test.example.EmpInfo",
portName="EmpInfoPortType", wsdlLocation="classpath:wsdl/EmpInfo.wsdl")
public class EmpInfoImpl implements EmpInfo{

private EmployeeList emplist;
public EmployeeList getEmplist() {
return emplist;
}

public void setEmplist(EmployeeList emplist) {
this.emplist = emplist;
 }

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub

}

public Employee getInfo(String id) {
    // TODO Auto-generated method stub
    return new Employee("Test","Test","888");
    //return emplist.getEmp(Integer.valueOf(id));
}

     }

我是CXF的新手,所以任何帮助都将受到高度赞赏

1 个答案:

答案 0 :(得分:0)

此问题已解决,我的代码中存在问题。