java - Context initialization failed, Bean creation exception -



java - Context initialization failed, Bean creation exception -

i have problem above exception please give guide line, here code:

//calling class bundle com.company.product.wsai.qb.ws.endpoint; //imports @endpoint public class sendrequestxmlendpoint implements sendrequestxmlmanagementservice { string strerrormsg = ""; // xml logging private static final string send_request_xml = "sendrequestxml"; private static final string send_request_xml_response = "sendrequestxmlresponse"; @autowired com.intuit.developer.objectfactory wsobjectfactory; @autowired com.intuit.quickbooks.objectfactory qbobjectfactory; @autowired testservice testservice; @autowired historyserviceimpl historyservice; public static list<tacategorysyncentitydto> travelagentcategorylist ; //match customertype in qb public static list<travelagentsyncentitydto> travelagentlist; //match client in qb public static list<vendorsyncentitydto> vendorlist; //match vendor in qb public static list<currencysyncentitydto> currencylist; //match currency in qb public static list<itemsyncentitydto> iteminventorylist; //match item in qb public void dotravelagent(){ try{ //methods }catch (exception e) { e.printstacktrace(); } } public void dotravelagentcategory(){ try{ //methods }catch (exception e) { e.printstacktrace(); } } public void dovendor(){ try{ //methods }catch (exception e) { e.printstacktrace(); } } public void docurrency(){ try{ //methods }catch (exception e) { e.printstacktrace(); } } @payloadroot(localpart = "sendrequestxml", namespace = xmlconfig.qb_wc_namespace) @responsepayload public sendrequestxmlresponse sendrequestxmlcommon(@requestpayload sendrequestxml sendrequestxml) { dotravelagentcategory(); dotravelagent(); dovendor(); docurrency(); string sessionticket = sendrequestxml.getticket(); string strcompanyfilename = sendrequestxml.getstrcompanyfilename(); // log request xmllogmanager.logsendrequestxmlenpoint(sendrequestxml, send_request_xml, sessionticket); sendrequestxmlresponse sendrequestxmlresponse = wsobjectfactory.createsendrequestxmlresponse(); sendrequestxmlresponse.setsendrequestxmlresult(getsentxmlresult()); // log response xmllogmanager.logsendrequestxmlenpoint(sendrequestxmlresponse, send_request_xml_response, sessionticket); updatehistory(); homecoming sendrequestxmlresponse; } private string getsentxmlresult() { try{ //generate xml quickbook } grab (jaxbexception e) { e.printstacktrace(); } homecoming stringwriter.tostring(); } public void updatehistory(){ history tahistory = new history(); date dtreturn = stringtodate("19-06-2014"); system.out.println(dtreturn); tahistory.setid(1l); tahistory.setentityevent('c'); tahistory.setentitytype("travelagent"); tahistory.setentityname("test"); tahistory.sethotelcode("bbh"); tahistory.setrecordtransfered('1'); tahistory.setcreatedby("test_user"); tahistory.setcreateddate(dtreturn); tahistory.setversion(1); try{ historyservice.savehistory(tahistory); }catch (exception e) { e.printstacktrace(); } } public static date stringtodate(string strdate) { date dtreturn = null; homecoming dtreturn; } } //dao implementation class bundle com.company.product.wsai.qb.dao.historydao; //imports public class historydaoimpl implements historydao { private sessionfactory sessionfactory; public sessionfactory getsessionfactory() { homecoming sessionfactory; } public void setsessionfactory(sessionfactory sessionfactory) { this.sessionfactory = sessionfactory; } @override public void savehistory(history history) { sessionfactory.getcurrentsession().save(history); } } //service implementation bundle com.company.product.wsai.qb.historyservice; //imports

public class historyserviceimpl implements historyservice {

@autowired private historydao historydao; public void savehistory(history history) { historydao.savehistory(history); } } //config xml //remove upper part <context:component-scan base-package="com.jkcsworld.zhara.wsai.qb.historyservice" /> <context:component-scan base-package=" com.jkcsworld.zhara.wsai.qb.dao.historydao" /> <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="configlocation"> <value>/resources/hibernate.cfg.xml</value> </property> </bean> <bean id="historydao" class="com.jkcsworld.zhara.wsai.qb.dao.historydao.historydaoimpl"> <property name="sessionfactory" ref="sessionfactory"/> </bean> </beans>

when include autowired in calling class it's given error in screen shot

your component scan should cover bundle

package com.company.product.wsai.qb.ws.endpoint;

edit config.xml following, , 1 component-scan enough.

<context:component-scan base-package="com.jkcsworld.zhara.wsai.qb" /> <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="configlocation"> <value>/resources/hibernate.cfg.xml</value> </property> </bean> <bean id="historydao" class="com.jkcsworld.zhara.wsai.qb.dao.historydao.historydaoimpl"> <property name="sessionfactory" ref="sessionfactory"/> </bean>

the problem can not find matching bean sendrequestxmlendpoint.historyservice

so mark service

package com.company.product.wsai.qb.historyservice; //imports @service // mark service public class historyserviceimpl implements historyservice { @autowired private historydao historydao; public void savehistory(history history) { historydao.savehistory(history); } }

java xml spring hibernate spring-orm

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -