This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Servlet gives 404 error  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You. Adding that package fixed the PrintWriter problem.

When I run the servlet, it gives 404 error. Tomcat is up and running.

should I start a new topic for this ?

Thank you for supporting me. I will be in a better shape soon.

Servelet.png
[Thumbnail for Servelet.png]
 
Marshal
Posts: 63409
205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

basam nath wrote:. . . should I start a new topic for this ? . . .

Probably best to have a new thre‍ad.

And welcome to the Ranch
 
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

basam nath wrote:When I run the servlet, it gives 404 error. Tomcat is up and running.


Try checking the catalina log file to verify that your WAR was deployed.  You should see something like this:
 
Ron McLeod
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also - you should probably have your servlet produce some output so after you get past the 404 issue, there will be something displayed in your browser:
 
jasonsmith nath
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Catalina log has the follwoing information:

I made sure that Apache Tom cat service is not running in Services.msc

Dec 31, 2018 1:19:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT has finished in 59 ms
Dec 31, 2018 1:19:23 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1452 ms
Dec 31, 2018 1:19:23 PM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[localhost:8005]:
java.net.BindException: Address already in use: NET_Bind
at java.base/java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.base/java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.base/java.net.PlainSocketImpl.bind(Unknown Source)
at java.base/java.net.ServerSocket.bind(Unknown Source)
at java.base/java.net.ServerSocket.<init>(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:444)
at org.apache.catalina.startup.Catalina.await(Catalina.java:798)
at org.apache.catalina.startup.Catalina.start(Catalina.java:744)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)

Dec 31, 2018 1:19:23 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Dec 31, 2018 1:19:23 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Dec 31, 2018 1:19:23 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Dec 31, 2018 1:19:23 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
 
jasonsmith nath
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I restarted my computer and it works now.
 
Ron McLeod
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

basam nath wrote:Catalina log has the follwoing information: ...
java.net.BindException: Address already in use: NET_Bind


This is telling you that there is already something binding to the same port that Tomcat is wanting.

You can use the Windows netstat command to determine what is bound to port 8080.  For example:
 
Ron McLeod
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

basam nath wrote:I restarted my computer and it works now.


Great!  There must have been another instance of Tomcat running somehow.
 
Onion rings are vegetable donuts. Taste this tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!