tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacek Laskowski <jlaskow...@apache.org>
Subject How to deploy a webapp using Embedded class
Date Sat, 04 Dec 2004 21:55:23 GMT
Hi,

While working on creating a Tomcat gbean (aka service) for Geronimo I 
found something I don't understand. I'm trying to deploy a webapp using 
the Embedded class. As described in the javadoc I created the 
appropriate components and deployed a webapp. However, Tomcat prints out 
the misterious error message: 'Error getConfigured' (see 
org/apache/catalina/core/StandardContext:4036) which I don't understand, 
thus I'm stuck.

Here's the class I'm developing. Does anyone know what I'm doing wrong?

package org.apache.geronimo.tomcat;

import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.core.StandardHost;
import org.apache.catalina.startup.Embedded;

public class EmbeddedTomcat {

     public static void main(String[] args) throws Exception {
         Embedded shell = new Embedded();
         shell.setUseNaming(false);

         Engine engine = shell.createEngine();
         engine.setName("Geronimo");

         Host host = shell.createHost("localhost", "");
         ((StandardHost) host).setWorkDir("target");

         engine.setDefaultHost(host.getName());
         host.setParent(engine);
         engine.addChild(host);

         Context defaultContext = shell.createContext("", "");
         host.addChild(defaultContext);

         shell.addEngine(engine);

         // It doesn't work
         // Connector connector = shell.createConnector((String) null, 
8080, "http");

         Connector connector = new Connector("HTTP/1.1");
         connector.setPort(8080);

         shell.addConnector(connector);
         shell.start();

         StandardContext ctx = new StandardContext();
         ctx.setDocBase("c:/projs/geronimo/war");

         ctx.setPath("/war");
         ctx.setParent(host);
         host.addChild(ctx);

         ctx.start();
     }
}

Jacek


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


Mime
View raw message