You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ryan LeCompte <ry...@pangonetworks.com> on 2005/07/11 18:10:49 UTC
Problem configuring context resource in embedded tomcat 5.5.9
Hello all,
I'm trying to manually configure a context resource using embedded Tomcat
5.5.9. I'm not sure if ordering is important in the code below, but perhaps
one of you could shed some light. I don't get any exceptions or anything,
but my webapp isn't able to find the resource. Here is the relevant code:
// --------------------- BEGIN LOAD CUSTOM WEBAPPS
--------------------
try {
// Configure JDBC data source.
ContextResource ctxResource = new ContextResource();
ctxResource.setName("jdbc/juddiDB");
ctxResource.setAuth("Container");
ctxResource.setType("javax.sql.DataSource");
ctxResource.setProperty("maxActive", "100");
ctxResource.setProperty("maxIdle", "30");
ctxResource.setProperty("maxWait", "10000");
ctxResource.setProperty("user", "user");
ctxResource.setProperty("password", "pass");
ctxResource.setProperty("driverClassName",
"org.firebirdsql.jdbc.FBDriver");
ctxResource.setProperty("url",
"jdbc:firebirdsql://localhost:3050/juddi?autoReconnect=true");
ctxResource.setProperty("validationQuery", "select count(*) from
PUBLISHER");
NamingResources namingResources = rootcontext.getNamingResources();
namingResources.addResource(ctxResource);
tomcat-user@jakarta.apache.org
// Load and configure the UDDI registry webapp.
Context ctx = this.embedded.createContext("/juddi", getPath() +
"/webapps/juddi");
ctx.setPrivileged(true);
this.host.addChild(ctx); // add context to host
ctx.getNamingResources().addResource(ctxResource);
} catch (Exception e) {
e.printStackTrace();
}
// --------------------- END LOAD CUSTOM WEBAPPS
-----------------------
All of the above code is executed after the root context is created and
initialized, and before the embedded tomcat engine is started. Any ideas?
Thanks!
Ryan