msanjose
02-08-2007, 04:14 PM
Hello,
Our application is having issues when creating objects from the context xml. Oddly, this only affects a particular small group of users.
We have several objects defined in an xml and are resolving constructor arguments by name. Everything works fine until we get to a constructor argument that requires conversion to Int32.
From looking at the spring source, this should use Int32Converter. It works for 99% of users. But as stated, a small group always get exceptions.
It looks like the XmlReader is parsing the xml fine. In the stack trace below, the "1" string is clearly loaded correctly and the source and target types are correct (System.String to System.Int32).
What can be causing the conversion to fail? We have tried experimenting with windows Regional and Language Options but that doesn't appear to be the cause. Also, it doesn't appear in the spring source that the type conversion is using CultureInfo.
We have also tried constructor argument resolution by type and by index with no success.
stacktrace fragment:
Unsatisfied dependency expressed through constructor argument with index 1 of type [System.Int32] : Could not convert constructor argument value [1] to required type [System.Int32] : Cannot convert property value of type [System.String] to required type [System.Int32] for property ''.
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition, ConstructorArgumentValues argumentValues)
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition)
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching)
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.CreateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Type requiredType, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name)
example xml fragment is below:
<object id="ObjectID" type="Namespace.Type, Assembly">
<constructor-arg name="name" value="nameString" />
<constructor-arg name="size" value="1" />
<constructor-arg name="command" value="text" />
...
</object>
Any ideas are appreciated.
Thanks,
Mike
Our application is having issues when creating objects from the context xml. Oddly, this only affects a particular small group of users.
We have several objects defined in an xml and are resolving constructor arguments by name. Everything works fine until we get to a constructor argument that requires conversion to Int32.
From looking at the spring source, this should use Int32Converter. It works for 99% of users. But as stated, a small group always get exceptions.
It looks like the XmlReader is parsing the xml fine. In the stack trace below, the "1" string is clearly loaded correctly and the source and target types are correct (System.String to System.Int32).
What can be causing the conversion to fail? We have tried experimenting with windows Regional and Language Options but that doesn't appear to be the cause. Also, it doesn't appear in the spring source that the type conversion is using CultureInfo.
We have also tried constructor argument resolution by type and by index with no success.
stacktrace fragment:
Unsatisfied dependency expressed through constructor argument with index 1 of type [System.Int32] : Could not convert constructor argument value [1] to required type [System.Int32] : Cannot convert property value of type [System.String] to required type [System.Int32] for property ''.
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition, ConstructorArgumentValues argumentValues)
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition)
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching)
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.CreateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Type requiredType, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name)
example xml fragment is below:
<object id="ObjectID" type="Namespace.Type, Assembly">
<constructor-arg name="name" value="nameString" />
<constructor-arg name="size" value="1" />
<constructor-arg name="command" value="text" />
...
</object>
Any ideas are appreciated.
Thanks,
Mike