Eclipse - Invalid classpath container: 'TestNG' in project and JUnit failed - java

I'm using Eclipse 4.9, I tried to update new TestNG upgrade(7)
It failed so I rollback to previous version and now I have an issue
'Invalid classpath container: 'TestNG' in project
I can't fix it by
clean project (maven can't be execute due to NullpointerException below errors)
Reinstall TestNG
Remove and add TestNG library
I didn't find relevant answers for this issue
Error log:
java.lang.NullPointerException
at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:367)
at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:412)
at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:384)
at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:305)
at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processJavaElementChanged(JavaReflectionSynchronizer.java:117)
at org.eclipse.jem.workbench.utility.JavaModelListener.processDelta(JavaModelListener.java:116)
at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processDelta(JavaReflectionSynchronizer.java:343)
at org.eclipse.jem.workbench.utility.JavaModelListener.processChildren(JavaModelListener.java:78)
at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processChildren(JavaReflectionSynchronizer.java:336)
at org.eclipse.jem.workbench.utility.JavaModelListener.processJavaElementChanged(JavaModelListener.java:176)
at org.eclipse.jem.workbench.utility.JavaModelListener.processDelta(JavaModelListener.java:113)
at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processDelta(JavaReflectionSynchronizer.java:343)
at org.eclipse.jem.workbench.utility.JavaModelListener.elementChanged(JavaModelListener.java:63)
at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.elementChanged(JavaReflectionSynchronizer.java:265)
at org.eclipse.jdt.internal.core.DeltaProcessor$3.run(DeltaProcessor.java:1738)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.internal.core.DeltaProcessor.notifyListeners(DeltaProcessor.java:1726)
at org.eclipse.jdt.internal.core.DeltaProcessor.firePostChangeDelta(DeltaProcessor.java:1559)
at org.eclipse.jdt.internal.core.DeltaProcessor.fire(DeltaProcessor.java:1535)
at org.eclipse.jdt.internal.core.DeltaProcessor.notifyAndFire(DeltaProcessor.java:2256)
at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(DeltaProcessor.java:2146)
at org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:477)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:300)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:290)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:153)
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:379)
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1502)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:160)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
EDIT 1
Actually I failed to execute JUnit also
java.lang.NullPointerException
at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3037)
at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3049)
at org.eclipse.jdt.launching.JavaRuntime.gatherJavaLibraryPathEntries(Ja
vaRuntime.java:3000)
at org.eclipse.jdt.launching.JavaRuntime.computeJavaLibraryPath(JavaRunt
ime.java:2958)
at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
JavaLibraryPath(AbstractJavaLaunchConfigurationDelegate.java:1081)
at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
VMArguments(AbstractJavaLaunchConfigurationDelegate.java:598)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.colle
ctExecutionArguments(JUnitLaunchConfigurationDelegate.java:376)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getVM
RunnerConfiguration(JUnitLaunchConfigurationDelegate.java:185)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launc
h(JUnitLaunchConfigurationDelegate.java:255)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:862)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:720)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlu
gin.java:1029)
at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:
1243)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
java.lang.NullPointerException
at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3037)
at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3049)
at org.eclipse.jdt.launching.JavaRuntime.gatherJavaLibraryPathEntries(Ja
vaRuntime.java:3000)
at org.eclipse.jdt.launching.JavaRuntime.computeJavaLibraryPath(JavaRunt
ime.java:2958)
at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
JavaLibraryPath(AbstractJavaLaunchConfigurationDelegate.java:1081)
at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
VMArguments(AbstractJavaLaunchConfigurationDelegate.java:598)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.colle
ctExecutionArguments(JUnitLaunchConfigurationDelegate.java:376)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getVM
RunnerConfiguration(JUnitLaunchConfigurationDelegate.java:185)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launc
h(JUnitLaunchConfigurationDelegate.java:255)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:862)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:720)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlu
gin.java:1029)
at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:
1243)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
EDIT 2
Eclipse 4.10 doesn't support TestNG plugin to needed to downgrade to Eclipse Neon
TestNG is only available only for version till (4.9)2018-09 , you hv not made plug in for 2018-12.that's why it is not showing in marketplace

