top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Tomcat: Getting 404 before the container starts all servlets

+3 votes
654 views

After upgrading Tomcat from 6.X to 7.X, our AJAX client receives 404 for 10-15 seconds right after startup. I presume the request is accepted and processed before all servlet are initialized, which is not what you
would expect.

Is this behavior normal for 7.X? Is there a way to configure 7.x to behave like 6.x?

posted Jan 10, 2014 by Tarun Singhal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
I tried with bindOnInit=false and bindOnInit=true, it makes no difference. I'm using tomcat 7.0.34, would this option be available in 7.0.34?
It should be. Note that the Tomcat you're using is over a year old, so you might want to consider upgrading, regardless. Lots of things fixed since then.
I tried with 7.0.47 and I still get 404 regardless of the the state of bindOnInit.

1 Answer

0 votes

Tomcat doesn't serve *any* requests until everything (including applications) has started up. bindOnInit only controls when it starts accepting connections.

You should only see any response (including 404s) once all the applications have reported that they have started.

From what you describe it appears that your application is continuing to do some initialisation after it has reported it is started.

Servlets do use lazy init by default but a request to a servlet should not complete until after the servlet has finished initialising.

All the indications are that the 404s you are seeing are a result of how your application is designed.

answer Jan 11, 2014 by Jai Prakash
Similar Questions
+2 votes

My webapp have a set of resources, let's call that set R. Some of those resources need to be accessed only from certain source IP addresses, let's call that subset R'. And some subset of R' (let's call it R'') needs authentication.

I have a requirement to check source IP address before authentication.

Right now, R' is specified in web.xml RemoteAddrFilter s, and R'' is specified in web.xml s.

The problem is, filters are executed after container-managed authentication, so login form is presented to the user before RemoteAddrFilter kicks in, and check source IP address. That is not what I need. Users outside trusted IP ranges should not be able to even know about the protected resources, let alone to guess passwords.

RemoteAddrValve, on the other hand, is called before container-managed authentication, but it does not allow specifying s.

What would be a good solution for the above requirement? Extend RemoteAddrValve with the ability to specify s?

+2 votes

In part of ongoing investigations, i am evaluating the methods to setup the server side component of simple web-services, where there is a simple transfer of data.

In this regard, I am considering the following two options ::

a) Apache AXIS + SOAP

b) Apache Tomcat + Servlets

Which, in general, has a lower memory footprint, and consumes lesser resources in general?

+2 votes

My tomcat web application stopped working after getting following error.

: Poller failed with error [610 038] : [APR does not understand this error code]

Could you please help with what could be root cause of this error.

+1 vote

I am running Tomcat 7.0.41 on a Windows laptop (8.1 Pro). I recently reinstalled the Windows and since re-installing tomcat and my server application, it runs fine when I connect to it from a web browser.

However, when I tell my desktop client app to connect to the server, it fails on the initial connection with a 405status. I am running the server is debug, from Eclipse, and have put breakpoints in the doGet, doPost, and doPut methods of my ControllerServlet class that extends the java.servlet.http.HttpServlet. None of these breakpoints fire before the client gets back the 405 status. (the client works fine if connecting to the real server running tomcat 6 on an Ubuntu server.)

I can find no place locally where verb filtering is being configured.

Any suggestions?

+1 vote

We are developing small video hosting application ,we are not writing any special program for open the video file and send to player , simply we are using tomcat DefaultServlet for above all video request , now we have to benchmark our application for following scenario

1) video size 100MB (1080i HD)
2) Total Network bandwidth 10Mbps (IN/OUT)

Now how to calculate how many max thread is allowed for above scenario ,with out interrupting users viewing experience, here each video response should secure 400kbps bandwidth for no interruption

So my question is how many concurrent users can view videos without interrupt then how to test this scenario ,and how tomcat is handling bandwidth sharing across the request

...