When I am starting my tomcat server in the logs i am getting this thing:- ContextConfig[/phoneDir]: Missing application web.xml, using defaults only And beacause of this I am getting servletConfig object as null & I cant get the values defined in web.xml file. In server.xml file I have done the following configuration <ContextManager> <Context path="/shoppingCart" docBase="C:\tomcat\webapps\shoppingCart" debug="9"/> </ContextManager>
I am able to open the link in shoppingCart folder.Do i need to make any other configuration??
Hi all thanks a lot for the reply, I understod what was the mistake I was doing. My context was shoppingCart folder in webapps, but in the logs it was showing as ContextConfig[/phoneDir]: Missing application web.xml, using defaults only that means it wasnt gettting web.xml file from phoneDir folder. When I chcked there was a folder phoneDir in which this file was missing.I think at the stratup tomcat checks for web.xml file for all the differnet contexts (or folders in webapps ). Actually im creating an application in which I have written one servlet class but im not able to initialize class.Thats why I checked the logs. But anyways my web.xml is being read but still my issue isnt solved. So my current problem is i have web.xml file:- <?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<!-- mysql (mm driver) --> <param-value>jdbcdbc:photodb</param-value>
<!-- Account name with which to connect to database. --> <init-param> <param-name>db.user</param-name> <param-value></param-value> </init-param>
<!-- Password with which to connect to database.--> <init-param> <param-name>db.password</param-name> <param-value></param-value> </init-param>
<!-- Base URL for PhotoDB. Default is "/photodb". --> <!-- <init-param> <param-name>context.path</param-name> <param-value>/photodb</param-value> </init-param> -->
<!-- Base URL to access image files. Default is the value of the context.path parameter followed by "/photos". --> <!-- <init-param> <param-name>image.path</param-name> <param-value>/photodb/photos</param-value> </init-param> -->
<!-- Directory containing image files. The servlet needs to be able to access the image files so that it can load their width and height. This directory must exist, otherwise PhotoServlet will not startup. The default is to call the servlet's getRealPath method on the string "/photos". --> <!-- <init-param> <param-name>image.directory</param-name> <param-value>/photodb/photos</param-value> </init-param> -->
<!-- Password with which to login to PhotoDB. --> <init-param> <param-name>login.password</param-name> <param-value>password</param-value> </init-param>
<!-- Comma-delimited list of servers on which login is allowed. If the list is empty then login on any server is allowed. This is a crude way to limit write-access via the PhotoDB application. Basically, I enter data into the database on my home machine, then I upload the data to my webhost's server. I never modify the database on my webhost's machine, so this is a one-way data path. --> <init-param> <param-name>login.servers</param-name> <param-value></param-value> </init-param> <!-- The servlet is loaded on startup so that it can setup the database connection. --> <load-on-startup>-1</load-on-startup>
</servlet> </web-app> So i hvae this servlet PhotoServlet in which i hvae written code for init & destroy method. In init method I have written the code for initialization of diff parameters. I think as far as I know my this servlet shud get initialized at the startup. But I have written some System.out.println() statements in init method but they arent getting displayed in console. Also when I run my jsp through which I am calling this servlet, I find it is not initialized. Can anyone help me out?? I hope im not making any silly mistake.