Closed kmalik4 closed 7 years ago
Hi @kmalik4,
I see two potential solutions for your problem and I'd try to solve them in this order:
First, please check if the new version of plugin works fine. You would require to install Java Plugin in version 4.10.0.10260, then AEM Rules plugin in version 0.9. It can be downloaded from here: https://github.com/Cognifide/AEM-Rules-for-SonarQube/releases/tag/v0.9 - it's not yet available in Update Center.
Second, if the issue still occurs, you should turn off AEM-7 rule because it's clearly the one causing the problem. But before making that, I'd require from you a code sample that actually causes AEM-7 rule to crash. The issue hasn't been reported yet and it is impossible to tell from the stacktrace.
SonarQube is unable to analyze file : ??
I'm guessing you've obfuscated the stacktrace. Anyway, without this file I won't be able to provide a fix and therefore you would have to turn off this particular rule for this project.
Update: AEM Rules plugin should be available through Update Center.
@kmalik4 please let me know if I can close this issue.
Closing due to thread inactivity.
Hi,
If I analyze my project with default java profile "Sonar Way" it runs fine. But If I activate AEM rules in "Sonar way + AEM" profile and analyze project against it then gives me below error ... 01:04:24 [INFO] Source paths: pom.xml, src/main/java 01:04:24 [INFO] Test paths: src/test/java 01:04:24 [INFO] Binary dirs: target/classes 01:04:24 [INFO] Source encoding: windows-1252, default locale: en_US 01:04:24 [INFO] Index files 01:04:25 [INFO] 171 files indexed 01:04:25 [INFO] Quality profile for java: Sonar way + AEM 01:04:25 [INFO] Sensor Lines Sensor 01:04:25 [INFO] Sensor Lines Sensor (done) | time=27ms 01:04:25 [INFO] Sensor JavaSquidSensor 01:04:25 [INFO] Configured Java source version (sonar.java.source): 7 01:04:25 [INFO] JavaClasspath initialization 01:04:25 [INFO] JavaClasspath initialization (done) | time=1ms 01:04:25 [INFO] JavaTestClasspath initialization 01:04:25 [INFO] JavaTestClasspath initialization (done) | time=1ms 01:04:25 [INFO] Java Main Files AST scan 01:04:25 [INFO] 165 source files to be analyzed 01:04:38 [INFO] BUILD FAILURE 01:04:38 [INFO] ------------------------------------------------------------------------ 01:04:38 [INFO] Total time: 03:33 min 01:04:38 [INFO] Finished at: 2017-06-16T01:04:38-04:00 01:04:38 [INFO] Final Memory: 83M/828M 01:04:38 [INFO] ------------------------------------------------------------------------ 01:04:38 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project redesign: SonarQube is unable to analyze file : org.sonar.java.model.expression.MemberSelectExpressionTreeImpl cannot be cast to org.sonar.plugins.java.api.tree.IdentifierTree -> [Help 1] 01:04:38 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project redesign: SonarQube is unable to analyze file : 01:04:38 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) 01:04:38 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 01:04:38 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 01:04:38 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 01:04:38 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 01:04:38 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 01:04:38 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) 01:04:38 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) 01:04:38 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) 01:04:38 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582) 01:04:38 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) 01:04:38 at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) 01:04:38 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 01:04:38 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 01:04:38 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 01:04:38 at java.lang.reflect.Method.invoke(Method.java:497) 01:04:38 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 01:04:38 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 01:04:38 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 01:04:38 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 01:04:38 Caused by: org.apache.maven.plugin.MojoExecutionException: SonarQube is unable to analyze file : 01:04:38 at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36) 01:04:38 at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:81) 01:04:38 at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:122) 01:04:38 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) 01:04:38 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 01:04:38 ... 19 more 01:04:38 Caused by: org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : 01:04:38 at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:96) 01:04:38 at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:63) 01:04:38 at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:119) 01:04:38 at org.sonar.java.JavaSquid.scan(JavaSquid.java:113) 01:04:38 at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:84) 01:04:38 at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57) 01:04:38 at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) 01:04:38 at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) 01:04:38 at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83) 01:04:38 at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192) 01:04:38 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) 01:04:38 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) 01:04:38 at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) 01:04:38 at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) 01:04:38 at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234) 01:04:38 at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) 01:04:38 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) 01:04:38 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) 01:04:38 at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47) 01:04:38 at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) 01:04:38 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) 01:04:38 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) 01:04:38 at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106) 01:04:38 at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119) 01:04:38 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62) 01:04:38 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 01:04:38 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 01:04:38 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 01:04:38 at java.lang.reflect.Method.invoke(Method.java:497) 01:04:38 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) 01:04:38 at com.sun.proxy.$Proxy21.execute(Unknown Source) 01:04:38 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233) 01:04:38 at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) 01:04:38 at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:78) 01:04:38 ... 22 more 01:04:38 Caused by: java.lang.ClassCastException: org.sonar.java.model.expression.MemberSelectExpressionTreeImpl cannot be cast to org.sonar.plugins.java.api.tree.IdentifierTree 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor.getMethodTree(FindSessionDeclarationVisitor.java:93) 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor.access$500(FindSessionDeclarationVisitor.java:41) 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor$CheckIfSessionCreatedManually.visitAssignmentExpression(FindSessionDeclarationVisitor.java:159) 01:04:38 at org.sonar.java.model.expression.AssignmentExpressionTreeImpl.accept(AssignmentExpressionTreeImpl.java:71) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitExpressionStatement(BaseTreeVisitor.java:101) 01:04:38 at org.sonar.java.model.statement.ExpressionStatementTreeImpl.accept(ExpressionStatementTreeImpl.java:65) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBlock(BaseTreeVisitor.java:85) 01:04:38 at org.sonar.java.model.statement.BlockTreeImpl.accept(BlockTreeImpl.java:77) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitIfStatement(BaseTreeVisitor.java:107) 01:04:38 at org.sonar.java.model.statement.IfStatementTreeImpl.accept(IfStatementTreeImpl.java:124) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBlock(BaseTreeVisitor.java:85) 01:04:38 at org.sonar.java.model.statement.BlockTreeImpl.accept(BlockTreeImpl.java:77) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitMethod(BaseTreeVisitor.java:80) 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor$CheckIfSessionCreatedManually.visitMethod(FindSessionDeclarationVisitor.java:148) 01:04:38 at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl.java:218) 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor.isManuallyCreatedSession(FindSessionDeclarationVisitor.java:88) 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor.findSessionsCreatedInMethods(FindSessionDeclarationVisitor.java:73) 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor.visitAssignmentExpression(FindSessionDeclarationVisitor.java:65) 01:04:38 at org.sonar.java.model.expression.AssignmentExpressionTreeImpl.accept(AssignmentExpressionTreeImpl.java:71) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitExpressionStatement(BaseTreeVisitor.java:101) 01:04:38 at org.sonar.java.model.statement.ExpressionStatementTreeImpl.accept(ExpressionStatementTreeImpl.java:65) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBlock(BaseTreeVisitor.java:85) 01:04:38 at org.sonar.java.model.statement.BlockTreeImpl.accept(BlockTreeImpl.java:77) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitIfStatement(BaseTreeVisitor.java:107) 01:04:38 at org.sonar.java.model.statement.IfStatementTreeImpl.accept(IfStatementTreeImpl.java:124) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBlock(BaseTreeVisitor.java:85) 01:04:38 at org.sonar.java.model.statement.BlockTreeImpl.accept(BlockTreeImpl.java:77) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at com.cognifide.aemrules.checks.visitors.FindSessionDeclarationVisitor.visitTryStatement(FindSessionDeclarationVisitor.java:132) 01:04:38 at org.sonar.java.model.statement.TryStatementTreeImpl.accept(TryStatementTreeImpl.java:171) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBlock(BaseTreeVisitor.java:85) 01:04:38 at org.sonar.java.model.statement.BlockTreeImpl.accept(BlockTreeImpl.java:77) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitMethod(BaseTreeVisitor.java:80) 01:04:38 at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl.java:218) 01:04:38 at com.cognifide.aemrules.checks.SessionShouldBeLoggedOut.findSessionsInMethod(SessionShouldBeLoggedOut.java:81) 01:04:38 at com.cognifide.aemrules.checks.SessionShouldBeLoggedOut.visitMethod(SessionShouldBeLoggedOut.java:61) 01:04:38 at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl.java:218) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitClass(BaseTreeVisitor.java:69) 01:04:38 at org.sonar.java.model.declaration.ClassTreeImpl.accept(ClassTreeImpl.java:194) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitCompilationUnit(BaseTreeVisitor.java:55) 01:04:38 at org.sonar.java.model.JavaTree$CompilationUnitTreeImpl.accept(JavaTree.java:184) 01:04:38 at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) 01:04:38 at com.cognifide.aemrules.checks.SessionShouldBeLoggedOut.scanFile(SessionShouldBeLoggedOut.java:56) 01:04:38 at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:115) 01:04:38 at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:87) 01:04:38 ... 55 more 01:04:38 [ERROR] 01:04:38 [ERROR] Re-run Maven using the -X switch to enable full debug logging. 01:04:38 [ERROR] 01:04:38 [ERROR] For more information about the errors and possible solutions, please read the following articles: 01:04:38 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 01:04:38 Sonar analysis completed: FAILURE
Can you please help me to figure out solution for this. I am using SonarQube 5.6.6, SonarJava 4.9 & AEM rules plugin 0.8.