the recent release supports Eclipse Photon 2018-12:
https://github.com/cbeust/testng-eclipse/releases/tag/6.14.3.201902250526
please raise ticket on github if you still meet issue.

I had to manually (not using marketplace) TestNG version from http://beust.com/eclipse/
Notice there's warning about You are installing software that contains unsigned content

Related

Eclipse throwing Exception on code completition

My eclipse shows the following error message if I press "CTRL + SPACE"
The 'org.eclipse.jdt.ui.TemplateProposalComputer' proposal computer from the 'org.eclipse.jdt.ui' plug-in did not complete normally. The extension has thrown a runtime exception.
In the eclipse log I see the following Exception:
java.security.AccessControlException: access denied ("java.io.FilePermission" "/home/martin/Programme/eclipse/x64/edition_2021-03/configuration/org.eclipse.osgi/2969/0/.cp/icons/full/obj16/staged2465766773545443944.tmp" "write")
at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.base/java.security.AccessController.checkPermission(AccessController.java:897)
at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:322)
at java.base/java.lang.SecurityManager.checkWrite(SecurityManager.java:752)
at ro.sync.security.manager.SandboxSecurityManager.checkWrite(SandboxSecurityManager.java:188)
at java.base/java.io.File.createTempFile(File.java:2082)
at org.eclipse.osgi.storage.BundleInfo$Generation.storeContent(BundleInfo.java:384)
at org.eclipse.osgi.storage.bundlefile.CloseableBundleFile.getFile(CloseableBundleFile.java:223)
at org.eclipse.osgi.storage.bundlefile.ZipBundleEntry.getFileURL(ZipBundleEntry.java:107)
at org.eclipse.osgi.storage.url.BundleURLConnection.getFileURL(BundleURLConnection.java:139)
at org.eclipse.osgi.storage.url.BundleURLConverter.toFileURL(BundleURLConverter.java:38)
at org.eclipse.core.runtime.FileLocator.toFileURL(FileLocator.java:261)
at org.eclipse.jface.resource.URLImageDescriptor.getFilePath(URLImageDescriptor.java:243)
at org.eclipse.jface.resource.URLImageDescriptor$URLImageFileNameProvider.getImagePath(URLImageDescriptor.java:58)
at org.eclipse.swt.internal.DPIUtil.validateAndGetImagePathAtZoom(DPIUtil.java:419)
at org.eclipse.swt.graphics.Image.<init>(Image.java:624)
at org.eclipse.jface.resource.URLImageDescriptor.createImage(URLImageDescriptor.java:274)
at org.eclipse.jface.resource.ImageDescriptor.createResource(ImageDescriptor.java:227)
at org.eclipse.jface.resource.DeviceResourceManager.allocate(DeviceResourceManager.java:55)
at org.eclipse.jface.resource.AbstractResourceManager.create(AbstractResourceManager.java:88)
at org.eclipse.jface.resource.ResourceManager.createImageWithDefault(ResourceManager.java:195)
at org.eclipse.jface.resource.ImageRegistry.get(ImageRegistry.java:206)
at org.eclipse.jdt.internal.ui.JavaPluginImages.get(JavaPluginImages.java:643)
at org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateEngine.getImage(TemplateEngine.java:196)
at org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateEngine.complete(TemplateEngine.java:160)
at org.eclipse.jdt.internal.ui.text.java.AbstractTemplateCompletionProposalComputer.computeCompletionProposals(AbstractTemplateCompletionProposalComputer.java:82)
at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:348)
at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:340)
at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:333)
at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:289)
at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$10(AsyncCompletionProposalPopup.java:352)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$9(AsyncCompletionProposalPopup.java:351)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
The mentioned directory /home/martin/Programme/eclipse/x64/edition_2021-03/configuration/org.eclipse.osgi/2969/0/.cp/icons/full/obj16/ exists and is writeable for my user. The outlined file do not exists. So what is the problem here?
I'm currently using eclipse 2021-09 RC1 but I remember I had this issue with the previous eclipse version too. If I disable "Template Proposals" in the content assist this message goes away. But this error can't be normal as this happens again if I reset the content assist to the default values. At least with the defaults Eclipse should always work as expected.
Download page for eclipse 2021-09 RC1 clearly states
Please note that this is a developer build which might contain issues.
It might well be a bug on the development version. RC means Release Candidate.
Suggestions:
Use an stable release to reproduce the issue
Contribute a bug report for that version.
As a test/workaround, try disabling SWT template proposal
#howlger suggestion on reporting bugs:
Better report bugs that can be reproduced with a fresh installation of the latest releases candidate, milestone or even better the latest daily integration build than of the latest release.

