• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while defining Constructor argument

 
meraj zia
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i've defined my constructor as

public DefaultValidationService(Map<DomainType, Map<PaymentScheme, List<ValidationRule<Object>>>> ruleMap, boolean failFast) {
this.ruleMap = ruleMap;
this.failFast = failFast;
}

When i define my constructor argument in spring file like

<constructor-arg>
<map>
<entry key="SUBMISSION">
<map>
<entry key="B2B">
<list>
<bean class="com.voca.csm.dd.validation.rules.pacs.header.ClearingSystemProprietaryRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs.header.SubmittingBICValidRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs.header.SettlementMethodRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.header.InterBankSettDateOneProcessingDayRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.header.InterbankSettlementAmountWithinClearingLimitRule" parent="abstractValidationRule"/>
</list>
</entry>
</map>
</entry>
<entry key="INSTRUCTION">
<map>
<entry key="B2B">
<list>
<bean class="com.voca.csm.dd.validation.rules.pacs.instruction.TransactionIdentificationRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs.instruction.InstructingAgentExistsInBodyOrGrpHeaderRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs.instruction.InstructingAgentValidInBodyOrGrpHeaderRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.OriginalDebtorAgentSeqTypeFRSTRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs.instruction.DebtorAgentReachableRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.SequenceTypeFRSTOnlyRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.CreditorSchemePrivateIdOtherValueModCheckRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.InterBankSettDateCalendarDaysWarehouseRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.OriginalCreditorSchemePrivateIdOtherValueModCheckRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.OriginalMandateIdentificationRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.OriginalCreditorSchemeIdentificationNameRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.OriginalDebtorAccountValidIBANRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.DebtorAccountValidIBANRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.CreditorAccountValidIBANRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs.instruction.InstructingAgentSubmittingBICRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.SequenceTypeExistsInBodyOrGrpHeaderRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.AmendmentInformationDetailsPresentRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.SequenceTypeExistsOnlyInBodyOrGrpHeaderRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.PaymentTypeInfoExistsOnlyInBodyOrGrpHeaderRule" parent="abstractValidationRule"/>
<bean class="com.voca.csm.dd.validation.rules.pacs003.instruction.CreditorSchemePrivateIdOtherIDSEPACheckRule" parent="abstractValidationRule"/>
</list>
</entry>
</map>
</entry>
</map>
</constructor-arg>


I get this error

Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.Map]: Could not convert constructor argument value of type [java.util.LinkedHashMap] to required type [java.util.Map]: Failed to convert value of type [java.util.LinkedHashMap] to required type [java.util.Map]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList] to required type [java.util.Map] for property 'null': no matching editors or conversion strategy found">org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pacs003Parser' defined in class path resource [spring/parser.xml]: Cannot resolve reference to bean 'arrivalPacs003ValidationService' while setting bean property 'validationService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arrivalPacs003ValidationService' defined in class path resource [spring/validation.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.Map]: Could not convert constructor argument value of type [java.util.LinkedHashMap] to required type [java.util.Map]: Failed to convert value of type [java.util.LinkedHashMap] to required type [java.util.Map]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList] to required type [java.util.Map] for property 'null': no matching editors or conversion strategy found

Any suggestions please.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have some typos in that post.

public DefaultValidationService(Map<DomainType, Map><PaymentScheme,

What are the names of the constructor args, and why aren't you even using them in the code in the constructor?

Also, when you post code or configuration files, please use the CODE tags so that the formatting stays and it is readable. Right now I can't read your config stuff, and there appears to be some typos there too, like no closing tags.

Mark>
 
meraj zia
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it's there



The name are ruleMap and failFast

Spring file entry



 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Map<DomainType, Map><PaymentScheme, List><ValidationRule><Object>>>> is so confusing, can you rewrite you code?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic