Today I tried to run examples of WALA, and I found and tackled some problems that you might find also. I made this post to help me remember how I solve those problem. :).
For a complete configuration manual you can refer to this WALA wiki. Here are the problem list:
1. The import org.eclipse.pde.internal.core.PDEStateHelper cannot be resolved
I use the latest Eclipse version (Luna) when this post written. This problem happens when I tried to build the com.ibm.wala.ide project. There is EclipseProjectPath.java that you can find in com.ibm.wala.ide.util package, needs to import the org.eclipse.pde.internal.core.PDEStateHelper.
So to resolve this problem I downloaded the org.eclipse.pde.core_3.3.jar that contain the org.eclipse.pde.internal.core.PDEStateHelper class. And add that file to my java build path libraries. You can do that by right click you project, and then from the context menu you choose:
"Build Path -> Configure Build Path...". It will open the project Java Build Path configuration dialog. After that you can open "Libraries" tab and then click "Add External JARs", it will open file browser and select you org.eclipse.pde.core_3.3.jar. Close your Java Build Path configuration dialog by clicking on "OK" button. Then try to build your project once again. Viola! I hope your error will vanish just like what I did.
2. Problem when trying to run example 1 (the SWTTypeHierarchy)
When you are trying to run example 1, SWTTypeHierarchy that you can find in com.ibm.wala.core.tests, probably you could get this error:
"{resource_loc:/com.ibm.wala.core.testdata/JLex.jar} "
or
"com.ibm.wala.util.debug.UnimplementedError: java.io.FileNotFoundException"
This problem happen because the SWTTypeHierarchy expecting the JLex.jar to be found at com.ibm.wala.core.testdata directory. So what you need to do is put your JLex.jar file in the root of com.ibm.wala.core.testdata project root directory. After doing this step you will able to run the example 1 correctly. If successful, you should see a new window pop up with a tree view of the class hierarchy of JLex.
3. Problem when trying to run example 2 (the PDFTypeHierarchy)
When you are trying to run example 2, probably you're going to have several problems. First problem is the wala.properties configuration file. This configuration file contain path configuration of your java runtime directory "java_runtime_dir" and "output" directory. If you haven't yet created the wala.properties file you'll get this message:
"com.ibm.wala.util.WalaException: Unable to set up wala properties "
To solve that you need to create the wala.properties file in com.ibm.wala.core project dat directory. You can copy or rename the wala.properties.sample (that exist in the dat directory) into wala.properties. After that try to run the example once more and you'll get another error (sorry guys).
"java.io.IOException: property_file_unreadable wala.examples.properties"
To solve that you need to configure another file, the wala.examples.properties. This file contain executable path configuration of your pdf viewer and graphviz (you can install in Linux by using apt-get install graphviz). You need to create wala.example.properties in com.ibm.wala.core.tests project and put them in the dat directory. You can copy or rename the wala.example.properties.sample (that exisst in the dat directory) into wala.examples.properties. And then try to run once more your project. If there is another error please stay put with me. :).
If you get these exceptions:
1. Exception in thread "main" com.ibm.wala.util.debug.UnimplementedError
Probably you didn't set the java runtime directory correctly in your wala.properties file. You must direct your path to the java jre library path. In case of my environment it should be like this:
"/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/"
2. spawning process [null, -Tpdf, -o, com.ibm.wala.core/results/cg.pdf, -v, com.ibm.wala.core.tests/temp.dt]Exception in thread "main"
java.lang.NullPointerException
Probably you haven't set your an output directory in your wala.properties file. Make sure to create the directory because WALA won't create it for you.
Please make sure you're checking your wala.properties and wala.examples.properties configuration files first. Make sure all properties are set correctly such as the java, output, dot_exe, and pdfview_exe paths. If all correctly configured you'll see the a PDF file representing the type hierarchy.
Hope this post will help you. If you find another problem or you find this post help your problem, please leave a comment below. See you in my next post.
No comments:
Post a Comment