How to fix crash on launch in Android Studio 4?

It happened when after I installed some intellij related plugins after importing a native opencv project https://github.com/leadrien/opencv_native_androidstudio/blob/master/app/src/main/cpp/native-lib.cpp.
On startup it throws in this error.
Internal error. Please refer to https://code.google.com/p/android/issues
java.lang.ExceptionInInitializerError
at com.a.a.b.a.p.a(p.java:182)
at com.a.a.b.b.ar.a(ar.java:348)
at com.a.a.b.b.ar.a(ar.java:172)
at com.a.a.b.b.ar.a(ar.java:71)
at com.intellij.idea.MainImpl.start(MainImpl.java:19)
at com.intellij.idea.StartupUtil.lambda$startApp$5(StartupUtil.java:248)
at com.intellij.util.ui.EdtInvocationManager.executeWithCustomManager(EdtInvocationManager.java:73)
at com.intellij.idea.StartupUtil.startApp(StartupUtil.java:243)
at com.intellij.idea.StartupUtil.prepareApp(StartupUtil.java:214)
at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:45)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at com.intellij.ui.scale.JBUIScale.lambda$static$0(JBUIScale.java:72)
at com.intellij.openapi.util.AtomicNotNullLazyValue$1.compute(AtomicNotNullLazyValue.java:59)
at com.intellij.openapi.util.AtomicNotNullLazyValue.getValue(AtomicNotNullLazyValue.java:37)
at com.intellij.ui.scale.JBUIScale.lambda$static$1(JBUIScale.java:152)
at com.intellij.util.LazyInitializer$MutableNotNullValue.initialize(LazyInitializer.java:113)
at com.intellij.util.LazyInitializer$NullableValue.get(LazyInitializer.java:41)
at com.intellij.util.LazyInitializer$MutableNotNullValue.get(LazyInitializer.java:102)
at com.intellij.ui.scale.JBUIScale.lambda$static$2(JBUIScale.java:170)
at com.intellij.util.LazyInitializer$MutableNotNullValue.initialize(LazyInitializer.java:113)
at com.intellij.util.LazyInitializer$NullableValue.get(LazyInitializer.java:41)
at com.intellij.util.LazyInitializer$MutableNotNullValue.get(LazyInitializer.java:102)
at com.intellij.ui.scale.JBUIScale.scale(JBUIScale.java:294)
at com.intellij.util.ui.JBInsets.create(JBInsets.java:41)
at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:457)
... 11 more
-----
JRE 1.8.0_242-release-1644-b3-6222593 amd64 by JetBrains s.r.o
/opt/android-studio/jre/jre
I solved this by delete three plugins under ~/.AndroidStudio4.0/config/plugins
idea-multimarkdown
markdown
Gauge-Java-Intellij
I solved it by deleting the latest plugins in ~/.AndroidStudio4.0/config/plugins/ Gauge-Java-Intellij and Markdown were causing issues in my case.
In my case, had problems with the markdown plugin.
I solved keeping the latest plugin in ~/.AndroidStudio4.0/config/plugins/ and removing the old version in .../android-studio-4.0.1/plugins/Kotlin/lib/markdown-0.1.25.jar.

JaCoCo report fails in Jenkins: java.lang.ArrayIndexOutOfBoundsException

