Announcement Announcement Module
No announcement yet.
Getting IllegalArgumentException when using XStreamMarshaller Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting IllegalArgumentException when using XStreamMarshaller

    Hi all,

    I'm new to spring and spring batch. I've checked these and other forums for a possible solution to my problem with no luck so far. Hopefully, someone here can guide me in the right direction.

    I'm adding the ability to read an xml file to an existing spring batch app that just reads and writes to a database using
    "org.springframework.oxm.xstream.XStreamMarshaller ". When I run the application I get the following exception:

    2012-09-26 16:21:39,629 main ERROR org.springframework.web.context.ContextLoader - Context initialization failed
    java.lang.IllegalArgumentException: Mapped value [org.springframework.batch.item.file.transform.Rang eArrayPropertyEditor] for custom editor key [org.springframework.batch.item.file.transform.Rang e[]] is not of required type [java.beans.PropertyEditor]

    at org.springframework.beans.factory.config.CustomEdi torConfigurer.postProcessBeanFactory(CustomEditorC
    at ationContext.invokeBeanFactoryPostProcessors(Abstr
    at ationContext.invokeBeanFactoryPostProcessors(Abstr
    at ationContext.refresh(AbstractApplicationContext.ja va:363)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized( 45)
    at org.apache.catalina.core.StandardContext.listenerS tart(
    at org.apache.catalina.core.StandardContext.start(Sta

    My beans are as follows:
    	<bean  id="sponsorReader" scope="step"
    		<property name="fragmentRootElementName" value="rec" />
    		<property name="resource" value="P:\work\KCO-223\sponsor-code-files\REMS.SPT.DLY.xml" />
    		<property name="unmarshaller" ref="sponsorMarshaller" />
    	<bean id="sponsorMarshaller"
    		<property name="aliases">
    		<util:map id="aliases" >
    		<entry key="rec" value="edu.ucdavis.kc.batch.domain.Sponsor" />
        	<entry key="sponsorCode" value="java.lang.String" />
        	<entry key="sponsorName" value="java.lang.String" />
         	<entry key="sponsorCategoryCode" value="java.lang.String" />
        	<entry key="sponsorAgencyCode" value="java.lang.String" />
        	<entry key="sponsorSubAgencyCode" value="java.lang.String" />
        	<entry key="sponsorForeignIndicator" value="java.lang.String" />
        	<entry key="sponsorForeignCountry" value="java.lang.String" />
        	<entry key="sponsorNameAlternate" value="java.lang.String" />
        	<entry key="parentSponsorCode" value="java.lang.String" />
        	<entry key="changeDate" value="java.util.Date" />
        	<entry key="requestiongLocation" value="java.lang.String" />
        	<entry key="requestDate" value="java.util.Date" />
        	<entry key="replacementSponsorCode" value="java.lang.String" />
        	<entry key="sponsorStatus" value="java.lang.String" />
        	<entry key="sponsorDuns" value="java.lang.String" />
        	<entry key="address1" value="java.lang.String" />
        	<entry key="address2" value="java.lang.String" />
        	<entry key="address3" value="java.lang.String" />
        	<entry key="address4" value="java.lang.String" />
        	<entry key="city" value="java.lang.String" />
        	<entry key="state" value="java.lang.String" />
        	<entry key="postalCode" value="java.lang.String" />
        	<entry key="url" value="java.lang.String" /> 
        	<entry key="sponsorAcronym" value="java.lang.String" />
        	<entry key="deactivatedDate" value="java.util.Date" />

    I initially thought it might be a version incompatibility issue since I had to find and load several jars to to CLASSNOTFOUND exceptions. See capture.jpg for my class path.

    I'm sure this is a pedestrian issue but being a newby, I'm having some difficulty locating the problem. If anyone can shed some light on this for me, I'd greatly appreciate it.

  • #2
    Comments from: org.springframework.beans.factory.config.CustomEdi torConfigurer

    * <p><b>NOTE:</b> Custom property editors registered with this configurer do
    * <i>not</i> apply to data binding. Custom editors for data binding need to
    * be registered on the {@link org.springframework.validation.DataBinder}:
    * Use a common base class or delegate to common PropertyEditorRegistrar
    * implementations to reuse editor registration there.

    The method within this class that is throwing the exception is: postProcessBeanFactory

    A customEditors is being used but it doesn't implement the right type. A java.beans.PropertyEditor

    Is it edu.ucdavis.kc.batch.domain.Sponsor?

    Good luck,