-
-
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
LinkageError with Lombok, Eclipse and JasperReports Maven Plugin #1036
Comments
Hi, Any news / workaround for this issue? |
Today I had the same problem. Tested versions:
Ultimately, for this case, the solution was to remove the lombok from Eclipse. In the |
Any progress on this issue? Removing Lombok from Eclipse (In the eclipse.ini file remove the line -javaagent:C:\xxx\eclipse\lombok.jar) is not a viable solution for us as we use Lombok in many projects. |
Looks similar to #1281 which is also still open |
.. and #2351 Looking at this it is very important that you update not just the lombok dependency, but also the lombok installation / plugin itself, as this may be an old (closed) bug resurfacing. Since we're now on 1.18.12 and this report is talking about a 1.16.x version this may already be fixed and just be a setup or update problem. |
Especially with comments like this #2454 (comment) - you may need to refresh your workspace as well to fix this. |
@randakar I tested with 1.18.12 in a fresh workspace, and the problem still occurs. |
Thanks.
Don't have an eclipse installation to try this on right now, but I'm sure
this will help.
Out of interest, if you're willing to test some more, can you try this
against lombok edge?
https://projectlombok.org/download-edge
…On Wed, Sep 30, 2020 at 8:52 PM Ingo Jobling ***@***.***> wrote:
@randakar <https://github.com/randakar> I am testing with 1.18.12,
including the lombok installation / plugin itself.
I created a simple testcase to reproduce the problem : [
https://github.com/joblini/lombok-1036-test-case.git]
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1036 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABIERLJTAMDXGCQJYSJTR3SIN5AJANCNFSM4B4VALPQ>
.
--
"Don't only practice your art, but force your way into it's secrets, for it
and knowledge can raise men to the divine."
-- Ludwig von Beethoven
|
Ok. Cloned that repo just out of curiosity and tried to compile it with
maven, but that ran into trouble because there were no properties, nor a
java compiler plugin configuration.
Does the code in this pull request:
joblini/lombok-1036-test-case#1 solve your problem?
…On Thu, Oct 1, 2020 at 1:04 PM Floris Kraak ***@***.***> wrote:
Thanks.
Don't have an eclipse installation to try this on right now, but I'm sure
this will help.
Out of interest, if you're willing to test some more, can you try this
against lombok edge?
https://projectlombok.org/download-edge
On Wed, Sep 30, 2020 at 8:52 PM Ingo Jobling ***@***.***>
wrote:
> @randakar <https://github.com/randakar> I am testing with 1.18.12,
> including the lombok installation / plugin itself.
> I created a simple testcase to reproduce the problem : [
> https://github.com/joblini/lombok-1036-test-case.git]
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1036 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AABIERLJTAMDXGCQJYSJTR3SIN5AJANCNFSM4B4VALPQ>
> .
>
--
"Don't only practice your art, but force your way into it's secrets, for
it and knowledge can raise men to the divine."
-- Ludwig von Beethoven
--
"Don't only practice your art, but force your way into it's secrets, for it
and knowledge can raise men to the divine."
-- Ludwig von Beethoven
|
@randakar The changes in the pull request did not resolve the problem. The error does not occur when building directly with Maven. The error only occurs when building the project in Eclipse, via the m2e Eclipse integration |
@randakar I tested with the lombok edge release (with a fresh workspace), but the problem still occurs. |
Thanks for the testing.
Looks like someone is going to have to debug this under eclipse then.
…On Thu, Oct 1, 2020, 21:18 Ingo Jobling ***@***.***> wrote:
@randakar <https://github.com/randakar> I tested with the lombok edge
release (with a fresh workspace), but the problem still occurs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1036 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABIERJCPKVHEV66VH6ZHVLSITIZHANCNFSM4B4VALPQ>
.
|
When the project is built for the first time (via m2e) after running Eclipse with the lombok javaagent enabled, the error is : java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/compiler/parser/Parser Here is the complete stack trace: `Error while compiling Jasper reports (com.alexnederlof:jasperreports-plugin:2.6:jasper:default:process-sources) org.apache.maven.plugin.MojoExecutionException: Error while compiling Jasper reports Subsequent builds (via m2e) produce the LinkageError as indicated in the original problem description |
Did anyone get a workaround for this problem? |
Removing the eclipse lifecycle mapping should help here. The problem is that the jasperreports plugin loads the eclipse compiler classes every time you run a m2e build and lombok does not like that. |
The purpose of the m2e lifecycle mapping is to invoke the jasperreports plugin to compile reports, as required, during the Eclipse build cycle. Removing the mapping would result in reports not being compiled, so this isn't an acceptable solution. |
You can still invoke the maven goal by hand or compile the reports using your reports editor (e.g. Jaspersoft Studio). That might not be perfect but is still a better workaround than removing lombok completly. |
Any progress on this problem building via m2e? With Lombok v1.18.22 "Envious Ferret" same error
|
As I already mentioned there are some classloading issues because the plugin and eclipse load the eclipse compiler classes in different classloaders. Lombok assumes that there is only one instance of these classes... There already is a list of classloaders that lombok ignores, it might be a good solution to add the plugin loader to that list. As a workaround you can use the <additionalProperties>
<net.sf.jasperreports.compiler.class>net.sf.jasperreports.engine.design.JRJavacCompiler</net.sf.jasperreports.compiler.class>
<net.sf.jasperreports.compiler.classpath>/path/to/jasperreports-6.15.0.jar</net.sf.jasperreports.compiler.classpath>
</additionalProperties> |
I have already tried |
I have confirmed that excluding the classloader I'm not sure if each maven plugin gets its own classloader instance or if they all share the same one. @rzwitserloot would it break too much by excluding the plexus-classworlds classloader? If each plugin gets its own classloader instance, in theory it could be possible to identify which one loads the JasperReports plugin and exclude it. If they all share the same classloader, then this strategy won't work at all because there would be no way to isolate ECJ. What are your thoughts? |
It is also possible to detect the plugin classloader using if (loader != null && loader.toString().contains("jasperreports-plugin")) return false; // Relevant to bug #1036 |
Excellent point @Rawi01! Normally To be absolutely safe, the final version should be:
|
Thank you for an excellent project! Can you please include it in an edge release? I would really like to test it. I see there are other fixes for eclipse in the release notes, that is of interest to me. Thank you! |
Just pushed an edge release with this fix included. |
I'm getting a
LinkageError
error when opening a Maven project that utilizes jasperreports-plugin in Eclipse Mars with Lombok.In that case, whenever project is built, it runs the Maven Plugin, the Plugin seems to run correctly (no logs in Eclipse's Maven Console) and then Eclipse reports an error in
pom.xml
with this exception:I created a small, self contained, correct example that will allow to reproduce the problem.
The problem might be that the plugin uses
ejc
artifact by itself, and then classes from it are loaded with a different classloader than Eclipse's, which somehow results inLinkageError
.If I remove Lombok, the whole thing complies smoothly without errors.
The text was updated successfully, but these errors were encountered: