aspose file tools*
The moose likes Struts and the fly likes Error 400: Invalid path /main was requested Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error 400: Invalid path /main was requested" Watch "Error 400: Invalid path /main was requested" New topic
Author

Error 400: Invalid path /main was requested

Joanne Bangasan
Greenhorn

Joined: May 10, 2008
Posts: 11
Hi would you please help me resolve the invalid path error I�m getting. I checked all the mappings but they all seem correct. I would appreciate so much any suggestions from you guys.

Error 400: Invalid path /main was requested.

web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_ID">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>

<display-name>ecopeland</display-name>
<servlet>
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<servlet-name>MainAction</servlet-name>
<servlet-class>com.ecopeland.actions.MainAction</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>MainAction</servlet-name>
<url-pattern>/main</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>pages/index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/datetime-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-datetime.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/string-1.0.1</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-string.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/utility</taglib-uri>
<taglib-location>/WEB-INF/lib/utility.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/mailer-1.1</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-mailer.jar</taglib-location>
</taglib>
</web-app>

struts-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>

<!-- Data Sources -->
<data-sources>
</data-sources>

<!-- Form Beans -->
<form-beans>
<form-bean name="ContactUsFormBean" type="com.ecopeland.forms.ContactUsFormBean">
</form-bean>
<form-bean name="SelsoftRegFormBean" type="com.ecopeland.forms.SelsoftRegFormBean">
</form-bean>
</form-beans>

<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>

<!-- Global Forwards -->
<global-forwards>
</global-forwards>

<!-- Action Mappings -->
<action-mappings>
<action path="/career" type="com.ecopeland.actions.CareerAction">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="career" path="/pages/career.jsp">
</forward>
<forward name="careerdetails" path="/pages/careerdetails.jsp">
</forward>
</action>
<action path="/distnetwork" type="com.ecopeland.actions.DistNetworkAction">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="distnet" path="/pages/distnet.jsp">
</forward>
<forward name="distnetshow" path="/pages/distnetshow.jsp">
</forward>
</action>
<action path="/home" type="com.ecopeland.actions.HomeAction">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="home" path="/pages/home.jsp">
</forward>
<forward name="termsofsales" path="/pages/termsofsales.jsp">
</forward>
<forward name="impressum" path="/pages/impressum.jsp">
</forward>
<forward name="newsblock3" path="/pages/newsblock3.jsp">
</forward>
<forward name="newsblock2" path="/pages/newsblock2.jsp">
</forward>
<forward name="underconstruction" path="/pages/underconstruction.jsp">
</forward>
<forward name="contactus" path="/pages/contactus.jsp">
</forward>
<forward name="link" path="/pages/link.jsp">
</forward>
</action>
<action path="/location" type="com.ecopeland.actions.LocationAction">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="location" path="/pages/locations.jsp">
</forward>
<forward name="loccookstown" path="/pages/loccookstown.jsp">
</forward>
<forward name="locecully" path="/pages/locecully.jsp">
</forward>
<forward name="locsaronno" path="/pages/locsaronno.jsp">
</forward>
<forward name="loctheale" path="/pages/loctheale.jsp">
</forward>
<forward name="locwaiblingen" path="/pages/locwaiblingen.jsp">
</forward>
<forward name="locmaintal" path="/pages/locmaintal.jsp">
</forward>
<forward name="lockolin" path="/pages/lockolin.jsp">
</forward>
<forward name="locberlin" path="/pages/locberlin.jsp">
</forward>
<forward name="locmoscow" path="/pages/locmoscow.jsp">
</forward>
<forward name="lockiev" path="/pages/lockiev.jsp">
</forward>
<forward name="locvenlo" path="/pages/locvenlo.jsp">
</forward>
<forward name="locwelkenraedt" path="/pages/locwelkenraedt.jsp">
</forward>
<forward name="locwelkenraedt2" path="/pages/locwelkenraedt2.jsp">
</forward>
<forward name="locwelkenraedt2gr" path="/pages/locwelkenraedt2gr.jsp">
</forward>
<forward name="locwelkenraedt2fr" path="/pages/locwelkenraedt2fr.jsp">
</forward>
</action>
<action path="/main" type="com.ecopeland.actions.MainAction">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="home" path="/pages/home.jsp">
</forward>
</action>
<action path="/selectsoft" type="com.ecopeland.actions.SelectsoftAction">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="seldownloads" path="/pages/seldownloads.jsp">
</forward>
<forward name="selinstruction" path="/pages/selinstruction.jsp">
</forward>
<forward name="selwhatsnew" path="/pages/selwhatsnew.jsp">
</forward>
<forward name="seldownload" path="/pages/seldownload.jsp">
</forward>
<forward name="selregister" path="/pages/selregister.jsp">
</forward>
</action>
<action name="ContactUsFormBean" path="/contactus" scope="request" type="com.ecopeland.actions.ContactUsAction" input="/contactus.jsp">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="contactok" path="/pages/contactok.jsp">
</forward>
<forward name="contactus" path="/pages/contactus.jsp">
</forward>
</action>
<action name="SelsoftRegFormBean" path="/selsoftreg" scope="request" type="com.ecopeland.actions.SelsoftregAction" input="/selregister.jsp">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="selregister" path="/pages/selregister.jsp">
</forward>
<forward name="selregisterok" path="/pages/selregisterok.jsp">
</forward>
</action>
<action path="/search" type="com.ecopeland.actions.SearchAction">
<forward name="search" path="/pages/search.jsp">
</forward>
<forward name="underconstruction" path="/pages/underconstruction.jsp">
</forward>
<forward name="searchdownload" path="/pages/searchdownload.jsp">
</forward>
<forward name="searchresult" path="/pages/searchresult.jsp">
</forward>
<forward name="searchnoresult" path="/pages/searchnoresult.jsp">
</forward>
<forward name="searchmain" path="/pages/search.jsp">
</forward>
</action>
</action-mappings>

