[jboss-user] [JBoss Seam] - Tomcat deployment with external datasource - is it possible?
ASavitsky
do-not-reply at jboss.com
Tue Mar 20 10:20:00 EDT 2007
I'm currently trying to adopt the Seam JPA example to our Tomcat deployment guidelines, and I'm facing a problem here...
The example uses a DataSource that is supplied by the Microcontainer, in jboss-beans.xml:
<bean name="bookingDatasourceFactory"
| class="org.jboss.seam.microcontainer.DataSourceFactory">
| <property name="driverClass">org.hsqldb.jdbcDriver</property>
| <property name="connectionUrl">jdbc:hsqldb:.</property>
| <property name="userName">sa</property>
| <property name="jndiName">java:/DefaultDS</property>
| <property name="minSize">0</property>
| <property name="maxSize">10</property>
| <property name="blockingTimeout">1000</property>
| <property name="idleTimeout">100000</property>
| <property name="transactionManager">
| <inject bean="TransactionManager" />
| </property>
| </bean>
| <bean name="bookingDatasource" class="java.lang.Object">
| <constructor factoryMethod="getDataSource">
| <factory bean="bookingDatasourceFactory" />
| </constructor>
| </bean>
|
My question is: is it possible to somehow use the DataSource that is configured in Tomcat, as in
<?xml version="1.0" encoding="UTF-8"?>
| <Context>
| <Resource name="jdbc/DataSource" auth="Container"
| type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="username" password="password" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc url" />
| </Context>
|
The idea is to be able to create data sources outside the deployed WAR, so that the same WAR could be deployed to different environments without any changes - this is a common requirement for production-level Tomcat applications.
When I try to remove the data source definition from jboss-beans.xml, it gives me the "name not bound" exception (naturally), and I suspect that it only uses the Microcontainer's JNDI, ignoring the Tomcat-supplied one.
Is such setup supported at all? Is there any way to configure the data source outside the WAR, while using Seam/Microcontainer/JPA stack?
Thanks,
Alex
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029798#4029798
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029798
More information about the jboss-user
mailing list