Ph03nIX
Ph03nIX

Reputation: 423

Error running Sonar SSLR Toolkit

I am trying to add a new rule for my Python project, so according to this source (Adding Coding Rules using XPath), I was trying to run sslr-python-toolkit-1.9.1.2080.jar from command line to view AST of a given piece of code but it exited with the following error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/sonar/sslr/toolkit/ConfigurationModel
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.sonar.sslr.toolkit.ConfigurationModel
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

Am I missing something? How could I make it work? I'm quite new in SonarQube arena, so please excuse my naivety and help me to solve the issue. Thanks!

Upvotes: 2

Views: 361

Answers (1)

Pierre-Yves
Pierre-Yves

Reputation: 1546

That's a serious bug indeed. I just logged an issue so that it get fixed in the next version. Thanks for reporting it!

As a workaround, you may use an older version of the SSLR Toolkit which seems to work. It's based on an older version of the parser, so it could give different results in some cases.

Upvotes: 2

Related Questions