You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hayrol Reyes Mejía <Ha...@mhcp.gob.ni> on 2007/08/30 18:31:03 UTC

ActionRedirect with wrong absolute path

Hi guys, I'm having a problem with Struts 1.2 and a IAS environment, the problem is as follow:

 

The application use Struts 1.2 and Hibernate 3 and OraclaeAS 10g (10.1.0.2). The Application works very well in the developer OAS, but doesn't in the production's OAS (two servers).



The problems occurss when the application need to do a ActionRedirect (redirect true), after a simple update/insert into the DB (with Hibernate). The flow is as follow:
 1).- The "show_Product.do" is launched and it goes well and show the Product.jsp (with the show section actived).
 2).- The user press the "Update" buttom, then the "edit_Product.do" action is executed and the Product.jsp is showed (with the edit section actived).
 3).- The user modify the product info and press the "Save" buttom, then the "edit_Product.do" action is executed with the parameter "save" ..... then the action class calls to the "save" method of the ProductForm and the ActionRedirect is configured to point to "show_Product.do", after the commit to the DB the action is executed and "show_Product.do" show the Product.jsp with relevant changes included.

 

This normal process works very well in our developers environment IAS but doesn't in the production IAS. In the production environment the application committed the changes but the last ActionRedirect (show_Product.do) is not executed and the browser show a "Error Page" related to the connection problems, however the changes are committed correctly in the DB.

 

The worst is that I get no error log related to the problem.

 

After looking and looking for a error (in the App log, IAS log, http log, etc) I found (with a help of a snifer program) that the edit_Product.do action is creating the next ActionRedirect using the URL http://www.domain.com:7777/app/show_Product.do <http://www.domain.com:7777/app/show_Product.do>  ... and this aproach fails becouse the www.domain.com <http://www.domain.com/>  is a DNS name that already has the :7777 configured at itself. This is a two IAS enviroment (server7.comp.com and server8.comp.com) and its behind a front web accessed by a single http://www.domain.com <http://www.domain.com/> , in other words the ActionRedirect will not fails if the URL will be http://server7.comp.com:7777/app/show_Product.do, but Struts is adding the DNS domain.com and the physical port number where the app is installed. The application is only installed into the server7.comp.com IAS on port 7777 and is accessed using www.domain.com/app/index.jsp <http://www.domain.com/app/index.jsp>  (port 80)... but there is a internal port change.
 
More clearly:
 
http://www.domain.com/app/index.jsp <http://www.domain.com/app/index.jsp>   --> Works
 
http://www.domain.com:7777/app/index.jsp <http://www.domain.com:7777/app/index.jsp>   --> Doesn't work <-- It's causing the error.
 
http://server7.comp.com:7777/app/index.jsp <http://server7.comp.com:7777/app/index.jsp>   --> Works

 

http://192.168.1.50:7777/app/index.jsp --> Works <-- It's the IP of server7
 
I'm doing the following in the method that build the next action:
 
public ActionForward processActionForward(ActionMapping mapping, HttpServletRequest request, ActionForward forward) {

       ActionRedirect ar = new ActionRedirect("/show_Product.do");   // <--- I'm using relativity and redirect is true

       ar.addParameter("param1", "100"));

       ar.addParameter("param2", "month");
return ar;
}
 
But when Struts execute the Forward (redirect true) after a POST .. then it adds the www.domain.com:7777 <http://www.domain.com:7777/>  before the contextPath and the action url.
 
How I can tell Struts doesn't add the :7777 <http://www.domain.com:7777/>  port to the action URL and leave the correct www.domain.com/app <http://www.domain.com/app> ?
 
Or, how I can tell Struts that add the internal http://server7.comp.com:7777 <http://server7.comp.com:7777/app/index.jsp>  before the contextPath and Action URL?
 
Or What I can use to deal with this lame environment?



Can somebody help me?


Thanks in advance,

 

Hayrol Reyes