----- Original Message ----- From: "Jacek Laskowski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 2004 1:55 PM
Subject: How to deploy a webapp using Embedded class



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?


The short answer is that you don't have a ContextConfig for your Context.

Assuming that you really don't want to use JMX-embedding, you should be using Embedded.createContext instead of attempting to create it yourself.

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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





This message is intended only for the use of the person(s) listed above as the intended recipient(s), and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not an intended recipient, you may not read, copy, or distribute this message or any attachment. If you received this communication in error, please notify us immediately by e-mail and then delete all copies of this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


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

Reply via email to