-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] java.lang.NoClassDefFoundError: lombok/launch/PatchFixesHider$Transform with eclipse 2019-12 and SonarLint-Plugin #2351
Comments
Almost looks like sonar is using its own classloader architecture, which is a bit superfluous (eclipse is built on OSGi and already has this). Based primarily on the very last part of that stacktrace, where there is an To fix this we'd have to patch that code in our agent, which is... a bit of a maintenance nightmare. Is org.sonar.classloader.ParentFirstStrategy open source? I'm thinking no. If it is not, we're not going to fix this, you'll have to ask them to do it, or to contact us with details. I'm not going to attempt to reverse engineer bytecode; bytecode that appears to serve no purpose other than to obfuscate how loading plugins even works. If it is, let me know where to look. |
Hi, I'm working on the SonarLint plugin at SonarSource. I'm also currently trying to solve this issue (or at least to understand what's going on :)).
You can find it here: https://github.com/SonarSource/sonar-classloader/blob/master/src/main/java/org/sonar/classloader/ParentFirstStrategy.java
We have some commercial plugins, but our Java analyzer is open source, and I can guarantee there is no attempt to obfuscate anything here.
Our analyzers are not Eclipse/OSGi bundles, and they are used in non OSGi environments (like IntelliJ, SonarQube server, ...). Our SonarLint Eclipse plugin is obviously an OSGi component, and internally we are creating custom isolated classloaders to dynamically load each analyzers. Do you have a suggestion of what we could to restore the compatibility? |
Glad to hear from you @henryju – heh, this is an interesting case: Whilst running as an eclipse plugin within eclipse, you are loading a bunch of ECJ classes within eclipse, but within the confines of your own plugin even though eclipse already has these classes loaded as part of the JDT plugin. I'd stick with your model, because the JDT plugin's ECJ may not be the version your code is written for. But, lombok does not know that; it patches all 'ECJ-esque' classes that the VM process is attempting to load. There is some advantage to lombokizing sonar's ECJ, in that it would in theory make sonar more aware of lombok's additions, but that's a sizable can of worms that perhaps we shouldn't get into. Given that things seemed to be doing allright before your update to using ECJ, perhaps the easiest course of action, at least for now, is to ensure that lombok does not lombokize sonar's ECJ. When we apply the patches, we know which classloader is responsible as we're trying to patch it. Normally in eclipse land, that's generally an instance of I'm pretty sure that, if I were to install sonarlint into my eclipse, I'd find that it's an instance of Can you reproduce this problem right now? If so, can you try this edge release? I added this solution of refusing to patch if the CL responsible for loading is that. Double click the edge release jar, instill into eclipse, launch it, check that this problem no longer occurs. |
yes
just did with the classloader in SonarJava is an instance of |
…oduction - this time for realsies, whoops.
Well, don't I feel like the duncehead now. In shame I did try to reproduce this by installing the sonarlint plugin, but I didn't manage, possibly because I haven't bound this project to sonarcloud. I'm going to just trust your work on this @henryju – I've made another edge-release, this time comparing with the proper API (getName) and not toString. |
Indeed, the version of our Java analyzer shipped by default in SonarLint is still pre ecj. When binding to SonarCloud you get a more recent version. I have just tested lombok-edge-20200130.195021-1.jar and it works fine, thanks! |
Our attempt to fix sonarlint plugin has been confirmed.
@henryju can you please share that Jar file: lombok-edge-20200130.195021-1.ja |
Here you go: https://projectlombok.org/download-edge
…On Wed, Feb 26, 2020, 16:24 kushanxp ***@***.***> wrote:
I didn't manage, possibly because I haven't bound this project to
sonarcloud
Indeed, the version of our Java analyzer shipped by default in SonarLint
is still pre ecj. When binding to SonarCloud you get a more recent version.
I have just tested lombok-edge-20200130.195021-1.jar and it works fine,
thanks!
@henryju <https://github.com/henryju> can you please share that Jar file:
lombok-edge-20200130.195021-1.ja
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2351>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABIERLSD7U74QNUEOKAWYLRE2CRJANCNFSM4KNRVQNA>
.
|
… without reproduction.
… without reproduction - this time for realsies, whoops.
Our attempt to fix sonarlint plugin has been confirmed.
I have Spring Tool Suite 4 and Sonar Lint for Eclipse 5.0.0.1518. |
@binukavumkal We don't post 'use the edge release' as instructions, obviously. The current version of lombok (1.18.12) has this fix, just update it. |
I updated my file STS.ini whit a new version of Lombock: [lombok-1.18.12.jar] : |
This is happening again for me with the following: OS: Windows 10 I've tried the UPDATEAs @Rawi01 pointed out, this is a different problem: #2599. |
That's a different problem, see #2599 |
Even i was facing the same issue with the latest Lambok jar (i.e. 1.18.22) as well, for the following: OS: Windows 10 An internal error occurred during: "SonarLint processing file......". lombok/launch/PatchFixesHider$Transform |
Copy Lombok 1.18.16 jar to some desktop folder. And double click on jar file. One popup window called "Quick installer" will open and it will identify all eclipse instances in system. Click install finish . Restart eclipse as mentioned in the popup. This issue will go off. It worked for me!!! |
Describe the bug
When using eclipse and the SonarLint-Plugin I get an error every time I save the file and sonar begins to analyze.
To Reproduce
Install the latest eclipse version 2019-12 and the SonarLint-Plugin and the current lombok-Version.
Bind a project to sonar and change a file and save it.
!ENTRY org.eclipse.core.jobs 4 2 2020-01-30 09:05:28.589 !MESSAGE An internal error occurred during: "SonarLint processing file /newd-web/src/main/java/de/data_team/newd/inspektor/verjaehrung/service/VerjaehrungsAgentSchuldnerHforProcessor.java". !STACK 0 java.lang.NoClassDefFoundError: lombok/launch/PatchFixesHider$Transform at org.eclipse.jdt.internal.compiler.parser.Parser.endParse(Parser.java:10882) at org.eclipse.jdt.internal.core.util.CommentRecorderParser.endParse(CommentRecorderParser.java:135) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12065) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12289) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12246) at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:10654) at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:849) at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:394) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1173) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:714) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1217) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:832) at org.sonar.java.model.JParser.parse(JParser.java:289) at org.sonar.java.model.JParser.parse(JParser.java:249) at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:93) at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:65) at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:111) at org.sonar.java.JavaSquid.scan(JavaSquid.java:105) at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:88) at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81) at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:72) at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:134) at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125) at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110) at org.sonarsource.sonarlint.core.container.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:75) at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:81) at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(ConnectedSonarLintEngineImpl.java:152) at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:344) at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:334) at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:149) at org.sonarlint.eclipse.core.internal.server.Server.runAnalysis(Server.java:327) at org.sonarlint.eclipse.core.internal.jobs.AnalyzeConnectedProjectJob.runAnalysis(AnalyzeConnectedProjectJob.java:72) at org.sonarlint.eclipse.core.internal.jobs.AnalyzeConnectedProjectJob.runAnalysis(AnalyzeConnectedProjectJob.java:1) at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.run(AbstractAnalyzeProjectJob.java:399) at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.runAnalysisAndUpdateMarkers(AbstractAnalyzeProjectJob.java:207) at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.doRun(AbstractAnalyzeProjectJob.java:169) at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarProjectJob.run(AbstractSonarProjectJob.java:45) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: java.lang.ClassNotFoundException: lombok.launch.PatchFixesHider$Transform at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39) at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87) at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76) ... 38 more
Expected behavior
Sonar should analyze the file.
Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: