Tomcat 6.0.29
sun java 1.6.0_20
Ubuntu 10.04 64 bit
Seems like this should be simple, but can't get it to work. I'm trying
to run a simple embedded Tomcat inside my program. Code for starting
the Tomcat is below. It seems to start OK, based on logging messages,
but whenever I try to access a page
(http://localhost:8000/TestWeb1/index.jsp) using it, I get the standard
Tomcat 404 error page with the message "The requested resource () is not
available.". The page shows up fine in a normal, standalone Tomcat.
Any help is appreciated. Been working at this for a while now.
The web app I'm trying to run is the very basic one that is generated by
NetBeans using the Web Application project. The files in
/home/mclaborn/projects/NetBeans/MMServer/TestWeb1/build are
web
index.jsp
META-INF
context.xml
MANIFEST.MF
WEB-INF
classes
web.xml
The context.xml contains
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/TestWeb1"/>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Code that starts the embedded Tomcat:
Embedded tomcat = new Embedded();
tomcat.setName("Catalina");
Engine engine = tomcat.createEngine();
engine.setName("Catalina");
Host host = tomcat.createHost("localhost",
"/home/mclaborn/projects/NetBeans/MMServer/TestWeb1/build");
engine.addChild(host);
engine.setDefaultHost(host.getName());
Context context = tomcat.createContext("/TestWeb1",
"/home/mclaborn/projects/NetBeans/MMServer/TestWeb1/build/web");
host.addChild(context);
tomcat.addEngine(engine);
Connector l_connector = tomcat.createConnector("0.0.0.0", 8000, false);
tomcat.addConnector(l_connector);
tomcat.start();
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org