I have been using JaCoCo locally with no problem.
When running a Jenkins job on a remote server, the job builds fine and generates JaCoCo coverage report (i.e. it appears in my workspace/report folder) but the build fails when attempting to publish the report on Jenkins.
I am using Jenkins 1.460 and JaCoCo 5.0.0.
I have configured Jenkins with:
Path to exec files: **/**.exec
Path to classes: **/dist/validation/WEB-INF/classes
Path to source: **/src (I have also tried **/Validation/src, and explicitly including **/**.class and excluding other file types)
Is this a configuration problem, or a compatibility error?
[EDIT: In case it helps anyone else, other forums say JaCoCo requires ASM 5.+ to manage Java 8 class analysis. I am already using ASM 5.0.1.]
BUILD SUCCESSFUL
Total time: 4 minutes 57 seconds
Archiving artifacts
Recording test results
[JaCoCo plugin] Collecting JaCoCo coverage data...
[JaCoCo plugin] **/**.exec;**/dist/validation/WEB-INF/classes;**/Validation/src; locations are configured
[JaCoCo plugin] Number of found exec files for pattern **/**.exec: 1
[JaCoCo plugin] Saving matched execfiles: E:\Jenkins\jobs\Validation - Test Cases\workspace\Validation\jacoco.exec
[JaCoCo plugin] Saving matched class directories for class-pattern: **/dist/validation/WEB-INF/classes: E:\Jenkins\jobs\Validation - Test Cases\workspace\Validation\dist\validation\WEB-INF\classes
[JaCoCo plugin] Saving matched source directories for source-pattern: **/Validation/src: E:\Jenkins\jobs\Validation - Test Cases\workspace\Validation\src
[JaCoCo plugin] Loading inclusions files..
[JaCoCo plugin] inclusions: []
[JaCoCo plugin] exclusions: []
ERROR: Publisher hudson.plugins.jacoco.JacocoPublisher aborted due to exception
java.io.IOException: Error while analyzing class E:\Jenkins\jobs\Validation - Test Cases\builds\2015-02-23_15-59-44\jacoco\classes\org\gosh\validation\filters\ModifiedFileListFilter.class.
at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:150)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:144)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:175)
at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:208)
at hudson.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:126)
at hudson.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:133)
at hudson.plugins.jacoco.JacocoReportDir.parse(JacocoReportDir.java:102)
at hudson.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:291)
at hudson.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:273)
at hudson.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:371)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:705)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:680)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:658)
at hudson.model.Build$RunnerImpl.post2(Build.java:162)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:627)
at hudson.model.Run.run(Run.java:1446)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 7
at org.jacoco.core.internal.analysis.MethodAnalyzer.addProbe(MethodAnalyzer.java:288)
at org.jacoco.core.internal.analysis.MethodAnalyzer.visitInsnWithProbe(MethodAnalyzer.java:224)
at org.jacoco.core.internal.flow.MethodProbesAdapter.visitInsn(MethodProbesAdapter.java:76)
at org.objectweb.asm.tree.InsnNode.accept(InsnNode.java:80)
at org.objectweb.asm.tree.InsnList.accept(InsnList.java:162)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:815)
at org.jacoco.core.internal.flow.ClassProbesAdapter$1.visitEnd(ClassProbesAdapter.java:124)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:107)
at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:142)
... 18 more
Finished: FAILURE
[UPDATE - solution]
Using this answer I installed the recently released JaCoCo-0.7.4 (see eclemma.org/jacoco) on my local drive. This version contains the fix for issue 27088. I also had to delete and then reinstall the Jenkins JaCoCo plugin (I used the Jenkins Plugin Manager).
There appears to be a compatibility problem between the JaCoCo version used during build and the version used by Jenkins in the post-build action.
The maven-jacoco-plugin version 0.7.3.201502191951 in combination with the Jenkins JaCoCo Plugin version 1.0.18 causes this problem. Version 0.7.2.201409121644 of the maven-jacoco-plugin appears to be compatible.
See also https://issues.jenkins-ci.org/browse/JENKINS-27088 and https://github.com/jenkinsci/jacoco-plugin/pull/51
Two things:
In your Jenkins project configuration for the JaCoCo Post-build action, make sure to set the Inclusions field. Something like */*.class should work. Also remove the second asterix (*) from your expressions above. Make them */*.exec, */dist/, etc
I was having a similar similar ArrayIndexOutOfBounds exception today from the Jacoco plugin, It only occurred in Jenkins though, not when running a maven build from the command line. Googling around suggested that the Jacoco plugin inclusion and exclusion field syntax causes people problems. I tried a couple different formats for those fields to no avail, so I moved to the cobertura plugin which was a cinch to use: https://wiki.jenkins-ci.org/display/JENKINS/Cobertura+Plugin#CoberturaPlugin-ConfiguringtheCoberturaPlugin

