Hi, I am trying to introduce spring into an older tomcat based web application in order to use CXF.
Question #1: I have to change the way the database is configured because META-INF/context.xml isn't supported. Is that right?
Question #2: If the answer to #1 is yes, can I change the configuration and still use all the old/straight jdbc code?
Ideally we would refactor all of the existing jdbc code to use at least SimpleJdbcTemplate or something better. But there is no time to do this before release.
Question #3, If the answer to #2 is yes, What would the equivalent configuration be?
The existing context.xml has the configuration for 2 database connections
<Resource name="jdbc/users" url="..." username="..." password="..." ... type="javax.sql.DataSource" />
<Resource name="jdbc/docs" url="..." username="..." password="..." ... type="javax.sql.DataSource" />
I *think* I want to add to the beans.xml class
<jee:jndi-lookup id="usersDataSource" jndi-name="jdbc/users" resource-ref="true" />
<jee:jndi-lookup id="docsDataSource" jndi-name="jdbc/docs" resource-ref="true" />
But are those the right id’s to use?
The old code uses
InitialContext ic = new InitialContext();
Context envContext = (Context) ic.lookup("java:/comp/env");
ds = (DataSource) envContext.lookup(dataSourceName);
where dataSourceName is “jdbc/users”
So would this need to change? I’m a bit confused because based on what I have, the id’s in the beans.xml aren’t used. Can that be right?
Any advice appreciated. I’m sure there are others who are having trouble with these same simple conversions.