java - Unsatisfied dependency expressed through constructor argument with index 0 -


i getting following error. have mentioned java code related error.

error

following error getting

caused by: org.springframework.beans.factory.beancreationexception: not autowire field: private java.util.list com.hp.ccue.serviceexchange.rest.orderutilsresource.orderutils; nested exception org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'saworderutils' defined in url [jar:file:/opt/hp/propel/sx/web-inf/lib/sx-adapter-saw-2.20-snapshot.jar!/com/hp/ccue/serviceexchange/adapter/saw/util/saworderutils.class]: unsatisfied dependency expressed through constructor argument index 0 of type [com.hp.ccue.serviceexchange.adapter.saw.sawoperationexecutor]: : no qualifying bean of type [com.hp.ccue.serviceexchange.adapter.saw.sawoperationexecutor] found dependency: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {}; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.hp.ccue.serviceexchange.adapter.saw.sawoperationexecutor] found dependency: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {}         @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:561)         @ org.springframework.beans.factory.annotation.injectionmetadata.inject(injectionmetadata.java:88)         @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:331)         ... 58 more 

saworderutils.java file error related

package com.hp.ccue.serviceexchange.adapter.saw.util;  import com.google.common.base.predicate; import com.google.common.collect.immutablemap; import com.google.common.collect.maps; import com.hp.ccue.serviceexchange.sxconstants; import com.hp.ccue.serviceexchange.adapter.saw.sawconstants; import com.hp.ccue.serviceexchange.adapter.saw.sawoperationexecutor; import com.hp.ccue.serviceexchange.aggregation.aggregationconstants; import com.hp.ccue.serviceexchange.config.configuration; import com.hp.ccue.serviceexchange.message.messagetransformer; import com.hp.ccue.serviceexchange.message.builder.messageconstants; import com.hp.ccue.serviceexchange.utils.jsonutils; import com.hp.ccue.serviceexchange.utils.messageutils; import com.hp.ccue.serviceexchange.utils.orderutilsbase; import org.springframework.beans.factory.annotation.autowired; import org.springframework.stereotype.component;  import java.util.list; import java.util.map; import java.util.objects;  import static com.google.common.base.objects.firstnonnull; import static com.hp.ccue.serviceexchange.sxconstants.sawinstancescfg; import static com.hp.ccue.serviceexchange.utils.jsonutils.getfield;  @component public class saworderutils extends orderutilsbase {     @autowired     private configuration configuration;      @autowired     private messagetransformer messagetransformer;      @autowired     public saworderutils(sawoperationexecutor operationexecutor) {         super(sawconstants.saw_type, operationexecutor, sawinstancescfg.cfg_name);     }      @override     public map<string, string> getinstances() {         map<string, object> allinstanceconfigs = configuration.getconfiguration(getinstancesconfigpath());         map<string, object> instanceconfigs = maps.filtervalues(allinstanceconfigs, new predicate<object>() {             @override             public boolean apply(object input) {                 @suppresswarnings("unchecked")                 map<string, object> instanceconfig = (map<string, object>) input;                 return firstnonnull(jsonutils.getbooleanfield(instanceconfig, sawinstancescfg.r2f_enabled), false);             }         });         return messageutils.instancenames(instanceconfigs);     }      @override     protected map<string, string> fetchcatalogitems(string targetinstance) {         map<string, object> operationoutput = executeoperationforinstance(operation_get_catalog_items, targetinstance);         return getfield(operationoutput, messageconstants.result);     }      @override     protected list<string> fetchcontacts(string targetinstance) {         map<string, object> operationoutput = executeoperationforinstance(operation_get_contacts, targetinstance);         return getfield(operationoutput, messageconstants.result);     }      @override     public string getcatalogitemform(string targetinstance, string itemid, string authtoken) throws exception {         map<string, object> offeringoperationoutput = executeoperationforinstance(aggregationconstants.operation_get_offering, targetinstance,                 immutablemap.<string, object>of("itemid", itemid));          map<string, object> offering = getfield(offeringoperationoutput, messageconstants.result);          if (offering == null) {             return "";         }          map<string, object> infrastructure = configuration.getconfiguration(sxconstants.infrastructure_config);          if (objects.equals(jsonutils.getstrfield(offering, "summary", "type"), "support")) {             list<map<string, object>> fields = jsonutils.getfield(offering, "form", "fields");             fields.removeif(field -> {                 final string id = jsonutils.getstrfield(field, "id");                 return objects.equals(id, "name") || objects.equals(id, "description");             });         }          return messagetransformer.transformmessage(immutablemap.of(                 "offering", offering,                 "userauthtoken", authtoken,                 "infrastructure", infrastructure         ), "ui/optionshtmltransform.ftl");     } } 

