[Soot-list] soot.AbstractSootFieldRef$FieldResolutionFailedException

Asif Iqbal iqbala24 at mcmaster.ca
Tue Oct 19 11:13:29 EDT 2010


Hi Eric,

I am trying to generate XML output of a bunch of class files using  
soot. I am just using your JAnalyzer as a sample source of bunch of  
class files.
By the way, now I am sure that the cause I mentioned is the previous  
email is indeed the cause of the problem. Because as a test, I  
manually excluded soot 2.4.0 from my soot's class path (but kept in  
Java's classpath) and then ran my program and it worked. But what I  
want to know is that is there any way by which I can separate Java's  
and soot's classpath in a well organized way , rather than manually  
excluding like what I have done ?
Can you write me a sample example ?

Asif

On 19-Oct-10, at 2:51 AM, Eric Bodden wrote:

> Hi Asif.
>
> Yes, there is a good chance that this is the cause of the problem. To
> separate classpaths, you need to load the one part of the code in a
> separate classloader (a URLClassLoader, for instance). But what
> exactly are you trying to achieve on a high level? Maybe there's an
> easier way to help you out...
>
> Eric
>
>
> --
> Dr. Eric Bodden
> Software Technology Group, Technische Universität Darmstadt, Germany
> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>
>
>
> On 18 October 2010 20:39, Asif Iqbal <iqbala24 at mcmaster.ca> wrote:
>> Hi Eric,
>> I think I have found the cause but not the solution. Since your  
>> JAnalyzer
>> uses sootclasses 1.2.5_modified, there are 2 soot.Main() classes in  
>> my
>> classpath, the other one being from sootclasses 2.4.0. So during the
>> analysis of TypeResolver class, it looks for some extra fields in
>> soot.Main(). But those extra fileds are not in 2.4.0 version. I  
>> guess they
>> were in the 1.2.5 modified version. So I think I need some way to  
>> separate
>> Java's classpath and Soot's classpath in my application program,  
>> just like
>> we do in command line. That way my application will use the 2.4.0  
>> version
>> but the analysis of TypeResolver will look for ssot.Main() in the  
>> 1.2.5
>> modified version. But I don't know how to do it. Can you suggest  
>> any way to
>> separate Java's and Soot's classpath from my application ?
>> Asif
>> On 18-Oct-10, at 12:21 PM, Asif Iqbal wrote:
>>
>> Hi Eric,
>> I have tried what you suggested but that doesn't work. It throws  
>> the same
>> exception. By the way I should let you know that my code (that I  
>> sent in the
>> previous email) worked for most other classes but it is generating  
>> the
>> exception only for a few classes. In fact I was running soot on your
>> JAnalyzer class files. Of all the class files, only  
>> analysis.TypeResolver
>> and system.Main threw this exception. For all other class files,  
>> the xml was
>> generated successfully. I still don't know what's going wrong with  
>> these
>> class files.
>> Asif
>> On 18-Oct-10, at 6:50 AM, Eric Bodden wrote:
>>
>> Hi Asif.
>>
>> I think the problem may be that your call to main(..) overrides your
>> settings for the sootclasspath. Could you try just adding the -cp
>> <classpath> argument to the args1 array as you do for the other
>> arguments?
>>
>> Eric
>>
>>
>> --
>> Dr. Eric Bodden
>> Software Technology Group, Technische Universität Darmstadt, Germany
>> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
>> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>>
>>
>>
>> On 15 October 2010 19:11, Asif Iqbal <iqbala24 at mcmaster.ca> wrote:
>>
>> Hi all,
>>
>> I am trying to generate an XML file for a class using both command  
>> line and
>>
>> by calling Soot's Main.main() from inside my own Java application.  
>> The
>>
>> command line works fine but calling main() from my application  
>> raises the
>>
>> following exception:
>>
>> Exception in thread "main"
>>
>> soot.AbstractSootFieldRef$FieldResolutionFailedException: Class  
>> soot.Main
>>
>> doesn't have field keepLineNumberAttribute : boolean; failed to  
>> resolve in
>>
>> superclasses and interfacesLooking in soot.Main which has fields
>>
>> [<soot.Main: java.lang.String versionString>, <soot.Main:  
>> java.util.Date
>>
>> start>, <soot.Main: java.util.Date finish>, <soot.Main:  
>> java.lang.String[]
>>
>> cmdLineArgs>]
>>
>> Looking in java.lang.Object which has fields []
>>
>> I have no idea what this means. I have added the same paths to
>>
>> Scene.v().setSootClasspath() as I have done in the command line.  
>> But what's
>>
>> going wrong here ?
>>
>> Below is my command line which works fine:
>>
>> java -Xmx800m -cp
>>
>> sootclasses 
>> -2.4.0.jar:jasminclasses-2.4.0.jar:polyglotclasses-1.3.5.jar
>>
>> soot.Main -cp
>>
>> .:/Users/asifiqbal/Downloads/soylatte/jre/lib/rt.jar:/Users/ 
>> asifiqbal/Downloads/soylatte/jre/lib/jce.jar:swing- 
>> layout.jar:jh.jar:tools.jar:xerces.jar:log4j.jar:log4j- 
>> core.jar:sootclasses-1.2.5- 
>> modified.jar:janalyzer_onlinehelp.jar:swing-layout.jar:./janalyzer
>>
>> -f X analysis.TypeResolver
>>
>> And below is the code snippet which raises that exception:
>>
>> .....
>>
>> Scene.v().setSootClassPath(Scene.v().getSootClassPath() +
>>
>>                 "sootclasses-2.4.0.jar:" +
>>
>>                 "jasminclasses-2.4.0.jar:" +
>>
>>                 "polygotclasses-1.3.5.jar:" +
>>
>>                 ":.:" +
>>
>>                  "/Users/asifiqbal/Downloads/soylatte/jre/lib/ 
>> rt.jar:" +
>>
>>  "/Users/asifiqbal/Downloads/soylatte/jre/lib/jce.jar:" +
>>
>>                  "swing-layout.jar:" +
>>
>>                  "jh.jar:" +
>>
>>                  "tools.jar:" +
>>
>>                  "xerces.jar:" +
>>
>>                  "log4j.jar:" +
>>
>>                  "log4j-core.jar:" +
>>
>>                  "sootclasses-1.2.5-modified.jar:" +
>>
>>                  "janalyzer_onlinehelp.jar:" +
>>
>>                  "swing-layout.jar:" +
>>
>>                  "./janalyzer");
>>
>>         String[] args1 = {"-f", "X", "analysis.TypeResolver"};
>>
>>         Main.main(args1);
>>
>> .....
>>
>> Any help would be greatly appreciated.
>>
>> Asif
>>
>> _______________________________________________
>>
>> Soot-list mailing list
>>
>> Soot-list at sable.mcgill.ca
>>
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>>
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>>



More information about the Soot-list mailing list