Id is required for elements when NOT used as a top-level tag
------------------------------------------------------------

                 Key: XBEAN-106
                 URL: https://issues.apache.org/jira/browse/XBEAN-106
             Project: XBean
          Issue Type: Bug
          Components: spring
    Affects Versions: 3.4
         Environment: xbean-spring-3.4.1
spring-*-2.5.4
            Reporter: Tuomas Kiviaho


I was using org.apache.xbean.spring.context.ClassPathXmlApplicationContext in 
my beanRefContext.xml and noticed weird behaviour with util:properties (and 
util:map)

<bean class="org.apache.activemq.spring.ActiveMQConnectionFactory">
        <property name="properties">
                <util:properties location="classpath:jndi.properties" />
        </property>
</bean>

Caused by: 
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
Configuration problem: Configuration problem: Id is required for element 
'properties' when used as a top-level tag
at 
org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
        at 
org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
        at 
org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:72)
        at 
org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:73)
        at 
org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
        at 
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1253)
        at 
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseNestedCustomElement(BeanDefinitionParserDelegate.java:1302)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.internalParseNestedCustomElement(XBeanBeanDefinitionParserDelegate.java:90)
        at 
org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parsePropertySubElement(XBeanBeanDefinitionParserDelegate.java:47)

When using org.springframework.context.support.ClassPathXmlApplicationContext 
or supplying and id this problem disappeared.

* * * IRRELEVANT FYI * * *

I couldn't get ActiveMQ XBean variant to accept properties at all. 

<amq:connectionFactory>
        <property name="properties">
                <util:properties id="foobar" 
location="classpath:jndi.properties" />
        </property>
</amq:connectionFactory>

It created PropertyValue named 'property' along with properties which naturally 
failed due to missing 'property' named property.

<amq:connectionFactory>
        <util:properties id="foobar" location="classpath:jndi.properties" />
</amq:connectionFactory>

It resolved correctly but property type coercion lead to ManagedMap instead of 
property file. Here I revered from using ActiveMQ XBean to format used above.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to