tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nic Daniau" <nic.dan...@googlemail.com>
Subject Re: Tomcat embedded does not show ROOT context
Date Sun, 09 Apr 2006 19:13:46 GMT
> http://localhost:6969/manager/ also gives The requested resource (/) is
not available.

try http://localhost:6969/manager/html

On 09/04/06, Juergen Weber <weberjn@gmail.com> wrote:
>
> Hi everybody,
>
> I made a war from the Tomcat root and manager applications and startet
> them
> with the code below. The manager app works and it lists the Root
> applicatio=
> n
> as installed.
> But when I try to go to http://localhost:6969/
> there is only The requested resource (/) is not available.
>
> I added
>
>     <welcome-file-list>
>         <welcome-file>manager-howto.html</welcome-file>
>     </welcome-file-list>
>
> to managers web.xml, but
>
> http://localhost:6969/manager/
>
> also gives The requested resource (/) is not available.
>
> Any ideas what went wrong or what I did wrong?
>
> Thanks,
> J=FCrgen
>
>
>
> import java.io.File;
>
> import org.apache.catalina.Context;
> import org.apache.catalina.Engine;
> import org.apache.catalina.Host;
> import org.apache.catalina.LifecycleEvent;
> import org.apache.catalina.LifecycleListener;
> import org.apache.catalina.Realm;
> import org.apache.catalina.connector.Connector;
> import org.apache.catalina.realm.JNDIRealm;
> import org.apache.catalina.startup.Embedded;
>
> public class TomcatServer
> {
>
>
>     public static void main(String[] args) throws Exception
>     {
>         String hostname =3D "localhost";
>
>         int port =3D 6969;
>
>         System.out.println("Host: " + hostname + " Port: " + port);
>
>         System.out.println("Java: " + System.getProperty("java.vendor")
> + "
> "
>                 + System.getProperty("java.version"));
>
>         Embedded embeddedTomcat =3D new Embedded();
>
>         Engine engine =3D embeddedTomcat.createEngine();
>         engine.setDefaultHost("localhost");
>
>         Host host =3D embeddedTomcat.createHost("localhost", new
> File(".")
>                 .getAbsolutePath()
>                 + "/webapps");
>         engine.addChild(host);
>
>         Realm realm =3D createRealm();
>         engine.setRealm(realm);
>
>         File rootwar =3D new File(".", "/ROOT.war");
>         Context rootCtx =3D embeddedTomcat.createContext("/", rootwar
>                 .getAbsolutePath());
>         rootCtx.setPrivileged(true);
>         host.addChild(rootCtx);
>         System.out.println("ROOT.war added");
>
>
>         File mgrwar =3D new File(".", "/manager.war");
>         Context mgrCtx =3D embeddedTomcat.createContext("/manager",
> mgrwar
>                 .getAbsolutePath());
>         mgrCtx.setPrivileged(true);
>         host.addChild(mgrCtx);
>         System.out.println("manager warfile added");
>
>
>         embeddedTomcat.addEngine(engine);
>
>         Connector httpConnector =3D embeddedTomcat.createConnector(
>                 (java.net.InetAddress) null, port, false);
>
>
>         httpConnector.addLifecycleListener(new LifecycleListener()
>         {
>             public void lifecycleEvent(LifecycleEvent event)
>             {
>                 System.out.println("lifecycleEvent: " +
> event.getType());
>             };
>         });
>
>
>         embeddedTomcat.addConnector(httpConnector);
>
>         embeddedTomcat.start();
>     }
>
>     private static Realm createRealm()
>     {
>         JNDIRealm realm =3D new JNDIRealm();
>         realm.setConnectionURL("ldap://localhost:389");
>         realm.setUserPattern("uid=3D{0},ou=3Dpeople,dc=3Djwi,dc=3Dde");
>         realm.setRoleBase("ou=3Droles,dc=3Djwi,dc=3Dde");
>         realm.setRoleName("cn");
>         realm.setRoleSearch("(uniqueMember=3D{0})");
>
>         return realm;
>     }
>
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message