Description

When you run the JEE analysis with the Apache Struts Extension on top of the JEE Analyzer, it can occur that some Struts Operations are not created whereas they are expected.

Official Documentation : Apache Struts - 1.0

Observed in CAST Extension
Release
Yes/No
1.0.2-FuncRel(error)
1.0.1-FuncRel(tick)
1.0.0-FuncRel(tick)


Observed on RDBMS
RDBMS
Yes/No
Oracle Server(tick)
Microsoft SQL Server(tick)
CSS3(tick)
CSS2(tick)
Action Plan
  1. Check customer expectation : should a Struts Operation be created for this method ?
    1. Determine the version of Struts being used in the code : find file struts-config.xml or struts.xml in the source. The version will be specified on the second line as follows :

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

      In this example, customer is using Struts 1.2

    2. If the code uses Struts 1, then open the Java file containing the class in which the method belongs to
      1. If the class extends framework class is org.apache.struts.actions.DispatchAction or if the class extends framework class is org.apache.struts.actions.LookupDispatchAction, then only the methods with the below signature should generate a Struts Operation

        MyExtendedDispatcherAction.java
        public ActionForward myMethodXXX(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response);
      2. If not, then look for the contents of the below method in the class :

        execute method
        public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){

        Only the methods called by this method should generate a Struts Operation

    3. If the code uses Struts2, then open the Java file containing the class which the method belongs: only the public methods returning a String object such like "SUCCESS","ERROR", "INPUT", "LOGIN", or "NONE"
  2. If the Struts Operation is not expected (method is private, or does not have the expected signature), then explain to customer that the method is not considered as a Struts Operation. If it is expected, then proceed to next step.
  3. Check the end of the analysis log file (just after the Saving Step) for warnings about duplicate GUIDs, like below :

    Analysis log file
    Warning: GUID duplicate found : CAST_Struts_Operation  'S:\Sources\MyApp\Analyzed\WAR\WEB-INF\activation-struts-config.xml/CAST_Struts_Operation/myActionMapping?dispatch=init' UNIVERSAL_CACHE : DUPLICATE OBJECTS NAME IN SOURCE: 99?com?99?mycompany?99?myapp?99?struts?99?activations?620?s:/sources/myapp/analyzed/src/main/com/mycompany/myapp/struts/activations/myaction.java
    

    The reason is that before version 1.0.2-FuncRel of Struts Extension, there was no check on the unicity of Action Mappings declared in the Struts configuration files. If an Action Mapping was declared twice by mistake, then you have this warning for all its operations, and the operations are not saved in KB. Download and install Struts Extension 1.0.2-FuncRel and re-analyze.

  4. If there are no such warnings, then the reason could be Spring/Struts integration. Open struts.xml or struts-config.xml and have a look at the action mappings.

    struts-config.xml
    <action name="loadJSON" class="oneActionAmidOthers" method="loadThisList">
          <result type="json">
        <param name="root">json</param>
          </result>
      </action>

    Here the class is defined by an ID (oneActionAmidOthers) and not by a canonical class name. This is a Spring Bean ID, and it is defined in Spring configuration file.

    spring-config.xml
    <bean id="oneActionAmidOthers" class="com.mycompany.action.MyAction" scope="prototype">
     </bean>

    This Spring-Struts integration was not supported before version Struts Extension 1.2.0-FuncRel. Download and install it, then reanalyze

  5. If this does not solve the problem, contact  CAST Technical Support with following Relevant Input.


Notes/comments
 Tickets # 14173, 13851, 13884, 13949
Related Pages