Announcement Announcement Module
Collapse
No announcement yet.
String index out of range: 1 at DefaultFlowUrlHandler.getFlowId() Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • String index out of range: 1 at DefaultFlowUrlHandler.getFlowId()

    Hi guys,

    I am new to spring webflow. very easy to understand but I am having an issue. I am running this application on my local machine which is actually running perfectly fine in prod and test. Now, Everything compiles and runs fine but as soon as I hit the links that are related to the modules registered with webflow, they crash. I tried all of them and I dont think any one works.

    my webflow.xml is like this (names and locations have been changed to protect the modules.)
    Code:
    <!-- The Flow handler adapter, to handle flows request recieved by the dispatcher servlet -->
     <bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">  
         <property name="flowExecutor" ref="flowExecutor"/>  
     </bean>
    <flow:flow-registry id="myflowRegistry" flow-builder-services="flowBuilderServices" >
            <!-- all xml files in base path and subfolders  -->    
            <flow:flow-location path="/WEB-INF/flows/payslips.xml" />          
            <flow:flow-location path="/WEB-INF/flows/admissions.xml" />
            <flow:flow-location id="cash-advance" path="/WEB-INF/flows/cashadvance.xml"/>
            <flow:flow-location path="/WEB-INF/flows/services.xml" />
            <flow:flow-location path="/WEB-INF/flows/undergradadm.xml" />
         </flow:flow-registry>   
      <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        <property name="order" value="0" />
        <property name="flowRegistry" ref="myflowRegistry" />
    
    </bean>

    now when I hit the relative links i get this on the screen :

    Code:
    Error 500: Request processing failed; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    the stack trace looks like this :
    Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at java.lang.String.substring(String.java:1060)
    at org.springframework.webflow.context.servlet.Defaul tFlowUrlHandler.getFlowId(DefaultFlowUrlHandler.ja va:83)
    at org.springframework.webflow.mvc.servlet.FlowHandle rMapping.getHandlerInternal(FlowHandlerMapping.jav a:92)
    at org.springframework.web.servlet.handler.AbstractHa ndlerMapping.getHandler(AbstractHandlerMapping.jav a:184)
    at org.springframework.web.servlet.DispatcherServlet. getHandler(DispatcherServlet.java:1057)

    What i understand is that there is nothing bound to /webapp/payslips.go or /webapp/admissions.go.

    I have tried to search on this forum, google, or stakexchange but i havent seen this error so it means that what I am getting is not common and must be quite stupid to even get this error in the first place. I am trying but I dont know webflow enuff to know where to actually register them.

    Will really appreciate any help.

    Thanks

  • #2
    Hello

    1) Why you wrote this?

    Code:
     <flow:flow-location id="cash-advance" path="/WEB-INF/flows/cashadvance.xml"/>
    2) Check and do a comparison about structure of your own configuration vs the SWF's documentation

    3) Could you post your web.xml configuration?

    4) is only SWF application? or work together with Spring MVC?

    Comment


    • #3
      Thanks for the reply. (I had to make a new user cos I couldnt post with my prev id)

      1) It was already this way. I have no idea why they only did it for only one and left the rest out.

      2) I would do that but the same application works fine on the UAT and Prod servers here. I just took the project and tried to run it on my machine. No one changes anything when they compile and place the ear file in the prod or UAT. the only difference is in the OS. I am on winXp and the prods are on unix or linux.

      3) I would but there is nothing there. first there is a display-name tag, followed by a linstener, then a DispatcherServlet and its mapping, then two filters, a welcome file list and lastly a Datasource Resource-ref tag.
      Nothing related to webflow.

      4) We are using MVC as well. So we have custom controllers.

      I will look at the configuration again and see if I have missed out on any thing. Thats the only thing I can think of myself as it is running on different servers with same configs


      Thanks.
      Mahdi.

      Comment


      • #4
        I did see the configurations. I did not see anything that was different from usual. Has no one ever got this msg before.

        Comment


        • #5
          OK, what I see in my configs, is not what is mentioned in online references:

          In online references they use to map the urls like this:

          Code:
          <!-- Maps flow requests from DispatcherServlet to flowController -->  
              <!--  <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">  
                   <property name="mappings">  
                       <value>  				
                          /rb/sample.go=flowController  
                          /rb/authFlow.go=flowController  
                       </value>  
                   </property>  
                   <property name="alwaysUseFullPath" value="true"/>  
               </bean> -->
          this part is usually where they map the urls to the flowController but in mine I am using this:

          Code:
          <!-- Map resources to flow  -->
               <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
              	<property name="order" value="0" />
              	<property name="flowRegistry" ref="flowRegistry" />
              	
          	</bean>
          This is how We are mapping. What I do not understand is how is it working on test servers where the only difference I see is the OS. Im on windows and the servers are on Unix. I even tried giving Ids to the flow locations in the flow registry but that didnt work either:
          Code:
          <flow:flow-registry id="myflowRegistry" flow-builder-services="flowBuilderServices" >
                  <!-- all xml files in base path and subfolders  -->    
                  <flow:flow-location id = "payslips" path="/WEB-INF/flows/payslips.xml" />          
                  <flow:flow-location id="admissions" path="/WEB-INF/flows/admissions.xml" />
                  <flow:flow-location id="cash-advance" path="/WEB-INF/flows/cashadvance.xml"/>
                  <flow:flow-location id="services" path="/WEB-INF/flows/services.xml" />
                  <flow:flow-location id="undergradadm" path="/WEB-INF/flows/undergradadm.xml" />
               </flow:flow-registry>

          I am really stuck on this. I will really appreciate if some one can help me on this.

          Thanks.
          Mahdi

          Comment


          • #6
            Ok i debugged the code to some extent and i have (i think) found where the problem is:

            if i start the payslips.xml (webflow) the first state is an action-state which only evaluates and sets a request parameter to a flow scope variable

            Code:
            <action-state id="setupModel" >							
            		<evaluate expression="requestParameters.payslipType" result="flowScope.payslipType" ></evaluate>
            		<transition  to="setupView">
            		</transition>
            	</action-state>
            		
            	<view-state id="setupView" view="payslips">
            		<on-entry>
            			<evaluate expression="requestParameters.backFlag" result="viewScope.backFlag" ></evaluate>
            			<evaluate expression="payslips.canUserApprovePayslips()" result="flowScope.approvalsMap" ></evaluate>	
            		</on-entry>
            		<transition on="processPayslips" to="confirmationView" >
            		</transition>
            	</view-state>
            <view-state id="confirmView" view="payslips_confirmation">		
            		<on-entry>
            			<evaluate expression="requestParameters.selectedBulkPayslipsType" result="flowScope.selectedBulkPayslipsType" ></evaluate>
            			
            		</on-entry>		
            		<transition on="confirm" to="resultView" ></transition>
            		<transition on="back" to="setupView" ></transition>
            	</view-state>
            The payslips.canUserApprovePayslips() method is executed in full and exited successfully THEN it shows me the flowId not found error and string out of bound exception which means it cannot find the payslips.jsp. SO now I know this is the problem but I cannot solve this as the setup is a bit complex here for the view:

            here is my View Resolver:
            Code:
            <!-- Maps a logical view name to a physical resource using a resource bundle (views.properties)-->
            	<bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
            		
            		<property name="basenames">
             			<list>
             				<value>com.mypackage.mvc.payslips</value>
             			</list>
              		</property>		
            	</bean>
            in this com.mypackage.mvc package there is the payslips.properties file which has listings like this :


            Code:
            payslips.class=org.springframework.web.servlet.view.JstlView
            payslips.url=/payslips/payslips.jsp
            
            payslips_confirmation.class=org.springframework.web.servlet.view.JstlView
            payslips_confirmation.url=/payslips/payslips_confirm.jsp
            
            payslips_results.class=org.springframework.web.servlet.view.JstlView
            payslips_results.url=/payslips/payslips_results.jsp
            Now see I have made it this far, I don't know how this properties file is supposed to be read in webflow as a view resolver property but it is not. The non webflow urls are being accessed and the properties file is actually working in non webflow cases but the webflow urls even in the same file are not working.

            I will really appreciate if anyone can help me in figuring out how to tell webflow where the jsps is for the view state.

            Thanks in advance.

            Mahdi

            Comment


            • #7
              hello All!! (sorry for bumping this thread again, but i am still stuck on this)

              I am trying to search for this issue on the net and i am not finding any leads.

              I have so far reached to the point that even after changing the <view-state> view attribute value to "/WEB-INF/jsp/payslips/payslips.jsp" it still throws me the StringoutofBoundException : 1 .

              so what ever theview is : view="payslips" view="/WEB-INF/jsp/payslips/payslips.jsp" it is picked up as "". Why is that.

              Why is it coming as empty string when the state completes the paylsips.canUserApprove() method in

              <view-state id="setupView" view="payslips">

              The main frustration is that it is working without any config changes in test and prod env why is ti giving me issues in local dev machine.

              Thanks in advance if someone has any hints to it.

              Syed..

              Comment


              • #8
                Check you do not have duplicate libraries (different versions) on your classpath. Perhaps 1 library is loading first on linux and is different on windows. I dont know which libraries to check specifically though. If you are using maven you could use dependency:tree

                Comment

                Working...
                X