| Author |
Missing application web.xml, using defaults only
|
venkatesh pendharkar
Ranch Hand
Joined: Apr 29, 2006
Posts: 104
|
|
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??
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12928
|
|
|
Where is your web.xml? If this is your setup (in server.xml), it should be in the directory C:\tomcat\webapps\shoppingCart\WEB-INF
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
venkatesh pendharkar
Ranch Hand
Joined: Apr 29, 2006
Posts: 104
|
|
|
yes, it is in WEB-INF direcotry
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Can you post your web.xml file?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
venkatesh pendharkar
Ranch Hand
Joined: Apr 29, 2006
Posts: 104
|
|
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"> <!-- Sample configuration file for using PhotoDB with the Tomcat JSP container. Tomcat is available from http://jakarta.apache.org. --> <web-app> <display-name>PhotoDB</display-name> <description> Application to view and maintain a database of photographs. </description> <!-- Filter to support file upload. See "Filter code with Servlet 2.3 model" http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters_p.html. --> <filter> <filter-name>MultipartFilter</filter-name> <filter-class>com.oreilly.servlet.MultipartFilter</filter-class> </filter> <!-- Filter mappings. --> <filter-mapping> <filter-name>MultipartFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- PhotoServlet is used to initialize access to the database and to keep track of shared initialization parameters. --> <servlet> <!-- Name of servlet. --> <servlet-name>PhotoServlet</servlet-name> <!-- Class that implements servlet. --> <servlet-class>com.magiccookie.photodb.PhotoServlet</servlet-class> <!-- JDBC driver class (required). Change this to your database's JDBC driver. Examples are shown for PostgreSQL and MySQL using different JDBC drivers. --> <init-param> <param-name>db.driver</param-name> <!-- postgresql --> <!-- <param-value>postgresql.Driver</param-value> --> <!-- mysql (mm driver) --> <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value> </init-param> <!-- JDBC URL (required). Value depends on the JDBC driver. Examples are shown for PostgreSQL and MySQL using different JDBC drivers. --> <init-param> <param-name>db.url</param-name> <!-- postgresql --> <!-- <param-value>jdbc:postgresql:photodb</param-value> --> <!-- mysql (mm driver) --> <param-value>jdbc dbc:photodb</param-value> </init-param> <!-- 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.
|
 |
 |
|
|
subject: Missing application web.xml, using defaults only
|
|
|