<!-- Message Resources -->
<message-resources parameter="com.ecopeland.resources.ApplicationResources"/>
<message-resources parameter="com.ecopeland.resources.Home" />
<message-resources parameter="com.ecopeland.resources.Impressum" />
<message-resources parameter="com.ecopeland.resources.ContactUs" />
<message-resources parameter="com.ecopeland.resources.ContactUsOk" />
<message-resources parameter="com.ecopeland.resources.NewsBlockLink" />
<message-resources parameter="com.ecopeland.resources.TermsOfSales" />
<message-resources parameter="com.ecopeland.resources.SysResources" />


</struts-config>



Thanks much much much in advance,
Joanne
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If the class com.ecopeland.actions.MainAction extends org.apache.struts.action.Action, it should not be declared as a Servlet, because it isn't a Servlet. In general, a Struts application should have only the Struts ActionServlet declared as a Servlet in the web.xml file.

I'm not sure what you're trying to accomplish by this, but you should declare the /main action in the struts-config.xml file, not in the web.xml file.
[ June 05, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Joanne Bangasan
Greenhorn

Joined: May 10, 2008
Posts: 11
Hi Merrill,

struts-config.xml
...
<action path="/main" type="com.ecopeland.actions.MainAction">
<icon>
<small-icon>/pages/images/icon1.jpg</small-icon>
<large-icon>/pages/images/icon.jpg</large-icon>
</icon>
<forward name="home" path="/pages/home.jsp">
</forward>
</action>
...

web.xml:
...
<servlet-mapping>
<servlet-name>MainAction</servlet-name>
<url-pattern>/main</url-pattern>
</servlet-mapping>
...

com.ecopeland.actions.MainAction extends org.apache.struts.action.Action.

I tried to put comments on servlet mapping for MainAction in web.xml but I still get the same error.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
when you call the URL, you should have a ".do" suffix on the end. Example:

http://myserver.com/myapp/main.do
Joanne Bangasan
Greenhorn

Joined: May 10, 2008
Posts: 11
Hi Merill,

Yes, calling http://localhost:9080/europe/ or http://localhost:9080/ecopeland/ redirects to http://localhost:9080/europe/main.do. But it shows:

Error 404: No target servlet configured for uri: /europe/main.do



Regards,
Joanne
Joanne Bangasan
Greenhorn

Joined: May 10, 2008
Posts: 11
The rest of the pages shows:

Error 500:
Joanne Bangasan
Greenhorn

Joined: May 10, 2008
Posts: 11
My context is europe.

And the index page redirects to main.do :

response.sendRedirect("/europe/main.do");


Please help me on this guys,
Joanne
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
All I can say is that it appears your action mapping is not defined correctly. I'd start by removing the <icon>, <large-icon> and <small-icon> tags. These are invalid for a Struts-config.xml file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error 400: Invalid path /main was requested