1 Reply Latest reply on Jul 2, 2010 8:27 AM by alesj

    How to handle character arrays in xml

    dbschofield

      <bean name="ValueBean">
          <constructor>
            <parameter>someValue</parameter>
          </constructor>
      </bean>

       

      <bean name="StringBean" class="java.lang.String">
          <constructor>
            <parameter>
              <value-factory bean="ValueBean" method="toCharArray"/>
            </parameter>
          </constructor>
      </bean>

       

       

      I am trying to create  String named StringBean that gets created using the toCharArray method of the ValueBean.  The toCharArray method returns a char[] with value "someValue".  When I start JBoss I get the following error.

       

      java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.lang.String] actual=[[C]
              at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
              at org.jboss.reflect.plugins.introspection.ReflectionUtils.newInstance(ReflectionUtils.java:153)
              at org.jboss.reflect.plugins.introspection.ReflectConstructorInfoImpl.newInstance(ReflectConstructorInfoImpl.java:106)
              at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:80)
              at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.createTarget(AOPConstructorJoinpoint.java:295)
              at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.dispatch(AOPConstructorJoinpoint.java:116)

              ...

       

      How do I properly handle a character array to initialize a string object in xml?  I am using version 2.0.9.GA shipped with JBoss EAP 5.0.1.