sawoperationexecutor.java

package com.hp.ccue.serviceexchange.adapter.saw;  import com.google.common.net.httpheaders; import com.hp.ccue.serviceexchange.sxconstants.sawinstancescfg; import com.hp.ccue.serviceexchange.adapter.caseex.cxawareoperationexecutor; import com.hp.ccue.serviceexchange.adapter.saw.sawbeans.bulkoperationresult; import com.hp.ccue.serviceexchange.adapter.saw.sawbeans.bulkoperationresult.completionstatuses; import com.hp.ccue.serviceexchange.adapter.saw.sawbeans.bulkoperationresult.entityresult; import com.hp.ccue.serviceexchange.adapter.saw.sawbeans.bulkoperationresult.errordetails; import com.hp.ccue.serviceexchange.adapter.saw.util.sxsawimplproperties; import com.hp.ccue.serviceexchange.config.configuration; import com.hp.ccue.serviceexchange.http.httprequest; import com.hp.ccue.serviceexchange.http.httpresponse; import com.hp.ccue.serviceexchange.http.httpresponsewrapper; import com.hp.ccue.serviceexchange.operation.operationconstants; import com.hp.ccue.serviceexchange.utils.jsonutils; import com.hp.ccue.serviceexchange.utils.validationutils; import org.apache.http.statusline; import org.apache.http.message.basicstatusline; import org.springframework.beans.factory.annotation.autowired;  import javax.ws.rs.core.mediatype; import javax.ws.rs.core.response.status; import java.io.ioexception; import java.util.arraylist; import java.util.collection; import java.util.collections; import java.util.hashmap; import java.util.list; import java.util.locale; import java.util.map; import java.util.objects; import java.util.optional; import java.util.set; import java.util.function.function; import java.util.stream.collectors;  import static com.google.common.base.objects.firstnonnull; import static com.hp.ccue.serviceexchange.sxconstants.supported_language_tags;  public class sawoperationexecutor extends cxawareoperationexecutor {      private static final string login_request_url = "/auth/authentication-endpoint/authenticate/login";     private static final string download_attachment_url = "/frs/file-list/";     private static final string download_images_url = "/frs/image-list/";     private static final string images_url = "/js/modules/saw/resources/images/";      @autowired     private sawnotificationsetupexecutor notificationsetupexecutor;      private set<string> operationswithoutlogging;      @autowired     private configuration configuration;      public void setoperationswithoutlogging(set<string> operationswithoutlogging) {         this.operationswithoutlogging = operationswithoutlogging;     }      public sawoperationexecutor() {         super(sawconstants.saw_type, sawinstancescfg.cfg_name, true);         setdefaulthttprequestcontenttype(mediatype.application_json);     }      private collection<string> getinstanceendpoints(){         collection<string> instanceendpoints = new arraylist<>();         map<string, object> allinstanceconfigs = configuration.getconfiguration(sawinstancescfg.cfg_name);         (object value : allinstanceconfigs.values()) {             @suppresswarnings("unchecked")             map<string,object> instance = (map<string, object>) value;             instanceendpoints.add((string)instance.get("endpoint"));         }         return instanceendpoints;     }      @override     public void afterpropertiesset() throws exception {         super.afterpropertiesset();         set<string> skippedoperations = firstnonnull(operationswithoutlogging, collections.<string>emptyset());         (string operation : skippedoperations) {             skiploggingforoperation(operation);         }     }      @override     protected void beforeexecuteoperation(string operationname, map<string, object> message, map<string, object> context, boolean dologging) {         context.put(key_bundle, sxsawimplproperties.getmessagesbundle());         context.put(key_bundles, supported_language_tags.stream()                 .collect(collectors.tomap(function.identity(), tag -> sxsawimplproperties.getmessagesbundle(locale.forlanguagetag(tag)))));     }      @override     protected httpresponse afterhttpresponsereceived(final httpresponse httpresponse, final httprequest request) {         // saw http responses buggy!         // need wrap them determine proper content-type - server not send them         // must wrap methods have content-type handling         hashmap<string, object> context = new hashmap<>(); // unfortunately don't have context here; fixing required changing method signature         sawhttpresponsewrapper result = new sawhttpresponsewrapper(httpresponse, request);         geteffectivestatuscode(httpresponse, context).ifpresent(result::setstatus);         return result;     }      private optional<integer> geteffectivestatuscode(httpresponse httpresponse, map<string, object> context) {         try {             optional<bulkoperationresult> bulkoperationresult = parsebulkoperationresult(httpresponse, context);             if (bulkoperationresult.ispresent() && !objects.equals(bulkoperationresult.get().getmeta().getcompletionstatus(), completionstatuses.failed)) {                 return optional.empty();             }             return bulkoperationresult.flatmap(sawoperationexecutor::geterrordetails).map(errordetails::gethttpstatus);         } catch (exception e) {             return optional.empty();         }     }      private class sawhttpresponsewrapper extends httpresponsewrapper {          private final httprequest request;         private int statuscode;         private statusline statusline;          public sawhttpresponsewrapper(httpresponse httpresponse, httprequest request) {             super(httpresponse);             this.request = request;             this.statuscode = httpresponse.getstatuscode();             this.statusline = httpresponse.getstatusline();         }          @override         public string getheader(string headername) {             if (headername.equals(httpheaders.content_type) && !isurlknowntohavecorrectcontenttype(request.geturl())) {                 if (request.geturl().contains(login_request_url)) {                     // authentication response plaintext                     return mediatype.text_plain;                 } else {                     // other responses json                     return mediatype.application_json;                 }             }             // else:             return super.getheader(headername);         }          @override         public boolean hasstringcontent() {             //noinspection simplifiableifstatement             if (!isurlknowntohavecorrectcontenttype(request.geturl())) {                 return true;             }             return super.hasstringcontent();         }          @override         public boolean isjson() {             return getheader(httpheaders.content_type).equals(mediatype.application_json);         }          private boolean isurlknowntohavecorrectcontenttype(string url) {             (string endpoint : getinstanceendpoints()) {                 if (url.startswith(endpoint)) {                     return url.contains(download_attachment_url) || url.contains(images_url) || url.contains(download_images_url);                 }             }             return true;         }          @override         public int getstatuscode() {             return statuscode;         }          @override         public statusline getstatusline() {             return statusline;         }          void setstatus(int statuscode) {             this.statuscode = statuscode;             status status = status.fromstatuscode(statuscode);             string reasonphrase = status != null ? status.getreasonphrase() : string.format("http %s", statuscode);             this.statusline = new basicstatusline(getdelegate().getstatusline().getprotocolversion(), statuscode, reasonphrase);         }     }      @override     protected void executenotificationsetup(             string entityid, map<string,object> entity, string checkoperation, map<string, object> checkoperationinputmessage, string catalogcallbacktemplate,             entityregistrationmode mode, map<string, object> context, map<string, object> stepconfig) throws exception {         notificationsetupexecutor.executenotificationsetup(                 entityid, entity, checkoperation, checkoperationinputmessage, catalogcallbacktemplate, mode, context, stepconfig);     }      @override     protected boolean isresponsesuccess(string operationname, map<string, object> stepconfig, httpresponse httpresponse, map<string, object> message, map<string, object> context) {         final int statuscode = httpresponse.getstatuscode();         list<integer> whitelistedstatuses = firstnonnull(jsonutils.<list<integer>>getfield(stepconfig, operationconstants.report_success_for_http_statuses),                 collections.<integer>emptylist());         //noinspection simplifiableifstatement         if (whitelistedstatuses.contains(statuscode)) {             return true;         }         return statuscode < 400;     }      private optional<bulkoperationresult> parsebulkoperationresult(httpresponse httpresponse, map<string, object> context) {         if (!httpresponse.isjson()) {             return optional.empty();         }         object jsonpayload;         try {             jsonpayload = parsejsonpayload(httpresponse, context);         } catch (ioexception e) {             throw new runtimeexception(e);         }         if (!(jsonpayload instanceof map)) {             return optional.empty();         }         bulkoperationresult bulkoperationresult;         try {             //noinspection unchecked             bulkoperationresult = jsonutils.readbean((map<string, object>) jsonpayload, bulkoperationresult.class);             validationutils.validatebean(bulkoperationresult);         } catch (exception e) {             return optional.empty();         }         return optional.of(bulkoperationresult);     }      @override     protected string getdetailerrormessage(string operationname, map<string, object> stepconfig, httpresponse httpresponse, map<string, object> message, map<string, object> context) {         if (!httpresponse.isjson()) {             return null;         }         try {             errordetails errordetails = parsebulkoperationresult(httpresponse, context).flatmap(sawoperationexecutor::geterrordetails).orelse(null);             if (errordetails == null) {                 return null;             }             final integer httpstatus = errordetails.gethttpstatus();             final string detailmessage = errordetails.getmessage();             if (httpstatus == null || detailmessage == null) {                 return null;             }             return string.format("%s (effective http status: %s)", detailmessage, httpstatus);         } catch (runtimeexception e) {             log.debug("failed extract detail message.", e);             return null;         }     }      private static optional<errordetails> geterrordetails(bulkoperationresult bulkoperationresult) {         errordetails errordetails;         final list<entityresult> entityresultlist = bulkoperationresult.getentityresultlist();         if (entityresultlist.size() != 1) { // let's cover case of single entity             errordetails = bulkoperationresult.getmeta().geterrordetails();         } else {             errordetails = entityresultlist.get(0).geterrordetails();         }         return optional.ofnullable(errordetails);     } } 

sawadaptercontext.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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"         xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">      <context:component-scan base-package="com.hp.ccue.serviceexchange.adapter.saw"/>     <context:component-scan base-package="com.hp.ccue.serviceexchange.adapter.saw.util"/>     <context:component-scan base-package="com.hp.ccue.serviceexchange.adapter.saw.sawbeans"/>     <context:component-scan base-package="com.hp.ccue.serviceexchange.adapter.saw.caseex"/>     <context:component-scan base-package="com.hp.ccue.serviceexchange.adapter.saw.freemarker"/>     <context:component-scan base-package="com.hp.ccue.serviceexchange.adapter.saw.healthcheck"/>     <!--  <bean class="com.hp.ccue.serviceexchange.adapter.saw.sawoperationexecutor">         <property name="operationswithoutlogging">             <set>                 <value>getchangedincidents</value>                 <value>getchangedrequests</value>                 <value>getchangedofferings</value>                 <value>getaggregationfeatures</value>             </set>         </property>     </bean> -->      <!--         avoid illegalargumentexception when autowiring lastupdatedentitydao in sawchangelistener:         http://stackoverflow.com/questions/18369258/spring-aop-at-service-layer     -->     <aop:aspectj-autoproxy proxy-target-class="true"/>  </beans> 

i think you're missing @component annotation on sawoperationexecutor class


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -