Announcement Announcement Module
No announcement yet.
Strangeness with placeholder configurer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strangeness with placeholder configurer

    I have a property placeholder configurer where I load properties to (among other things) configure a jdbc connection pool.

    I also have a number of context xml files. For one reason or the other there seems to be one specific bean that causes the placeholder configurer to not work correctly (or load order or something get corrupt). When the specifc bean is commented out everything starts as it should (with the minor detail of the functionality represented by that bean doens't work).

    What can cause this?

    The errors below are the only ones visible in the log (the stack is longer however). If I hardcode the values in the connection pools it works (ie there doesn't seem to be anything wrong with the bean in question).


    Spring version: 1.2.4, JDK1.5

    Bean in question:
    <bean id="xyzMovieDataFetcher" name="movieDataFetcher"
    class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref bean="transactionManager"/>
    <property name="target">
    <ref bean="xyzMovieDataFetcherTarget"/>
    <property name="transactionAttributes">
    <prop key="fetch*">PROPAGATION_REQUIRED</prop>

    Partial Log (complete log in attached file, bean in question is defined in the last file loaded (seen in the complete log)):
    - SQL Error: 0, SQLState: null
    - Cannot load JDBC driver class '${jdbc.driverClassName}'
    - Could not obtain connection metadata
    org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '${jdbc.driverClassName}', cause:
    java.lang.ClassNotFoundException: ${jdbc.driverClassName}
    at$ Source)
    at Method)
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

  • #2
    I have the same problem...anybody knows why?

    I have the same problem...


    • #3
      I have to confess I've not seen this before. As you actually sure it works if you comment this bean out. I wondered if it only looks like it works. As the bean in question is a TransactionProxyFactoryBean, it will try and get a database connection and hence you will see the exception.

      As a test, you could actually tweek the PropertyPlaceholderConfigurer to thrown an exception in the property can't be found. This should help prove what the problem is.


      • #4
        I use the place holder configurer to load my db driver and it works fine.

        Could you maybe show the source of the definition transactionManager bean and the property placeholder configurer. The Transaction manager probably requires the db driver that is not being resolved properly. There's probably some issue with the way you're loading the properties.

        You could possibly do a test in that you could put a system out in a setter method of one of your beans with the parameter supplied to that method sourced as a property to check if the properties are being correctly read.


        • #5
          I guess it would also be useful to see the applicationContext and properties file you are working with. Makes it easier to spot a problem if you can replicate it.