While running the analysis you may get warnings related to unresolved objects in the analysis log file. It means that the analyzer is unable to resolve the objects, either because of an ambiguity, or because the object cannot be found.
The purpose of this page is to distinguish between the different cases and offer an action plan to remedy them.
There are different variants of this message :
Can not resolve 'XXX' as type in package 'aaa.bbb.ccc' from package 'www.yyy.zzz'
Can not resolve 'XXX' as type in class 'aaa.bbb.ccc' from class 'www.yyy.zzz.TTTT'
Can not resolve 'XXX' as type in method 'aaa.bbb.ccc(ddd.eeee.fff, ggg.hhh.i)' from method 'jjj.kkkk.lll(mmm.nnn.ooo, ppp.qqq.rrr)'
Release | Yes/No |
---|---|
8.3.x | |
8.2.x | |
8.1.x | |
8.0.x | |
7.3.x |
RDBMS | Yes/No |
---|---|
Oracle Server | |
Microsoft SQL Server | |
CSS3 | |
CSS2 |
Below is the step-by-step scenario leading to the problem:
- Package and deliver the application.
- Set as current version.
- Run the analysis.
- Check the analysis log file.
- Warnings beginning with "Unable to resolve ..." are generated.
The impact of the problem on the analysis or the dashboard is: missing links.
- Check if the unresolved object is present in the Knowledge Base
Check if from the warning message you can find the canonical name of the unresolved class as shown below : in both cases, the canonical name of the unresolved class is : aaa.bbb.ccc.XXX
Canonical namecan not resolve 'XXX' as type in package 'aaa.bbb.ccc' from package 'www.yyy.zzz'
can not resolve 'XXX' as type in class 'aaa.bbb.ccc' from class 'www.yyy.zzz'
If yes, use the following query on table objfulnam as shown below.
Is unresolved object present in KB (first case)SELECT idobj FROM objfulnam WHERE fullname = 'aaa.bbb.ccc.XXX'
If this query gives a result, then the object is present in KB and the result is its ID. If it is present, then proceed to Identify the analysis units of the calling object and the unresolved object. If it is not present, then proceed to Look for the object in the source code
If the warning message does not allow you to find out the canonical name of the unresolved class,use the simple name (XXX) as shown in the below example
Example: in the third case, the canonical name of the unresolved object cannot be found : just use the simple name (XXX)
can not resolve 'XXX' as type in method 'aaa.bbb.ccc(ddd.eeee.fff, ggg.hhh.i)' from method 'jjj.kkkk.lll(mmm.nnn.ooo, ppp.qqq.rrr)'
If the warning message does not allow you to find out the canonical name use the following query on the table keys
Is unresolved object present in KB (second case)SELECT idkey FROM keys WHERE keynam = 'XXX' AND objtyp IN ( 100, 104 )
If this query gives a result, then the object is present in KB and the result is its ID. If it is present, then proceed to Identify the analysis units of the calling object and the unresolved object. If it is not present, then proceed to Look for the object in the source code
Identify the analysis units of the calling object and the unresolved object
- Find-out the ID of the calling object in local base :
First case : the warning message is : can not resolve 'XXX' as type in package 'aaa.bbb.ccc' from package 'www.yyy.zzz'
The calling object is a Java package, use the below queryFind-out the ID of the calling Java packageSELECT k.idkey FROM objfulnam ofn JOIN keys k ON k.idkey = ofn.idobj WHERE k.objtyp = 99 AND fullname = 'www.yyy.zzz'
Second case : the warning message is : can not resolve 'XXX' as type in class 'aaa.bbb.ccc' from class 'www.yyy.zzz.TTTT'
The calling object is a Java Class, use the below query :Find-out the ID of the calling Java ClassSELECT k.idkey FROM objfulnam ofn JOIN keys k ON k.idkey = ofn.idobj WHERE k.objtyp = 100 AND fullname = 'www.yyy.zzz.TTTT'
Third case : the warning message is :can not resolve 'XXX' as type in method 'aaa.bbb.ccc(ddd.eeee.fff, ggg.hhh.i)' from method 'jjj.kkkk.lll(mmm.nnn.ooo, ppp.qqq.rrr)''
The calling object is a Java Method, use the below query :Find-out the ID of the calling Java MethodSELECT k.idkey FROM objfulnam ofn JOIN keys k ON k.idkey = ofn.idobj WHERE k.objtyp = 102 AND fullname = 'jjj.kkkk.lll'
- Identify the analysis units of the calling object and the unresolved object :
If the version of CAST AIP is 8.2.3 or newer, then use the following query (it implies both Management Base and Local Base)
Find-out analysis units (CAST AIP Version >= 8.2.3)SELECT DISTINCT pso.object_id, cja.object_id, cja.object_name FROM <MNGT>.cms_j2ee_analysis cja JOIN <MNGT>.cms_dynamicfields cdf ON cdf.object_id = cja.object_id JOIN <LOCAL>.pmc_subsets ps ON ps.subset_name = 'CMS_AU_FULL__' || cdf.field_value AND cdf.field_guid='entry' JOIN <LOCAL>.pmc_subset_objects pso ON pso.subset_id = ps.subset_id WHERE pso.object_id IN (<CALLING_OBJECT_ID>, <UNRESOLVED_OBJECT_ID)
If the version of Cast AIP is older than 8.2.3, use the following query instead :
Find-out the analysis units (CAST AIP Version < 8.2.3)SELECT DISTINCT pso.object_id, cja.object_id, cja.object_name FROM <MNGT>.cms_j2ee_analysis cja JOIN <LOCAL>.pmc_subsets ps ON ps.subset_name = 'CMS_AU_FULL__' || cja.object_id AND cdf.field_guid='entry' JOIN <LOCAL>.pmc_subset_objects pso ON pso.subset_id = ps.subset_id WHERE pso.object_id IN (<CALLING_OBJECT_ID>, <UNRESOLVED_OBJECT_ID)
At this step, you know the analysis unit of the calling object, and the analysis unit of the unresolved object. If both analysis units are the same, then contact CAST Technical Support and provide the Relevant Input to help CAST Technical Support team investigate and solve your problem. Else, proceed to Remedy the missing dependency
- Find-out the ID of the calling object in local base :
Remedy the missing dependency
In CAST-MS, add a dependency from the analysis unit of the calling object (source of the dependency) to the analysis unit of the unresolved object (target of the dependency) and relaunch analysis. If there already was such a dependency configured in CAST-MS, or if adding it and relaunching analysis did not make the warning disappear, then contact CAST Technical Support and provide the Relevant Input to help CAST Technical Support team investigate and solve your problemNB : If you have many warnings, you may want to use a Support Tool called dependency_injector, in order to add the missing dependencies automatically
If you have discovered your source code using the Maven discoverer, then you could also use script MAINT_CompleteMavenDependencies.sqltxtin order to add Maven transitive dependencies.
- Close CAST Management Studio
- Run the Script in PGAdmin, on the Management base (do a set search_path to Management_DB)
- Run the function select MAINT_CompleteMavenDependencies(); (The optimized MAINT_CompleteMavenDependencies() function is defined in the attached SQL Script)
- Open CAST Management Studio, check the dependencies,
Run analysis
Look for the object name in the source code, If unresolved object is not present in the KB,search using Notepad++ with option "Search in Files" in *.java files on the unresolved object name.
If you find the object in the source code, then Check the analysis log file for syntax errors related to the file containing the unresolved object. If you do not find the object in the source code then Check the classpath configuration.- Check the analysis log file for syntax errors related to the file containing the unresolved object. If there is one, then this is the root cause of the issue : the file was not completely parsed, so the object was not created. You must solve the Syntax error first. Refer to CMS Snapshot Analysis - Run Analyzer - Warnings - JEE with Core CAST AIP - JSP - Syntax not Recognized. If there is no syntax error when parsing the file containing the unresolved object, then contact CAST Technical Support and provide the Relevant Input to help CAST Technical Support team investigate and solve your problem.
- Check the classpath configuration
Since the unresolved object is not present in Knowledge Base, and you did not find the object in the *.java files from the source code, it is likely to be present in the jar files delivered with the source.- If you have some knowledge of the unresolved object, and recognize which API it is part of (example : JmsQueueSender is part of the JMS framework)., then you can directly look for the appropriate jar file (in this example, jms-x.y.z.jar).
- Look for the jar in the deploy folder. If you do not find it, then contact development team for missing source code.
- If you find it, then in CAST-MS, open the analysis unit containing the calling object and check in Analysis tab that the folder containing the jar is included in the classpath configuration. Either directly included as a classpath entry, or included by recursive (if a parent folder is present with the "Recursive" checkbox checked)
- If it is not the case, add it to the classpath configuration and relaunch analysis. If issue persists, then contact CAST Technical Support and provide the Relevant Input to help CAST Technical Support team investigate and solve your problem.
- If you do not know which jar file could contain the unresolved object, use a global approach. First check that all the jar files delivered are included in the classpath configuration.
- Do a Windows Search on *.jar in the deploy folder. It will give you all the folders that contain jar files.
- In CAST-MS, open the analysis unit containing the calling object and check in Analysis tab that each of these folders are included in the classpath configuration, either directly included as a classpath entry, or included by recursive (if a parent folder is present with the "Recursive" checkbox checked).
- If it is not the case, add the missing jar folders to the classpath configuration.
- Now check that all the classpath folder entries configured in CAST-MS exist and are not empty. For this you can use a Support Tool called classpath_checker. If you find that some of these entries do not exist or do not contain jar files, then there probably is a problem with the source code. Check with development team if every jar file was delivered.
- If the classpath configuration is correct, then you need to contact development team and ensure that you have all the source code. If they say you have all the source then contact CAST Technical Support and provide the Relevant Input to help CAST Technical Support team investigate and solve your problem.
- If you have some knowledge of the unresolved object, and recognize which API it is part of (example : JmsQueueSender is part of the JMS framework)., then you can directly look for the appropriate jar file (in this example, jms-x.y.z.jar).