Announcement Announcement Module
Collapse
No announcement yet.
ProperyPlaceholderConfigurer Errors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ProperyPlaceholderConfigurer Errors

    I've been getting errors like:

    [Servlet Error]-[context]: Failed to load servlet: org.springframework.beans.factory.BeanDefinitionSt oreException: Line 207 in XML document from resource [/WEB-INF/applicationContext.xml] of ServletContext is invalid; nested exception is org.xml.sax.SAXParseException: Attribute value "${jdbc.service.xaManager.beanName}" of type IDREF must be a name.
    org.xml.sax.SAXParseException: Attribute value "${jdbc.service.xaManager.beanName}" of type IDREF must be a name.
    at org.apache.xerces.parsers.DOMParser.parse(DOMParse r.java:235)
    If you see this, the answer is that your bean reference cannot be 'local'. So it should look like this:

    <bean id="baseTxProxy" lazy-init="true" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref bean="${jdbc.service.xaManager.beanName}"/>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    not this:

    <bean id="baseTxProxy" lazy-init="true"
    class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref local="${jdbc.service.xaManager.beanName}"/>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    Underscoring the recommended practice of not using local refs. :oops:

    HTH

  • #2
    Actually this is just the parser complaining about illegal characters in an attribute ('id') declared as an XML IDEREF type, which only allows some characters, but not others. In this case, the 'local' attribute is an IDREF, but 'bean' is note'.

    But it looks to me like you are trying to do this to use PropertyPlaceholderConfigurer in the bean referenence. That's not going to work. The configurer is only for property values.

    And the recommend practice _is_ to use local refs, if possible, since you will catch errors earlier that way...

    Comment


    • #3
      Colin,

      Actually I'm just using it as your petclinic and imagedb examples show:
      <property name="target">
      <ref bean="${petclinic.jdbcImplBeanName}" />
      </property>
      I just tried using a local ref rather than 'bean'. I normally live test my wiring with locals, but switch them to bean when I make the move to the production configuration - it just didn't work in this situation.

      In regard to the preference of local vs. bean references, somewhere on one of the forums it was stated ref bean is preferred as it allows for easier refactoring of configuration files.

      Regards,

      Comment

      Working...
      X