[jboss-user] [JBoss Microcontainer] - How to handle character arrays in xml

Ben Schofield do-not-reply at jboss.com
Wed Jun 30 22:17:35 EDT 2010


Ben Schofield [http://community.jboss.org/people/dbschofield] created the discussion

"How to handle character arrays in xml"

To view the discussion, visit: http://community.jboss.org/message/550497#550497

--------------------------------------------------------------
<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.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/550497#550497]

Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100630/ae56acce/attachment.html 


More information about the jboss-user mailing list