aspose file tools*
The moose likes Tomcat and the fly likes Java application(tomcat server) cannot serve concurrent requests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Java application(tomcat server) cannot serve concurrent requests" Watch "Java application(tomcat server) cannot serve concurrent requests" New topic
Author

Java application(tomcat server) cannot serve concurrent requests

Aniruddha Ghosh
Greenhorn

Joined: Sep 03, 2013
Posts: 7
Hello All,

I am very confused with the issue i am getting from an application. The application written in java, hosting server is tomcat5 with 16 gb of RAM. There is a module where one excel report gets generated when you click on a jsp button. But most of the time when you try to generate that report, it gives 'failed to connect to database ' error while you try to do other things in other module in the application. The application is not explicitly written in thread. The application is written in a framework almost like struts. It is a simple javaEE application using only jsp,servlets. If you can help me on where to look for my problem or can give any solution, that will be very much helpful. thank you in advance
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Welcome to the Ranch.
Check out the stack trace. It will contain information about the class and line number which gave rise to the exception. That would be a good point to start your investigation.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

We can't really tell anything without more details, but if you are using Microsoft Access or FoxPro as your backend database, be aware that those products are not designed for multi-user environments. You need a full-blown DBMS server for that.


Customer surveys are for companies who didn't pay proper attention to begin with.
Aniruddha Ghosh
Greenhorn

Joined: Sep 03, 2013
Posts: 7
First of all, thank you for looking into my issue. I couldn't trace the stack trace because currently i haven't had the issue. What i got at the time i faced the issue is --java.lang.Exception: Failed to connect to database //. Normally it runs as expected while different users browse different module in the application. But the issue occurred when they tried to execute that report and doing another work in different module. Though the report generation is very easy in the application.The request goes to a servlet from a jsp, then to a model object, fetch the data from database, create an excel and shows the report. My application uses struts like framework and the back end database is oracle. please let me know if you want any more details. i really need help. thank you.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Without the stack trace nobody can possibly figure out what the problem is.
Maybe you can wait for it to fail, post your stack trace here and we can try and figure out.


I just realized something. Dont you have logging enabled for your tomcat? The stack trace should be in the logs then.
Aniruddha Ghosh
Greenhorn

Joined: Sep 03, 2013
Posts: 7
First of all thank you for looking into my issue. But I need to know what could be the possibilities for that issue. I cannot trace stack trace because currently i haven't got the issue.When i got the issue, the error was..java.lang.Exception: Failed to connect to database . Normally the issue occurs when user tries to run a particular report and also another user try to do some work in another module. I need to know why it can happen. my application is written in java, almost struts like framework. The report generation is also easy. The request goes to a servlet from a jsp, then to a model object which fetch data from database and then create an excel, shows the report. Back end database is Oracle 11i. Tomcat version is 5. Please let me know if you need anymore info. You can tell me where i need to look into. Thanks in advance.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

You are just repeating what you posted earlier.
If logging is enabled, the stack trace will be in the log files. Do you know how to locate the log files? If not please ask someone in your establishment. We cannot tell you how they are configured.
Aniruddha Ghosh
Greenhorn

Joined: Sep 03, 2013
Posts: 7
Yes Maneesh,I know where is the log file. But issue faced sometimes ago. Still.. let me check. thank you
Aniruddha Ghosh
Greenhorn

Joined: Sep 03, 2013
Posts: 7
Hello Maneesh, Sorry but i couldn't found the error in log file. Actually in this type of error, it is written in the java application to catch the exception and show it in a generic way onto the web application page. That is why i only got the error...java.lang.Exception: Failed to connect to database. The error is very clear, but i do understand that my given information may not be sufficient. If ,in anyway, you can tell me what can be generally the issue in this case or may be where i should look into.. that too would be very helpful. Thank you
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Aniruddha Ghosh wrote:Actually in this type of error, it is written in the java application to catch the exception and show it in a generic way onto the web application page.

It should also be logged. Otherwise you have no way of diagnosing errors.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2596
    
    9

Are you using a connection pool for your database? What's the max pool size? How many connections can the database take?

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Aniruddha Ghosh wrote: Actually in this type of error, it is written in the java application to catch the exception and show it in a generic way onto the web application page. That is why i only got the error...java.lang.Exception: Failed to connect to database.

This is wrong on so many fronts
1) Never ever expose any "tech" language to the end user. Always display some message in lay man terms. Thats better usability
2) Not logging the exceptions? Seriously? What is there in the log files then? Exceptions are something which have to be logged. Else...well you already know what happens when you dont.

I would recommend
1) Activating proper logging
2) Wait for the same error
3) Once you have found out from the exception, what the root cause is, you can proceed to fixing it. K. Tsang has already provided you with pointers. But like Bear said, until you diagnose, you cannot remedy
Aniruddha Ghosh
Greenhorn

Joined: Sep 03, 2013
Posts: 7
Hello Tsang, I don't know if i am using connection pool for database.Can you please give me some idea or some link or something like that so that i can know about database connection pooling. And my application is using JNDI for database connectivity. Sorry for being naive.

And Maneesh i have checked application log and access log for my application, but there is no exception reported. probably there is no exception occurred ever, but the problem may be in concurrent user handling, database or application connection time out or something like that. Can you please help me? or please tell me if any more info you require. Thank you very much.
Aniruddha Ghosh
Greenhorn

Joined: Sep 03, 2013
Posts: 7
Hello All,

the problem has been solved by taking care of the tomcat configuration. I have to change heap size and generation size in tomcat config file for my application.

Thank you all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java application(tomcat server) cannot serve concurrent requests