Announcement Announcement Module
Collapse
No announcement yet.
Strangeness with placeholder configurer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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).

    /Marcus

    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>
    <property name="target">
    <ref bean="xyzMovieDataFetcherTarget"/>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="fetch*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    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 java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown 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...

    Comment


    • #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.
      http://www.springframework.org/docs/...lders(boolean)

      Comment


      • #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.

        Comment


        • #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.

          Comment

          Working...
          X