aspose file tools*
The moose likes Servlets and the fly likes Problems calling servlet at startup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problems calling servlet at startup" Watch "Problems calling servlet at startup" New topic
Author

Problems calling servlet at startup

Dave Mere
Ranch Hand

Joined: Oct 25, 2004
Posts: 37
Hi there,

I'm setting up an embedded database with my struts app, which works by creating a local database copy on startup. To do this, I need to place the relevant code in a servlet that is called on tomcat start-up, but I'm having problems calling this file.

I've set the servlet-classs in my web.xml like this:


I thought that this entry was sufficient but obviously not. Can anyone spot what I might be doing wrong?

Many thanks in advance!

Dave
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Where did you put the class file.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Dave Mere
Ranch Hand

Joined: Oct 25, 2004
Posts: 37
Hi Ben,

It compiles to
classes/org/kew/alpine/datalayer.

My build.xml file then copies this to
WEB-INF/classes/org/kew/alpine/datalayer which is where tomcat reads it from. I have a number of other class files in there which run as I expect them to. The init file just doesn't seem to be running on startup.

thanks

Dave
Dave Mere
Ranch Hand

Joined: Oct 25, 2004
Posts: 37
Wait, I got it.

My class was called DatalayerServlet

My web.xml was declaring DataLayerServlet

Only took me an hour to spot that. :roll:


Thanks for looking at this Ben!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Glad it's working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems calling servlet at startup