Page tree
Skip to end of metadata
Go to start of metadata
Purpose (problem description)

This guide provides the approach to troubleshoot missing or wrong / incorrect links between two J2EE objects.

Links detected and saved by analyzer

JEE - Analysis results 

Observed in CAST AIP
Release
Yes/No
8.3.x(tick)
Observed on RDBMS
RDBMS
Yes/No
CSS4(tick)
CSS3(tick)
CSS2(tick)

Known cases

  1. Missing links between two methods/constructors/members  
    1. If Method 1 is calling Method 2, and yet there is no link between the two then this can be due to the fact that a method parameter has not been resolved by the analyzer Here is an example:
      1. The CTTVSmartcard method is calling the getDeliveryOrderByCustomerProductId method, and we can see here that there is no link between the two. 

      2. Here is the definition of the getDeliveryOrderByCustomerProductId method:

        getDeliveryOrdersByCustomerProductId (long customerProductId, long customerProductLineId,long lLanguageId, String userId, boolean showAll)
      3. Check in the CTTVSmartcard method how the getDeliveryOrderByCustomerProductId method is called:

        deliveryOrderList = MTTVSmartcard.getDeliveryOrdersByCustomerProductId(customerProductId, customerProductLineId, languageId, userSession.strUserName, true);

        If the userSession type has not been defined, the J2EE analyzer will not be able to resolve the link between the CTTVSmartcard method and getDeliveryOrderByCustomerProductId method. 


      4. You can verify the above information in the Java analysis log where you should have a warning message like the one described in CMS Snapshot Analysis - Run Analyzer - Warnings - JEE with extension - JEE Analyzer - JAVA124: Cannot resolve 'XXX' as type. Follow this troubleshooting guide to resolve the missing link issues
    2. See if the methods are from two different analysis units and see if there are any user defined analysis units. If there are user defined analysis units there should be a dependency defined between them to get the links.
  2. Missing links between JSP page and other objects


    1. Missing link from a JSP file to JS functions or to other JSP files

      The application may work because of the application context, but out of this context (deployment folder) the path of the files is wrong and the analyzer will not resolve it. The only two ways to resolve file paths are the following :
      If path starts with a slash ("/"), it refers to the Application Root Path

      If not, path is a relative to the folder containing the current file

      <jsp:include page ="/WEB-INF/fusion/jsp/include.jsp" />
      <link rel =stylesheet type=text/css href="static/fusion/css/test1.css">
      <link rel =stylesheet type=text/css href="static/fusion/css/test2.css">
      <link rel =stylesheet type=text/css href="static/fusion/css/test3.css">
       
       <script type="text/javascript" src="static/inc/testing-tn-reserv-common.js"></script>

      From the above code snippet, last line can be replaced by (adding a slash (/) before the path of js file)

      src="/static/inc/testing-tn-reserv-common.js"></script>

      If any other pattern is used, the link will not be created. Text replacement can also be used to change the path starting with slash (/).

    2. Missing link from a JSP efile to Java method

      Open the JSP file using a file editor from where the link is expected to the java method and check for the below syntax:

      <%@include file="<Jsp_file_name>.jsp"%>

      change the above syntax to <jsp:include page="<Jsp_file_name>.jsp"/> save the file and run the analysis, you will see the links between the efile and method. Text replacement can also be used to change syntax.


    3. Is the link missing from the text embedded in the custom JSP tag, see page CMS Snapshot Analysis - Run Analyzer - JSP - Information - Links from the text embedded inside the custom JSP tags are not interpreted by java analyzer


  3. Missing link between XHTML and java objects
    This maybe due to the fact that JSF 2.0  is not supported. As a consequence of non support of JSF files, links between XHTML and java objects will not be created.
    Links can also be missing if CDI framework is used. There can be no link drawn between xhtml and java methods if we have the usage of the J2EE CDI framework which is not supported by CAST. The "JSF beans" might be defined through CDI annotations. As they are not recognized, jsf bean will not be created and then no resolution can be done from XHTML to Java .Sample code is given below:

    @Named("someBean")
    @RequestScoped
    public class SomeBean {
     
        @Inject
        private SomeService someService;
    }

    When @Named annotation is used,that means CDI framework has been used.


  4. Missing link between Hibernate Entity and Oracle Table.
    Please refer to the CMS Snapshot Analysis - Run Analyzer - Missing or Wrong Links per technology - J2EE - Missing links between hibernate entity and oracle tables
  5. Links from J2EE/Hibernate to DB  : SQL embedded in the hbm.xml file If we have the below tag written in hbm.xml (hibernate entity) then there will be no links created from Table "Orders" to this hibernate entity. In the following example The link is NOT EXPECTED because the <sql-query.....> </sql-query> tag is not supported
     <sql-query name="removeOrders">
            update 
                Orders 
            set
                Price = 245,
                Quantity = 23
            where 
                PLU = 34542343
        </sql-query>
  6. J2EE : Links between JPA Entity and Java Class
    A Java class can't call any artifacts\JPA Entity by definition. The JPA entity relies on the class to exist. The transactions are working if you have a link from a method using the entity (usually through getter or setter) and hence a flow to the table. So the link between JPA Entity and Java class is a wrong expectation.
  7. Wrong links in J2EE, related to funnel programming

    If you have several false links and if the application is developed using interface-based programming or uses abstract classes, the issue might be due to  funnel

  8. If the above cases are not relevant, contact CAST Technical Support. with Relevant Input
Notes/comments


Related Pages

  • No labels