problems with hosting java app on tomcat in linux cpanel environment
we've build a java web app based on struts and started off hosting it with a hostingcompany. This company uses a cPanel environment which includes a tomcat server. They've installed all and it works, but it's very buggy. Sometimes it works great at other times it's a big mess.
Recently we've discovered that when starting the tomcat server at a certain point it starts looking for the META-INF/MANIFEST.MF file in the public_html/name_of_webapp folder. However this folder doesn't exist. So therefore load on the server get exceedingly high. So we don't know why it points to this folder for looking for the application files.
We worked around this by creating an exact copy of the tomcat/webapps/name_of_webapp folder and putting it in the public_html folder. This is a workaround and although it works for the moment it's not satisfactory.
Another thing is when i approach the application through www . aplliaction_name . nl it seems that there is some sort of time out within the session. I place an object in the session, once i reach the action i take the object from the session but it's not there -> nullpointerexception. BUT when i approach the application without www so like application_name . nl it works and there are no problems.
At some points it seems that a first request on the database results in an error and the second time working fine. Could this be some sort of time out in updating the session?
Does anyone know how to solve these issues or at least give me a hint where to look for the problem?
I hate to write this response. I love tomcat and it is one of the best things that ever happend to java web applications. If your application has high server loads your hosting experience will continue to get worse. We migrated to a load balanced cluster for the application server and still had strange responses. Eventually we gave up and installed Jboss. Everything seems to run fine now on a single server and we have not had any issues to date.
That's the problem with running Tomcat and JSP servlets, they do tend to be high on the resource usage side. You really do need to have a high end server with lots of RAM and CPU available. I'm running it on Dual Xeons with 2 and 3 gigs of RAM, and we still have to restart Tomcat once or twice a week, just because it IS intensive.
JSP and Tomcat are good for those applications that do require it, however, they're killer on lower and mid grade servers. First thing I would do is to check the config file to make sure your timeout settings aren't too high or low. Baring that, I would actually look for someone that's experienced with optimizing not only your server, but Tomcat as well.
Douglas Hazard - Certifiable Sports Junkie and Sports Community Enthusiast
Host of Two Cents Radio - Follow @TwoCentsRadio on Twitter (@BearlyDoug on Twitter)