This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

Problem description

Broken transactions due to missing links:

  • between JSP Servlet Action Classes and called public methods such as doGet, doPOST, etc
  • between Struts framework Action Classes and called public methods such as doExecute, customExecute, etc

Solution

  • First please ensure that the CAST System Views (CSV) are up-to-date before you proceed with this action. To do so you can generate a snapshot (which includes the update of the CSV) or you can run the Update CAST System Views tool available in the Content Enrichment tab in the Application editor (CAST Management Studio).
  • Copy the following query:
/* Template creating new links between existing unlinked objects */
insert into §CI_LINKS (CALLER_ID, CALLED_ID, LINK_TYPE, ERROR_ID)
select distinct op.parent_id caller_id, o.object_id called_id, 'callLink', 0
  from ctt_object_parents op, cdt_objects o
 where op.object_id = o.object_id
   and o.object_type_str = 'Java Method'
   and o.object_type_ext like '%public%'
   and op.parent_id in (
	select l.caller_id
	  from cdt_objects o, ctv_links l
	 where o.object_fullname = 'org.apache.struts.action.Action'
	   and o.object_type_str = 'Java Class'
	   and o.object_id = l.called_id
	   and l.link_type_lo = 33554432 --Inherit%
	union
	select l2.caller_id
	  from cdt_objects o, ctv_links l, ctv_links l2
	 where o.object_fullname = 'org.apache.struts.action.Action'
	   and o.object_type_str = 'Java Class'
	   and o.object_id = l.called_id
	   and l.link_type_lo = 33554432 --Inherit%
	   and l.caller_id = l2.called_id
	   and l2.link_type_lo = 33554432 --Inherit%
	union
	select l3.caller_id
	  from cdt_objects o, ctv_links l, ctv_links l2, ctv_links l3
	 where o.object_fullname = 'org.apache.struts.action.Action'
	   and o.object_type_str = 'Java Class'
	   and o.object_id = l.called_id
	   and l.link_type_lo = 33554432 --Inherit%
	   and l.caller_id = l2.called_id
	   and l2.link_type_lo = 33554432 --Inherit%  
	   and l2.caller_id = l3.called_id
	   and l3.link_type_lo = 33554432 --Inherit%     
	union
	select l4.caller_id
	  from cdt_objects o, ctv_links l, ctv_links l2, ctv_links l3, ctv_links l4
	 where o.object_fullname = 'org.apache.struts.action.Action'
	   and o.object_type_str = 'Java Class'
	   and o.object_id = l.called_id
	   and l.link_type_lo = 33554432 --Inherit%
	   and l.caller_id = l2.called_id
	   and l2.link_type_lo = 33554432 --Inherit%  
	   and l2.caller_id = l3.called_id
	   and l3.link_type_lo = 33554432 --Inherit%       
	   and l3.caller_id = l4.called_id
	   and l4.link_type_lo = 33554432 --Inherit%    
	union
	select l5.caller_id
	  from cdt_objects o, ctv_links l, ctv_links l2, ctv_links l3, ctv_links l4, ctv_links l5
	 where o.object_fullname = 'org.apache.struts.action.Action'
	   and o.object_type_str = 'Java Class'
	   and o.object_id = l.called_id
	   and l.link_type_lo = 33554432 --Inherit%
	   and l.caller_id = l2.called_id
	   and l2.link_type_lo = 33554432 --Inherit%
	   and l2.caller_id = l3.called_id
	   and l3.link_type_lo = 33554432 --Inherit%
	   and l3.caller_id = l4.called_id
	   and l4.link_type_lo = 33554432 --Inherit%
	   and l4.caller_id = l5.called_id
	   and l5.link_type_lo = 33554432 --Inherit%
	)
/
  • In the CAST Management Studio, select the Content Enrichment tab in your Application
  • Add a new Tool by selecting Add a new Update CAST Knowledge Base:

  • Paste in the query: 

    • The Tool (and the query) will now be run immediately after the analysis phase (i.e. when using the Run analysis or snapshot generation options), thus correcting the problem.