JBoss Community

Bean for Hashtable choses wrong ctor

created by arjan tijms in JBoss Microcontainer - View the full discussion

On JBoss AS 6, I'm trying to instantiate a bean that's a Hashtable:

 

<bean name="JNDI" class="java.util.Hashtable">
        <constructor class="java.util.Map">        
            <parameter>
                <map class="java.util.HashMap" keyClass="java.lang.String" valueClass="java.lang.String">
                    <entry>

 

The problem is that the container keeps selecting the wrong constructor, even though the right one is specified:

 

Part of the exception that I get:

 

ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Instantiated: name=JNDI state=Described: java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[int] actual=[java.util.Hashtable]
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:404) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.newInstance(ReflectionUtils.java:158) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.reflect.plugins.introspection.ReflectConstructorInfoImpl.newInstance(ReflectConstructorInfoImpl.java:102) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:81) [jboss-reflect.jar:2.2.0.GA]
    at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.dispatch(AOPConstructorJoinpoint.java:109) [jboss-aop-mc-int.jar:2.2.0.GA]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) [jboss-kernel.jar:2.2.0.GA]
    at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-kernel.jar:2.2.0.GA]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) [jboss-kernel.jar:2.2.0.GA]
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) [jboss-kernel.jar:2.2.0.GA]
    at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:67) [jboss-kernel.jar:2.2.0.GA]
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]

 

Is there a way to enforce more strictly that I want the java.util.Map contructor and not the int one?

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community