• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet gives 404 error

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 4489
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 4489
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I restarted my computer and it works now.
 
Ron McLeod
Marshal
Posts: 4489
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 4489
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic