data source is null
edross15057 Jun 6, 2006 3:57 PMI'm trying to configure a datasource for jboss and the tomcat web container.
My problem is I'm allways getting a null when I do a ctx.lookup.
I've added a postgres-ds.xml in the deploy directory
I've added a jboss-web.xml in webapp/WEB-INF
I've added a reference in the web.xml
I've added a context.xml in the WEB_INF/META-INF
I've copied the driver jar to about every directory in the world
I've read about everything I can think of and still get a null datasource in a sample startup app.
code snip
public void init() {
try{
Context ctx = new InitialContext();
if (ctx == null)
throw new Exception("Opps - No Context");
System.out.println("CTX Name in space "+ctx.getNameInNamespace());
Object obj = ctx.lookup("java:/jdbc/GiftDevel");
Context context = (Context)ctx.lookup("java:");
DataSource ds = (DataSource) context.lookup("java:/jdbc/GiftDevel");
if(ds != null){
System.out.println(" ds is not null ");
}
I don't get lookup errors - just nulls.
The logs all state the daasource is bound to java:jdbc/GifgDevel
setting property: ConnectionURL to value jdbc:postgresql://localhost:5432
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] set property ConnectionURL to value jdbc:postgresql://localhost:5432
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] setting property: DriverClass to value org.postgresql.Driver
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] set property DriverClass to value org.postgresql.Driver
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] setting property: UserName to value edross
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] set property UserName to value edross
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] setting property: Password to value xxxx
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] set property Password to value xxxxx
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Not setting config property 'TrackStatements'
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] setting property: ConnectionProperties to value DatabaseName=gift
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] set property ConnectionProperties to value DatabaseName=gift
2006-06-06 15:45:09,234 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Started jboss.jca:service=ManagedConnectionFactory,name=jdbc/GiftDevel
2006-06-06 15:45:09,234 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.jca:service=ManagedConnectionFactory,name=jdbc/GiftDevel dependent components: [ObjectName: jboss.jca:service=ManagedConnectionPool,name=jdbc/GiftDevel
Everything seems to work but my application.
I've tried about a billion different configurations, and all are the same
Jboss 4.0.3SP1
Anyone??
thx