2014-02-13 77 views
1

我已經定義見下文我bean.xml Web服務錯誤創建名稱爲豆「myServiceCustomerOffer」在ServletContext的資源定義[/WEB-INF/beans.xml]

<jaxws:endpoint id="serviceCustomerOffer" implementor="#myServiceCustomerOffer" 
     implementorClass="com.abc.mime.ws.manage.customeroffer.ManageCustomerOfferImpl" 
     address="/getCustomerOffer" /> 

    <bean id="myServiceCustomerOffer" name="myServiceCustomerOfferName" class="com.abcd.mime.ws.manage.customeroffer.ManageCustomerOfferImpl" > 
     <constructor-arg index="0" ref="CustomerOfferFacade" /> 
    </bean> 

    <bean id="CustomerOfferFacade" name="CustomerOfferFacade" 
     class="com.abc.mime.ws.facade.customeroffer.CustomerOfferFacadeImpl"> 
     <constructor-arg index="0" ref="customerOfferDAO" /> 
     <constructor-arg index="1" ref="generalDomainSql" /> 
    </bean> 

    <bean id="customerOfferDAO" name="customerOfferDAOName" 
     class="com.abc.mime.ws.dao.bscs.sql.customeroffer.CustomerOfferDAOImpl"> 

    </bean> 
      <bean id="generalDomainSql" name="generalDomainSqlName" 
     class="com.abcd.mime.ws.dao.bscs.sql.generaldomain.GeneralDomainDAOImpl"> 
    </bean> 

我得到以下部署時出錯tomcat 6服務器。所有的類都以適當的結構來定義。

13/Feb/2014 05:08:10,423 [http-8090-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceCustomerOffer': Cannot resolve reference to bean 'myServiceCustomerOffer' while setting constructor argument with index 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myServiceCustomerOffer' defined in ServletContext resource [/WEB-INF/beans.xml]: 1 constructor arguments specified but no matching constructor found in bean 'myServiceCustomerOffer' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities) 
Caused by: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myServiceCustomerOffer' defined in ServletContext resource [/WEB-INF/beans.xml]: 1 constructor arguments specified but no matching constructor found in bean 'myServiceCustomerOffer' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities) 
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:145) 

這是我的代碼中使用的ManageCustomerOfferImpl.java。這也映射在wsdl文件中。

package com.abcd.mime.ws.manage.customeroffer; 
import java.rmi.RemoteException; 
import java.util.Date; 

import javax.jws.WebService; 

import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory; 
import com.abcd.mime.ws.manage.customeroffer.ManageCustomerOffer; 

@WebService(endpointInterface = "com.abcd.mime.ws.manage.customeroffer.ManageCustomerOffer") 
public class ManageCustomerOfferImpl implements ManageCustomerOffer{ 



     private CustomerOfferFacade customerOfferFacade; 

     private Log logger = LogFactory 
       .getLog(com.abcd.mime.ws.manage.customeroffer.ManageCustomerOfferImpl.class); 

public ManageCustomerOfferImpl(CustomerOfferFacade _customerOffer) { this.customerOfferFacade = _customerOffer; } 

     @Override 
     public CustomerOfferResponse getCustomerOffer(CustomerOfferRequest customerOfferRequest) throws CustomerOfferFault { 

      logger.debug("ManageCustomerOfferImpl - getCustomerOffer: Received from Consumer MSISDN = ["+ customerOfferRequest.getMSISDN()+"]"); 
      // TODO Auto-generated method stub 

      ustomerOfferResponse customerOfferResponse = customerOfferFacade.getCustomerOffer(customerOfferRequest); 


      logger.debug("ManageCustomerOfferImpl - getCustomerOffer: Sending Response back to Consumer =>> "+ customerOfferResponse); 
      return customerOfferResponse; 
     } 

    } 

據早前工作,但同時使得一些更正它停止工作

Error13/Feb/2014 09:22:06,625 [http-8090-2] ERROR org.springframework.web.context.ContextLoader - Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceCustomerOffer': Invocation of init method failed; nested exception is java.lang.StackOverflowError 
Caused by: 
java.lang.StackOverflowError 
    at java.lang.ref.SoftReference.get(SoftReference.java:93) 
    at java.lang.Class.privateGetDeclaredFields(Class.java:2285) 
    at java.lang.Class.getDeclaredFields(Class.java:1743) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:298) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:227) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:179) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:172) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:301) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:227) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:179) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:172) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:301) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:227) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:179) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:172) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:301) 
    Feb 13, 2014 9:22:06 AM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceCustomerOffer': Invocation of init method failed; nested exception is java.lang.StackOverflowError 
Caused by: java.lang.StackOverflowError 
    at java.lang.ref.SoftReference.get(SoftReference.java:93) 
    at java.lang.Class.privateGetDeclaredFields(Class.java:2285) 
    at java.lang.Class.getDeclaredFields(Class.java:1743) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:298) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:227) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:179) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:172) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:301) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:227) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:179) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:172) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:301) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:227) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:179) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:172) 
    at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:301) 
+0

我的意思是錯誤非常明顯。我們可以看到你的'ManageCustomerOfferImpl'類嗎? –

+0

@SotiriosDelimanolis我添加了'ManageCustomerOfferImpl.java'的代碼 – RaG

+0

@SotiriosDelimanolis我已經更新了'ManageCustomerOfferImpl.java'的代碼 – RaG

回答

0

你的bean聲明爲

<bean id="myServiceCustomerOffer" name="myServiceCustomerOfferName" class="com.abcd.mime.ws.manage.customeroffer.ManageCustomerOfferImpl" > 
    <constructor-arg index="0" ref="CustomerOfferFacade" /> 
</bean> 

這意味着它將使用期望的參數的構造無論什麼類型的CustomerOfferFacade是。但是,你的類沒有這樣的構造函數。因此它失敗了。

我不知道是什麼CustomerOfferFacadeImpl是這樣,我不知道你希望用它做什麼,但你需要,如果你希望你的<bean>聲明與該類型的參數來添加一個構造函數工作。

+0

@RaG好的。那又怎麼樣?另外,不要將代碼放在註釋中。 –

+0

錯誤: '13/Feb/2014 08:36:25,090 [http-8090-2]錯誤org.springframework.web.context.ContextLoader - 上下文初始化失敗 org.springframework.beans.factory.BeanCreationException:創建bean時出錯名稱爲'serviceCustomerOffer':調用init方法失敗;嵌套的例外是java.lang.StackOverflowError的 所致: java.lang.StackOverflowError的 \t在java.lang.System中的$ 2.getConstantPool(System.java:1130) \t在java.lang.reflect.Field.declaredAnnotations(場.java:1014) \t at java.lang.reflect.Field.getAnnotation(Field.java:1000) ' – RaG

相關問題