Hi,
I'm a newbie to web programming and I've just started in the
J2EE section of my
java course. The first program relates to deploying an html file using
servlet. While the following code worked at the course center, it does not do so when i tried the same at home.
Note: I've gone thru the other threads similar to this topic but could not find a satisfactory answer to the same and therefore starting a new
thread.
I'm using netbeans
IDE 6.0 to run the web application and the web server opted for, at the time of creation of project, is
tomcat 6.0.
Web application details:
---------------------------
Project/application name: myWebApp
Package name: com.niit(in Source Packages directory)
Source code file path: Source Packages > com.niit > FirstServlet.java
html file path: Web Pages > WEB-INF > index.html
My program code:
--------------------
The html file generated is as follows:
The web.xml shows the following:
In the deployment descriptor, the servlet-name & url-pattern (preceded by /) are the same and the servlet-class contains the appropriate "package-name.class-name".
On running the html file, the web application tab of output window of IDE gives successful status as follows. Firefox browser then opens with the page containing 404 error. I entered the url
http://localhost:8084/myWebApp/WEB-INF/index.html in IE but the page displays the same 404 status as shown on firefox.
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Incrementally deploying
http://localhost:8084/myWebApp
Completed incremental distribution of
http://localhost:8084/myWebApp
run-deploy:
Browsing:
http://localhost:8084/myWebApp/WEB-INF/index.html
run-display-browser:
run:
BUILD SUCCESSFUL (total time: 1 second)
while the server tab in the output window of IDE shows:
Using CATALINA_BASE: C:\Documents and Settings\Admin\.netbeans\6.0\apache-tomcat-6.0.14_base
Using CATALINA_HOME: C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14
Using CATALINA_TMPDIR: C:\Documents and Settings\Admin\.netbeans\6.0\apache-tomcat-6.0.14_base\temp
Using JRE_HOME: C:\Program Files\Java\jdk1.5.0_06
Jul 25, 2011 3:09:46 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_06\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\oracle\product\10.2.0\db_1\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Microsoft Shared\Windows Live
Jul 25, 2011 3:09:46 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
Jul 25, 2011 3:09:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1631 ms
Jul 25, 2011 3:09:46 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 25, 2011 3:09:46 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
Jul 25, 2011 3:09:48 PM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Documents and Settings\Admin\My Documents\NetBeansProjects\WebApp\build\web does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:141)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3944)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4113)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Jul 25, 2011 3:09:48 PM org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
Jul 25, 2011 3:09:48 PM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Jul 25, 2011 3:09:48 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/WebApp] startup failed due to previous errors
Jul 25, 2011 3:09:48 PM org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/WebApp] has not been started
Jul 25, 2011 3:09:48 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8084
Jul 25, 2011 3:09:48 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 25, 2011 3:09:48 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/109 config=null
Jul 25, 2011 3:09:48 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2234 ms
Jul 25, 2011 3:09:50 PM org.apache.catalina.core.StandardContext start
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myWebApp] has already been started
Does the above issue having anything to do with the jdk/jre (ver 1.5 on my computer) or windows network settings etc........
Would much appreciate answer(s) from the experts (if i've to go forward creating web apps).
thanks,
Sudhir