This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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: 62172
193
  • 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: 2257
289
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: 2257
289
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: 2257
289
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: 2257
289
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.
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!