Hi there.

I am trying to start an embedded tomcat instance, but I would like to supply it 
with a servlet to run, and supply no config files and directories etc.

I am following the example at 
http://www.onjava.com/pub/a/onjava/2002/04/03/tomcat.html, and the mail: 
http://nagoya.apache.org/eyebrowse/ReadMsg?listId=88&msgNo=151808

So far, I can't get it to work - any help/pointers (or documentation) would be 
appreciated.

The code (and the exception right at the bottom):

//------------------------------
System.setProperty("catalina.home", "/var/lib/tomcat4");

embedded = new Embedded();
embedded.setDebug(5);
embedded.setLogger(new SystemOutLogger());

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

host = new StandardHost();
host.setName("localhost");
engine.addChild(host);

//Here's where I try to create the context with my servlet:
context = new StandardContext();
wrapper = context.createWrapper();
wrapper.setName("wrapper");
wrapper.setServletClass(MyServlet.class.getName());
context.addChild(wrapper);
context.setName("context");
context.addServletMapping("/", wrapper.getName());
host.addChild(context);
        
embedded.addEngine(engine);
connector = embedded.createConnector(null, 8080, false);
embedded.addConnector(connector);        
//------------------------------

now, as soon as I do an embedded.start(), I get:

StandardContext[context]: Resources start failed:
java.lang.NullPointerException
        at java.io.File.<init>(File.java:180)
        at 
org.apache.catalina.core.StandardContext.getBasePath(StandardContext.java:3907)
        at 
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3349)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3479)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
        at org.apache.catalina.startup.Embedded.start(Embedded.java:994)




Powered by Tiscali - http://www.tiscali.co.za



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

Reply via email to