0

One of our apps declare some parameters in Tomcat's context.xml as such:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Parameter name="defaultSchema" override="true" value="demo"/>
    <Resource 
         auth="Container" 
         description="DB Connection for Local Jazzee" 
         driverClassName="oracle.jdbc.OracleDriver" 
         . . .
    />
</Context>

And then in Spring's applicationContext.xml we are able to use that parameter when we instantiate some beans:

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.default_schema">${defaultSchema}</prop>
            . . . 
</bean>

And that works fine.

Problem I'm having is that I'm trying to duplicate this in another application, and it's not working. When I try to start the app, I get the error:

Invalid bean definition with name 'sessionFactory' defined in class path resource [db/applicationContext.xml]: Could not resolve placeholder 'defaultSchema'

It's the same developer Tomcat instance in both cases, so the Tomcat version is the same. The Spring library versions appear to be the same as well. Also, if I hardcode the schema name in the application context, it works fine. So the dataSource is fine.

Any thoughts on what might be breaking this functionality?

Marvo
  • 17,845
  • 8
  • 50
  • 74
  • Can you show tomcat's context.xml definition? – Jorge Campos May 17 '16 at 23:19
  • I added more of the context.xml to the question. But it's mostly a resource and other Parameters. – Marvo May 17 '16 at 23:33
  • Which `Context.xml` is this in? The global one or the one shipped with your application in the `META-INF` directory? Also make sure that you have defined this property in your `web.xml` as a `resource-ref`. – M. Deinum May 18 '16 at 06:00
  • It's Tomcat's context.xml. In the app that works, we don't have any reference to the default schema parameter. – Marvo May 18 '16 at 19:15

0 Answers0