tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Gagnon <dgag...@siunik.com>
Subject Creating a context and deploying a new application on the fly. I tried but haven`t succeed please help :-)
Date Thu, 18 May 2006 21:34:02 GMT
Hi,

  I want my tomcat have war unpacked on the disk.  The application will 
only be deployed when it receives a message...

I tried with the following code without success.  My biggest problem for 
now is how to specify info for the jdbc connection. 

StandardContext context = new StandardContext();
            
context.setDocBase("F:\\projects\\applicationServer\\var\\deploy\\base");
            context.setPath("/as2");
            context.setCrossContext(true);
            context.setReloadable(false);

            ContextResource resource = new ContextResource();
            resource.setName("jdbc/reference");
            resource.setAuth("Container");
            resource.setType("javax.sql.DataSource");
            resource.setProperty("driverClassName", 
"org.postgresql.Driver");
            resource.setProperty("url", 
"jdbc:postgresql://127.0.0.1:5432/unikommerce");
            resource.setProperty("username", "admin");
            resource.setProperty("password", "admin");
            resource.setProperty("maxActive", "25");
            resource.setProperty("maxIdle", "10");
            resource.setProperty("maxWait", "-1");

            //context.getApplicationLifecycleListeners().get

//            resource.set;

/*
                    <Resource name="jdbc/unikommerce" auth="Container"
                              type="javax.sql.DataSource" 
driverClassName="org.postgresql.Driver"
                              
url="jdbc:postgresql://127.0.0.1:5432/unikommerce"
                              username="admin" password="admin" 
maxActive="25" maxIdle="10" maxWait="-1"/>

*/


            ContextConfig contextConfig = new ContextConfig();
            context.addLifecycleListener(contextConfig);

//            NamingContextListener l = new NamingContextListener();
//            l.addResource(resource);
//            contextConfig.setDefaultContextXml();

//            container.setManager();
            container.addChild(context);


So far the application get deployed but fail because the JDBC resource 
is not available. 

Any help on how to do this will be greatly appreciated !

Thanks
best regards
/David



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message