我已經定義見下文我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)
我的意思是錯誤非常明顯。我們可以看到你的'ManageCustomerOfferImpl'類嗎? –
@SotiriosDelimanolis我添加了'ManageCustomerOfferImpl.java'的代碼 – RaG
@SotiriosDelimanolis我已經更新了'ManageCustomerOfferImpl.java'的代碼 – RaG