SonarQube on Java8-project gives jacoco-Exception

I just downloaded the latest version, SonarQube 4.3,
then try build a java-8 project with:
mvn clean install
mvn sonar:sonar
That gives me the Exception below.
Googling, I got the impression this is an earlier issue that should have been fixed... ?
http://sonarqube.15.x6.nabble.com/Sonar-analyze-Java-1-8-project-Failure-td5023663.html
http://jira.codehaus.org/browse/SONARJAVA-482
Does SonarQube 4.3 support java-8?
Or any clue, what is the problem?
-------------------------------------------------------
T E S T S
-------------------------------------------------------
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_6effb9e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
at org.jacoco.agent.rt.internal_6effb9e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99)
at org.jacoco.agent.rt.internal_6effb9e.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_6effb9e.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.lang.Class.getField(Class.java:1690)
at org.jacoco.agent.rt.internal_6effb9e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136)
... 9 more
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "main"
I got the missing info from the SonarQube mailing-list...
To summarize:
To get Java8 maven-build working on SonarQube-4.3:
Install sonarqube-4.3, and start the server.
Login to the web-gui => Settings => Update Center => Plugins Updates => Java => Click "Upgrade to 2.2.1"
Wait a minute or so for the upgrade to complete... then shutdown+restart sonarqube.
Go back into the Upgrade Center and verify you have plugin: Java 2.2.1
To get code-coverage in Sonar, you now need to build with these commands:
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install
mvn sonar:sonar
Reference: http://docs.codehaus.org/display/SONAR/JaCoCo+Plugin
That's it.
Here with java 11 I had this problem and I fix adding this in my gradle properties:
jacoco {
toolVersion = "0.8.4"
}
If you are running jacoco with gradle them update the jacoco to latest version.
I was also facing the similar issues and it got fixed after below changes
Java 11 and Gradle
jacoco {
toolVersion = "0.8.4"
}
I was getting the same error when mvn building a Java 1.7 project using JDK 1.8. The solution was simple: I changed the jacoco plugin version to a newer version:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
(The project was using version 0.6.3.201306030806 before.)
SonarQube 4.3 embeds Java plugin 2.1 whereas http://jira.codehaus.org/browse/SONARJAVA-482 has been fixed in version 2.2. So by upgrading the Java plugin to version 2.2.1, this should fix your issue.
Setting $JAVA_HOME resolved the problem for me.
We had the same issue. What we did was re-install sonarqube 4.3 with Java 8 already installed. Then run analysis against sonar. If you already have sonar/java 7 installed previously and have ran analysis against it, sonar seems to install some plugins which causes these failures. If you re-install just sonar and java 8 (dont remove mysql database etc... so history is intact) - re run your analysis it seems to solve the problem with the plugins.
I have done the following changes to come out from the problem.I have used the two steps for it , first one is that update the jacoco in latest version along with its toolVersion , please check it once below
classpath "com.dicedmelon.gradle:jacoco-android:0.1.4"
And toolVersion is as follow
jacoco {
toolVersion = "0.8.4"
}
Please refer the link for more info Click here
And now check the second step for it in which we use the excludes = ['jdk.internal.*'] inside the testOption like below
testOptions {
unitTests.all {
jacoco {
includeNoLocationClasses = true
excludes = ['jdk.internal.*']
}
}
}
For more info in it, please check the link Click here

osmosis --read-xml fails in combination with mapwriter plugin

I have a problem with Osmosis v 0.43 with mapsforge mapwriter plugin 0.3.0. on Windows. A command
osmosis --read-xml file=C:\geo\testmap.osm --mw file=C:\geo\genmap.map
bbox=0.0,0.0,51.9,19.2
fails with error:
SEVERE: Thread for task 1-rx failed
java.lang.AbstractMethodError:
org.mapsforge.map.writer.osmosis.MapFileWriterTask.initialize(Ljava/util/Map;)V
at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:95)
at java.lang.Thread.run(Unknown Source)
I tried using --rx with --wx and obtained no errors, so something must be wrong with the mapwriter plugin.
I found my own answer: it turned out that mapwriter plugin 0.3.0 was not compatible with the newest Osmosis version, so downgrading the tool to 0.40.1 worked

Categories