FAQ
I was trying to embed Tomcat in my application only to discover that
Embedded.createContext relies on ProxyDirContext from
org.apache.naming.resources. I can't seem to find the jar that contains this
class, though I can find references to JavaDocs for it. I'm running Tomcat
4.1 and am a little confused. Any help here would be appreciated. :)

Here is the stack trace:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/naming/resources/ProxyDirContext
at org.apache.catalina.startup.Embedded.createContext(Embedded.java:588)
at com.look.core.EmbeddedTomcat.startTomcat(EmbeddedTomcat.java:58)
at com.look.core.Main.main(Main.java:24)

And the class is a modified version of an example from an OnJava article, and
is included here.

import org.apache.catalina.*;
import org.apache.catalina.logger.*;
import org.apache.catalina.startup.*;


/**
* @author etriaph
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class EmbeddedTomcat
{
private String m_path = null;
private Embedded m_embedded = null;
private Host m_host = null;

public EmbeddedTomcat()
{

}

public EmbeddedTomcat(String path)
{
setPath(path);
}

public void setPath(String path)
{
m_path = path;
}

public void startTomcat() throws Exception
{
Engine engine = null;

System.setProperty("catalina.path", getPath());

m_embedded = new Embedded();

m_embedded.setDebug(0);
m_embedded.setLogger(new SystemOutLogger());

engine = m_embedded.createEngine();
engine.setDefaultHost("localhost");

m_host = m_embedded.createHost("localhost", getPath() + "/webapps");
engine.addChild(m_host);

Context context = m_embedded.createContext("", getPath() + "/webapps/ROOT");
m_host.addChild(context);

m_embedded.addEngine(engine);

Connector connector = m_embedded.createConnector(null, 8080, false);
m_embedded.addConnector(connector);

m_embedded.start();
}

public String getPath()
{
return( m_path );
}

public void stopTomcat() throws Exception
{
m_embedded.stop();
}
}

Again, I would love to get an opinion on this, or perhaps a URL to a jar that
contains the classes needed.

Thanks in advance!

--
Robert Charbonneau
tomcat-user@kdesktop.org
--


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

Search Discussions

  • Robert Charbonneau at Oct 24, 2003 at 8:30 am
    Ok, nevermind that I found the jar I was looking for.

    Ran into another problem though when running the application:

    Starting Tomcat
    Apache Tomcat/4.1.27
    Exception in thread "main" java.lang.NoClassDefFoundError:
    org/apache/catalina/loader/Reloader
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3484)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:994)
    at com.look.core.EmbeddedTomcat.startTomcat(EmbeddedTomcat.java:67)
    at com.look.core.Main.main(Main.java:24)

    While browsing the catalina.jar file for Tomcat 4.1.27 I couldn't find the
    class either. Is something fish going on here? Can anyone help?

    Thanks

    On October 24, 2003 04:10 am, Robert Charbonneau wrote:
    <snip>

    --
    Robert Charbonneau
    tomcat-user@kdesktop.org
    --


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
  • Borrajo Iniesta, Javier at Oct 24, 2003 at 11:07 am
    I tried to build Tomcat 4.1.27 from the source ZIP but it was not possible
    because several source folders are missing from the ZIP, in my case
    org.apache.tomcat was missing

    If anybody knows how to get a COMPLETE Tomcat 4.1 source distribution
    please let me know

    Saludos

    Javier

    -----Mensaje original-----
    De: Robert Charbonneau [SMTP:tomcat-user@kdesktop.org]
    Enviado el: viernes 24 de octubre de 2003 10:11
    Para: Tomcat Users Mailing List
    Asunto: org.apache.naming

    I was trying to embed Tomcat in my application only to discover that
    Embedded.createContext relies on ProxyDirContext from
    org.apache.naming.resources. I can't seem to find the jar that contains
    this
    class, though I can find references to JavaDocs for it. I'm running
    Tomcat
    4.1 and am a little confused. Any help here would be appreciated. :)

    Here is the stack trace:

    Exception in thread "main" java.lang.NoClassDefFoundError:
    org/apache/naming/resources/ProxyDirContext
    at
    org.apache.catalina.startup.Embedded.createContext(Embedded.java:588)
    at com.look.core.EmbeddedTomcat.startTomcat(EmbeddedTomcat.java:58)
    at com.look.core.Main.main(Main.java:24)

    And the class is a modified version of an example from an OnJava article,
    and
    is included here.

    import org.apache.catalina.*;
    import org.apache.catalina.logger.*;
    import org.apache.catalina.startup.*;


    /**
    * @author etriaph
    *
    * To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Generation - Code and Comments
    */
    public class EmbeddedTomcat
    {
    private String m_path = null;
    private Embedded m_embedded = null;
    private Host m_host = null;

    public EmbeddedTomcat()
    {

    }

    public EmbeddedTomcat(String path)
    {
    setPath(path);
    }

    public void setPath(String path)
    {
    m_path = path;
    }

    public void startTomcat() throws Exception
    {
    Engine engine = null;

    System.setProperty("catalina.path", getPath());

    m_embedded = new Embedded();

    m_embedded.setDebug(0);
    m_embedded.setLogger(new SystemOutLogger());

    engine = m_embedded.createEngine();
    engine.setDefaultHost("localhost");

    m_host = m_embedded.createHost("localhost", getPath() +
    "/webapps");
    engine.addChild(m_host);

    Context context = m_embedded.createContext("", getPath() +
    "/webapps/ROOT");
    m_host.addChild(context);

    m_embedded.addEngine(engine);

    Connector connector = m_embedded.createConnector(null, 8080,
    false);
    m_embedded.addConnector(connector);

    m_embedded.start();
    }

    public String getPath()
    {
    return( m_path );
    }

    public void stopTomcat() throws Exception
    {
    m_embedded.stop();
    }
    }

    Again, I would love to get an opinion on this, or perhaps a URL to a jar
    that
    contains the classes needed.

    Thanks in advance!

    --
    Robert Charbonneau
    tomcat-user@kdesktop.org
    --


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
  • Shapira, Yoav at Oct 24, 2003 at 1:28 pm
    Howdy,
    org.apache.catalina.loader.Reloader is in the bootstrap.jar,
    $CATALINA_HOME/bin by default.

    Yoav Shapira
    Millennium ChemInformatics

    -----Original Message-----
    From: Robert Charbonneau
    Sent: Friday, October 24, 2003 4:29 AM
    To: Tomcat Users List
    Subject: Re: org.apache.naming

    Ok, nevermind that I found the jar I was looking for.

    Ran into another problem though when running the application:

    Starting Tomcat
    Apache Tomcat/4.1.27
    Exception in thread "main" java.lang.NoClassDefFoundError:
    org/apache/catalina/loader/Reloader
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at
    java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at
    org.apache.catalina.core.StandardContext.start(StandardContext.java:348 4)
    at
    org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
    at
    org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
    at
    org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
    at
    org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:994)
    at
    com.look.core.EmbeddedTomcat.startTomcat(EmbeddedTomcat.java:67)
    at com.look.core.Main.main(Main.java:24)

    While browsing the catalina.jar file for Tomcat 4.1.27 I couldn't find the
    class either. Is something fish going on here? Can anyone help?

    Thanks

    On October 24, 2003 04:10 am, Robert Charbonneau wrote:
    <snip>

    --
    Robert Charbonneau
    tomcat-user@kdesktop.org
    --


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



    This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriestomcat
postedOct 24, '03 at 8:11a
activeOct 24, '03 at 1:28p
posts4
users3
websitetomcat.apache.org
irc#tomcat

People

Translate

site design / logo © 2021 Grokbase