Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tomcat Web App - Strange Issue - Need 2 restarts for SSO mode to work

Status
Not open for further replies.

SunilAV

Programmer
Jun 14, 2010
3
0
0
JP
Hi,

We have a web application deployed on Tomcat server and is working pretty fine, except in one mode. The web application is available through 2 modes of links - one is regular without load balacer and other is Single Sign On based through load balancer. The normal mode works fine with one start after new war deployment. However SSO link through load balancer does not work fine. When stooped and started again, it works just fine.

Here is the sample directory structure:
Tomcat
webapps
MyApp
WEB-INF
web.xml
jsp
myapp.jsp
MyApp.war
bin
logs
conf
web.xml

Deployment Procedure:
Stop the server
Copy the new war to webapps replacing the old one
remove the complete diretcory of MyApp recursively (rm -rf MyApp)
start the server

Issue:
We try both the links of application. The normal one works just fine first time itself. The SSO link shows up the directory listings page of webapps directory showing the MyApp.war and MyApp directory link.
Now all we need to workaround this is just stop the server again and then start it. Surprisingly both SSO mode link and normal works totally fine.
This is recurring problem. Is there a proper permanent fix to this?

Please note the web.xml in Tomcat/conf directory has below
<servlet>
<servlet-name>default</servlet-name>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

Please note the web.xml in Tomcat/webapps/MyApp/WEB-INF directory has below
<welcome-file-list>
<welcome-file>myapp.jsp</welcome-file>
</welcome-file-list>

The application has only myapp.jsp and none of index.* files

myapp.jsp is as below
<html><head><META URL=<%=request.getContextPath()%>/who.do"></head><body/></html>

Somehow first time when new war is deployed, old exploded directory is deleted and server is started, the Tomcat might not be finding xcard.jsp or the application specific web.xml and hence it is listings the directory based on settings in Tomcat/conf/web.xml. No exceptions in log file.
Second time however it finds the web.xml and xcard.jsp and hence works.

We even tried changing deployment procedure not to delete the exploded directory and rest of steps same. But it does not help either. If we drop the new war while the server is running, it does not take the changes in new war.

~Sunil
 
What are you using for load balancing? Maybe you need to refresh some plugin configuration

Cheers,
Dian
 
There is a hardware load balancer which we do not have much control upon. In this mode load balacer takes the SSL and SSO requests and forward to LDAP authenticator before redirecting to web application.
What I am looking for is in scope of Tomcat or in scope of web application, can I handle this?
Because I see in web.xml comments, it is written that if welcome file is not availble for Tomcat, then it acts according to settings in web.xml. If listings is True, it will display the directory settings and if false, it gives 404 error which is happening for us.
When I set it to True it shows directory listing of webapps directory, else it diaplays 404 error on first start after deployment

On second restart it works fine and application is shown
 
If load balancing is ok, Tomcat shouldn't notice anything, request should be identical. Maybe you could compare what the server is getting in both cases.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top