Hey Ralph,

Use rootCtx.getNamingResources().addResource(rs).

Peter


Ralph Schaer schrieb:

Thanks for your answer. Now my last problem is how can I add the new
ContextResource (res) into the rootCtx. With Tomcat 5.0. this method
does the job: rootCtx.addResource(res);
But this method does not exists in Tomcat 5.5

Regards
Ralph

RM> On Sun, 31 Oct 2004 13:23:40 +0100, Ralph Schaer <[EMAIL PROTECTED]> wrote:


I have a small application with an embedded Tomcat 5.0.x. Now I try to
upgrade to Tomcat 5.5.x. The problem is that the API changed. My code
no longer compiles. Below the code for my Tomcat 5.0.x version. The
part with ContextResource and ResourceParams no longer work this way
in Tomcat 5.5.x. Does anybody knows what I have to change.

Regards
Ralph

     Embedded embeddedTomcat = new Embedded();
     Engine engine = embeddedTomcat.createEngine();

     Host host = embeddedTomcat.createHost("localhost", catalinaHome);
     engine.addChild(host);

     StandardContext rootCtx =
(StandardContext)embeddedTomcat.createContext(context,
warFile.getPath());
     rootCtx.setWorkDir(workDir);

     ContextResource res = new ContextResource();
     res.setName("jdbc/" + dataSourceName);
     res.setType("javax.sql.DataSource");
     res.setAuth("Container");
     rootCtx.addResource(res);

ResourceParams params = new ResourceParams();
params.setName("jdbc/" + dataSourceName);
params.addParameter("factory",
"org.apache.commons.dbcp.BasicDataSourceFactory");



RM> params.addParameter -> res.setProperty. So ResourceParams is no longer RM> needed, which should make your code smaller. RM> Also be careful that the factory name for DBCP changes (Tomcat, like RM> Java 5, does package renaming to avoid problems). So you'd better RM> leave it blank.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to