The server.log reports that Spring appears to find the object in the JNDI tree, and that
it accesses it from the JNDI as a Remote DataSource. I have some code that is called on
application startup in a Servlet just to try and see what the DataSource looks like. The
code is:
| System.out.println( "Data Source: " + ctx.getBean( "dataSource" )
);
| DataSource ds = null;
| Connection c = null;
| try {
| ds = (DataSource)ctx.getBean( "dataSource" );
| System.out.println( "DataSource: " + ds );
| c = ds.getConnection();
| System.out.println( "Connection: " + c );
| } catch (SQLException e) {
| e.printStackTrace();
| } finally {
| if( c != null ) {
| try {
| c.close();
| } catch (SQLException e) {}
| }
| }
|
-----
log:
2006-11-03 14:00:22,939 DEBUG [org.springframework.jndi.JndiTemplate] Looking up JNDI
object with name [java:/mdc]
2006-11-03 14:00:23,064 DEBUG [org.springframework.jndi.JndiObjectFactoryBean] Located
object with JNDI name [java:/mdc]
....
2006-11-03 14:00:31,892 INFO [STDOUT] Data Source:
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy@7ae165
2006-11-03 14:00:31,892 INFO [STDOUT] DataSource:
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy@7ae165
2006-11-03 14:00:31,955 DEBUG [org.jboss.resource.connectionmanager.IdleRemover]
internalRegisterPool: registering pool with interval 900000 old interval: 450000
2006-11-03 14:00:31,955 DEBUG
[org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Created Connection proxy
for invoker=jboss:service=invoker,type=jrmp,
targetName=jboss.jca:service=DataSourceBinding,name=mdc, cacheID=14322087
2006-11-03 14:00:31,970 INFO [STDOUT] Connection: 14322087
2006-11-03 14:00:32,033 DEBUG
[org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Created Connection proxy
for invoker=jboss:service=invoker,type=jrmp,
targetName=jboss.jca:service=DataSourceBinding,name=mdc, cacheID=21168790
2006-11-03 14:00:32,095 DEBUG
[org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Created Statement proxy
for invoker=jboss:service=invoker,type=jrmp,
targetName=jboss.jca:service=DataSourceBinding,name=mdc, cacheID=13208327
2006-11-03 14:00:32,158 DEBUG
[org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Created ResultSet proxy
for invoker=jboss:service=invoker,type=jrmp,
targetName=jboss.jca:service=DataSourceBinding,name=mdc, cacheID=22616909
2006-11-03 14:00:32,361 DEBUG
[org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Closed
Statement=13208327
2006-11-03 14:00:33,252 DEBUG
[org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Created DatabaseMetadata
proxy for invoker=jboss:service=invoker,type=jrmp,
targetName=jboss.jca:service=DataSourceBinding,name=mdc, cacheID=188949142006-11-03
14:00:33,377 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] Initialized: {WebApplication:
/C:/opt/jboss-4.0.5.GA/server/mdc/tmp/deploy/tmp21642MLSDataChecker-exp.war/, URL:
file:/C:/opt/jboss-4.0.5.GA/server/mdc/tmp/deploy/tmp21642MLSDataChecker-exp.war/,
classLoader: java.net.FactoryURLClassLoader@1e3bfb6:31702966}
jboss.web:j2eeType=WebModule,name=//localhost/MLSDataChecker,J2EEApplication=none,J2EEServer=none
2006-11-03 14:00:33,377 DEBUG [org.jboss.web.WebModule] Started
jboss.web.deployment:war=MLSDataChecker.war,id=1278716270
2006-11-03 14:00:33,377 DEBUG [org.jboss.system.ServiceController] Starting dependent
components for: jboss.web.deployment:war=MLSDataChecker.war,id=1278716270 dependent
components: []
2006-11-03 14:00:33,392 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on
package: MLSDataChecker.war
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983123#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...