Avatar of mallocaway
mallocaway
 asked on

I am recieving "java.lang.IllegalArgumentException: Path welcome does not start with a "/" character" when tryign to create a simple struts app with MyEclipse

I am receiving the following error message when attempting to create a simple J2EE application with Struts and MyEclipse

java.lang.IllegalArgumentException: Path welcome does not start with a "/" character

Here is my 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 />
  <form-beans >
    <form-bean name="welcomeForm" type="com.yourcompany.struts.form.WelcomeForm" />
  </form-beans>

  <global-exceptions />
  <global-forwards >
    <forward
      name="welcome"
      path="/welcome.do"
      redirect="true" />
  </global-forwards>

  <action-mappings >
    <action
      attribute="welcomeForm"
      input="/jsp/welcome.jsp"
      name="welcomeForm"
      path="/welcome"
      scope="request"
      type="com.yourcompany.struts.action.WelcomeAction" >
        <forward name="success" path="welcome" />
    </action>
  </action-mappings>

  <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>

Here is my WelcomeAction.java  execute() method:
public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
      WelcomeForm welcomeForm = (WelcomeForm) form;// TODO Auto-generated method stub
      mapping.findForward("success");
      return mapping.findForward("success");
}

I get the error mentioned above.
Below is the log:
Jul 18, 2008 12:00:26 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true
Jul 18, 2008 12:00:49 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.IllegalArgumentException: Path welcome does not start with a "/" character
      at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:379)
      at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:195)
      at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
      at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
      at java.lang.Thread.run(Thread.java:619)

I'm new to this.
Can anyone give me some guidance?
Thank you!
Java EE

Avatar of undefined
Last Comment
mallocaway

8/22/2022 - Mon
krishna kishore mellacheruvu venkata

replace
 
with
 

mallocaway

ASKER
I made the change mentioned

replace
 
with
 

However, now I seem to be in an infinite loop. The execute() method is continually called and the JSP is never displayed.

I place a break point on the return of the execute() method and it is continually hit.

Any ideas?

Thank you!
krishna kishore mellacheruvu venkata

since you have given success path as "/welcome.do" it is going on infinite loop. What is your functionality.  what should happen when success path?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
mallocaway

ASKER
On success I simply wish to display my JSP page, welcome.jsp
Thank you so much!
ASKER CERTIFIED SOLUTION
krishna kishore mellacheruvu venkata

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
mallocaway

ASKER
Ah yes that worked wonderfully!
Thank you so much! I am kind of new at this. ;-)