aspose file tools*
The moose likes Other Application Frameworks and the fly likes Error while defining Constructor argument Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Error while defining Constructor argument" Watch "Error while defining Constructor argument" New topic
Author

Error while defining Constructor argument

meraj zia
Greenhorn

Joined: Apr 17, 2009
Posts: 5
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

Joined: Feb 05, 2001
Posts: 17257
    
    6

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>


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
meraj zia
Greenhorn

Joined: Apr 17, 2009
Posts: 5
I believe it's there



The name are ruleMap and failFast

Spring file entry



Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
I think Map<DomainType, Map><PaymentScheme, List><ValidationRule><Object>>>> is so confusing, can you rewrite you code?


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while defining Constructor argument