Ajay
Ajay

Reputation: 13

Facing error while running my Servlet application on apache tomcat 7

“I have defined welcome file list in servlet program. still my application is not loading the same at the time of startup.what can be the reason? Note that i have put that html file inside web inf folder.”

I have rebuilt and redeploy my application. still it doesn't working.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  </welcome-file-list>
  <display-name>VoterApp</display-name>
  <servlet>
      <servlet-name>wert</servlet-name>
      <servlet-class>VoterServ</servlet-class>
  </servlet>
  <servlet-mapping>
      <servlet-name>wert</servlet-name>
      <url-pattern>/voterSite</url-pattern>
  </servlet-mapping>
</web-app>

It should load index.html on startup when i run my web application VoterApp but i am getting resource not available error.

Upvotes: 0

Views: 78

Answers (1)

Francesco Alongi
Francesco Alongi

Reputation: 521

Just try to move your index.html file outside of the WEB-INF folder, in the root directory.

rootFolder
 |-- WEB-INF
 |    `-- web.xml
 `-- index.html

It should work.

Upvotes: 1

Related Questions