Description

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 the different cases and offer an action plan to remedy them.

There are different variants of this message :

Analysis log file
JAVA124: Cannot resolve 'XXX' as type in package 'aaa.bbb.ccc' from package 'www.yyy.zzz' ...<Source Path reference>
JAVA124: Cannot resolve 'XXX' as type in class 'aaa.bbb.ccc' from class 'www.yyy.zzz.TTTT'  ...<Source Path reference>
JAVA124: Cannot 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)' ...<Source Path reference>
Observed in CAST Extension

Release

Yes/No

JEE 1.3.x(tick)
JEE 1.2.x(tick)
JEE 1.1.x(tick)
JEE 1.0.x(tick)
Observed on RDBMS
RDBMS
Yes/No
CSS4(tick)
CSS3(tick)
CSS2(tick)
Step by Step Scenario

Below is the step-by-step scenario leading to the problem:

  1. Package and deliver the application.
  2. Set as current version.
  3. Run the analysis.
  4. Check the analysis log file.
  5. Warnings beginning with "Unable to resolve ..." are generated.
Impact of the Problem

The impact of the problem on the analysis or the dashboard is: missing links and missing violations

Action Plan
  1. Check if the unresolved reference is present in source code
    1. Find where the reference should be resolved from. The reference can be present in a .java file that is part of the application source code  or a .class file that is found inside a .jar that is included in the classpath configuration.

      1. From the warning message retrieve the reference which is unresolved and the file from which it is unresolved. In our example this is  'XXX' and <Source Path reference> respectively

        Canonical name

        can not resolve 'XXX' as type in package 'aaa.bbb.ccc' from package 'www.yyy.zzz'  ...<Source Path reference>

        can not resolve 'XXX' as type in class 'aaa.bbb.ccc' from class 'www.yyy.zzz' ...<Source Path reference>
        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)' ...<Source Path reference>
      2. Open the source code of the file   <Source Path reference> and search for reference XXX. From the source code and the import statements you may be able to understand the class from which the reference should be found. Example;

        Canonical name
        can not resolve 'SupportRequestType' as type in class 'Toto'  ...<Source Path reference>

        import com.support.SupportRequestType;

        public class Toto {

        SupportRequestType sType = null;

        In the above case the class that is unresolved is com.support.SupportRequestType.

      3. Search in the analysis log for the Parsing information message that is relevant to to the class that you have found in previous step.

        1. If you find the Java source file that is relevant then the reference should have been resolved from this file.

        2. Else you can search using Notepad++ in the whole source code for the reference in order to find the .java file
  2. If you find the reference in existing source code
    1. Open Enlighten and check if the object has been created:
      1. If not then this is a missing object issue and you can redirect to CMS Snapshot Analysis - Run Analyzer - Missing objects
      2. Else if the object exists then contact CAST Technical Support and provide the Relevant Input to help CAST Technical Support team investigate and solve your problem. 
  3. If the reference is not found then analyzer may try to resolve it from a .jar file
    1. In order to search for a specific class inside a .jar file use a tool like https://github.com/javalite/jar-explorer to bulk search for the java class inside all the .jar files of the source code
      1. If you do not find the missing class then:
        1. If you have used Maven discoverer and the .jar is referenced in a pom.xml then this may be an issue in extraction, please follow Delivery Manager Tool - Package - Extraction
        2. Else if there is no reference in any project file then this is expected behavior and you should inform the application team in order to provide the missing .jar file
      2. If you do find the missing class in the .jar files that are in the source cod. Validate that the reference (could be a method, annotation or member) is present in the .jar file. You can use a tool like http://java-decompiler.github.io/ to decompile the jar file.
        1. If the unresolved reference is missing then
          1. If you have used Maven discoverer and the version of the .jar is referenced in a pom.xml then this may be an issue in extraction, please follow Delivery Manager Tool - Package - Extraction
          2. Else if there is no reference in any project file then this is expected behavior and you should inform the application team in order to provide the missing .jar file
        2. Else if the reference is found then this may be due to .jar not being referenced in the classpath of the Analysis Unit of the .java file or there is no dependency from this Analysis Unit towards the analysis unit that is referring to the .jar in the classpath:
          1. Locate the Analysis Unit where the .java file belongs and check the classpath definition in Analysis tab
          2.  
          3. If the .jar is not referenced in he classpath then as a WA add the reference to the .jar
          4. Else search for any other Analysis Unit that references the .jar(info can be found in analysis log) and check if a dependency exists from the missing AU to the AU found in this step
            1. If the dependency exists then contact CAST Technical Support and provide the Relevant Input to help CAST Technical Support team investigate and solve your problem. 
            2. Else as a WA add dependency
  4. In all other cases contact CAST Technical Support and provide the Relevant Input  to help CAST Technical Support team investigate and solve your problem. 
Notes/comments

Related Pages