Skip to content

Grails 2.4.0: Java 8u40 w/ 2.4.5/2.5 gives $getStaticMetaClass() visibility errors in inheriting controllers #619

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

Closed
patric42 opened this issue Apr 7, 2015 · 54 comments

Comments

@patric42
Copy link

patric42 commented Apr 7, 2015

Grails 2.4.5/2.5.0 with Java 8u40

Given two controllers:

  • abstract SecureController
  • UserController extends SecureController

On clean compile, it works, but if changed and recompiled in dev mode, it gives
| Compiling 1 source files
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] /.../grails-app/controllers/UserController.groovy: -1: $getStaticMetaClass() in UserController cannot override $getStaticMetaClass in SecureController; attempting to assign weaker access privileges; was public
[groovyc] @ line -1, column -1.

Switching to 8u31, it works again. I tried moving the SecureController to src/groovy, to no avail.

@bxqgit
Copy link

bxqgit commented Apr 18, 2015

I confirm, this error occures.

@burtbeckwith
Copy link
Contributor

8u45 was released recently - can you try upgrading?

@patric42
Copy link
Author

Still happens with 8u45, just tried.

@zyro23
Copy link
Contributor

zyro23 commented Apr 24, 2015

might be related: jamescookie/quartz-monitor#30

and behavior confirmed. working with jdk 8u31, fails with 8u45...

however, i can not see a reason for attempting to assign weaker access privileges. all method definitions (the overriding ones and the overridden ones) are protected. nothing was public...

maybe sth. is going on with groovy-2.4.3 and jdk-8u40+?

@jmesterh
Copy link

Also seeing this issue with 8u45, with a domain class extending an abstract class in src/groovy

@zyro23
Copy link
Contributor

zyro23 commented Apr 25, 2015

@jeffbrown @graemerocher do you maybe have any idea what could be the cause of this? at least for me, avoiding jdk 8u40+ is not possible for long. thanks, zyro

@zyro23
Copy link
Contributor

zyro23 commented Apr 27, 2015

i think i was able to isolate this a bit further. using jdk 8u45 and grails-2.5.0. given the following classes:

// src/java/jdktest/JavaClass.java
public class JavaClass {
    protected void foo() {}
}
// src/groovy/jdktest/GroovyClass.groovy
class GroovyClass extends JavaClass {
    @Override
    protected void foo() {}
}
  • grails run-app: compilation error: foo() in jdktest.GroovyClass cannot override foo in jdktest.JavaClass; attempting to assign weaker access privileges; was public
  • grails compile: works
  • grails compile, then grails run-app: works
  • grails clean, then grails run-app: again compilation error from above

@patric42 @bxqgit @jmesterh can you confirm that compilation and subsequent run-app works after manually doing a grails compile?

@patric42
Copy link
Author

As I wrote in the initial report: Initial compile works, but recompile through the agent seems broken.

@dacoates
Copy link

I have same problem as zyro23. Grails 2.5.0, Java 8u45. Only compile that works is the first one following a clean.

In my case I have all Groovy code, no Java. But I am extending and abstract base class that is in the Controllers folder.

@tnleeuw
Copy link

tnleeuw commented Apr 30, 2015

I've seen the exact same error, both on Quartz + Quartz Monitor and on my own code - but only when compiling from within grails run-app.

When running grails compile, I do not see this kind of behaviour at all - compilation works as expected.

@nmfisher
Copy link

nmfisher commented May 1, 2015

Same issue here after upgrading to 8u45

@dacoates
Copy link

dacoates commented May 5, 2015

Java 8u31 and earlier does not have this problem, but Java 8u40 and 45 do.

@mdvx
Copy link

mdvx commented May 5, 2015

I'm new to grails, but yes i found this with 8u40 and 8u45 too - it works on 8u31

@tnleeuw
Copy link

tnleeuw commented May 6, 2015

Since Groovy/Grails behaviour changed with a JDK update, should this be seen as a JDK bug? Or is it a change in JDK that is unavoidable due to security fixes, that Groovy/Grails will have to adapt to somehow?

@ivgeorgi
Copy link

ivgeorgi commented May 7, 2015

Any updates on this issue???

@graemerocher graemerocher changed the title Java 8u40 w/ 2.4.5/2.5 gives $getStaticMetaClass() visibility errors in inheriting controllers Grails 2.4.0: Java 8u40 w/ 2.4.5/2.5 gives $getStaticMetaClass() visibility errors in inheriting controllers May 25, 2015
@graemerocher
Copy link
Contributor

Someone please upload an example to Github with steps to reproduce

@zyro23
Copy link
Contributor

zyro23 commented May 25, 2015

here you go: https://github.com/zyro23/grails-core-619 - can reproduce the issue with jdk 8u45 (clean run-app).
btw: nice to see you back at work, graeme :)

@ikakara
Copy link
Contributor

ikakara commented May 26, 2015

Graeme - others are reporting that this issue also occurs for domain classes (see #682)

@graemerocher graemerocher added this to the grails-2.5.1 milestone May 26, 2015
@graemerocher
Copy link
Contributor

@aclement Thanks for looking into this, any idea when 1.2.4 will be released?

@aclement
Copy link
Contributor

If you tell me this does address these problems, we can do it pretty quick.

@ikakara
Copy link
Contributor

ikakara commented Jun 17, 2015

@aclement - How do I test your jar? I've tried the following in the conf/BuildConfig.groovy

  repositories {
    inherits true // Whether to inherit repository definitions from plugins

    grailsPlugins()
    grailsHome()
    mavenLocal()
    grailsCentral()
    mavenCentral()

    mavenRepo "http://repo.spring.io/libs-snapshot-local/org/springframework/springloaded/1.2.4.BUILD-SNAPSHOT/"
  }
  management {
    dependency "org.springframework:springloaded:'1.2.4.BUILD-20150506.053454-9'"
  }

@aclement
Copy link
Contributor

It is crude... but I usually download it and replace the one in grails with it (i.e. rename what I download to the same name as the version inside grails).

@ikakara
Copy link
Contributor

ikakara commented Jun 17, 2015

I noticed an extra set of quotes in my example - still didn't work, when fixed the quotes. Ok, I'll give the rename a try ...

@ikakara
Copy link
Contributor

ikakara commented Jun 17, 2015

Works for me! I say ship it! lol

For full disclosure, I just tested my broken case where I do a grails run-app (w/o first compile) which normally reproduces the error, and I also tried modifying a subclass (during grails run-app), which will also reproduce the error. Those two cases are fixed with the latest jar.

@ikakara
Copy link
Contributor

ikakara commented Jun 17, 2015

@aclement - is there a unit test for "modify subclass"?

There are only 2 open bugs for 2.5.1 and they both appear to be a simple config change for graeme (assuming aclement builds v1.2.4 of springloaded). So 2.5.1 can go live by tomorrow 👍

@aclement
Copy link
Contributor

is there a unit test for "modify subclass"?

There is - but I doubt there is one for every combination of visibility.

@ikakara
Copy link
Contributor

ikakara commented Jun 19, 2015

@aclement - no worries - add them when we find them :) Do you have eta on release of 1.2.4?

Also there's another springloaded issue: #599 - I went ahead and tried your 1.2.4 snapshot (w/ Grails 3), and it didn't fix the problem. I didn't think the bug was related to this one, but I tried anyway ... to no avail.

@ikakara
Copy link
Contributor

ikakara commented Jul 1, 2015

@aclement - any status on the release (eta) of 1.2.4?

@graemerocher
Copy link
Contributor

I believe @aclement plans to release it soon, we are coordinating with him

@rgoldberg
Copy link

@aclement & @graemerocher:

Do you have an ETA for Spring Loaded 1.2.4 being released & included in Grails 2.5.1, and for Grails 2.5.1 being released?

I'm about to start testing an upgrade from a much older version of Grails, and from Java 7 to Java 8u31.

If Grails 2.5.1 will be ready in less than a week or so, then I'll probably wait for it.

Otherwise, I'll probably test & release the upgrade to 2.5.0 & 8u31, and then later test & release a subsequent upgrade to 2.5.1 & 8u45.

Thanks for all your work on both projects.

@jeffscottbrown jeffscottbrown self-assigned this Jul 27, 2015
@jeffscottbrown
Copy link
Contributor

#9136 should fix this.

@kasonyang
Copy link

Is it fixed?It occures when I use grails 3.0.6 && java 8u45.

@tnleeuw
Copy link

tnleeuw commented Oct 6, 2015

For me, this is fixed in Grails 2.5.1 and Java 8u60. Although I believe
that the java version isn't actually relevant for the fix. Which version of
SpringLoaded I'd included in Grails 3.0.6?

--Tim

On Tue, 6 Oct 2015 14:15 Kason notifications@github.com wrote:

Is it fixed?It occures when I use grails 3.0.6 && java 8u45.


Reply to this email directly or view it on GitHub
#619 (comment).

@kasonyang
Copy link

@tnleeuw springloaded-1.2.4.RELEASE.jar

@tnleeuw
Copy link

tnleeuw commented Oct 6, 2015

@Kason That's the same version as in Grails 2.5.1, so this should be Ok. I
wonder if it still is also depending on Java version then? Or if somehow
something got screwed up in the loading of libraries, taking an older
version from an unexpected place on the classpath, somehow??

On Tue, Oct 6, 2015 at 2:24 PM Kason notifications@github.com wrote:

@tnleeuw https://github.com/tnleeuw springloaded-1.2.4.RELEASE.jar


Reply to this email directly or view it on GitHub
#619 (comment).

@kasonyang
Copy link

@tnleeuw Thanks! It seams that the project cache the old libraries. I create a new project with grails3.06 and copy the source from the old project then run the new project.The problem disappear.

@tnleeuw
Copy link

tnleeuw commented Oct 7, 2015

What if you do "grails clean all" in the old project directory?

On Wed, 7 Oct 2015 04:29 Kason notifications@github.com wrote:

@tnleeuw https://github.com/tnleeuw Thanks! It seams that the project
cache the old libraries. I create a new project with grails3.06 and copy
the source from the old project then run the new project.The problem
disappear.


Reply to this email directly or view it on GitHub
#619 (comment).

@kasonyang
Copy link

I did it(grails clean all) in the old project unsuccessfully.
Here is output:

> Configuring > 0/1 projects > root project > Resolving dependenc1/1 projects > Resolving dependencies ':agent' > Resolving depend
BUILD SUCCESSFUL

Total time: 54.552 secs
> Resolving dependencies ':testRuntime' > Resolving dependencies | Error Error initializing classpath: Unsupported method: GrailsClasspath.getError().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model. (Use --stacktrace to see the full trace)

My gradle version is 2.7

@tnleeuw
Copy link

tnleeuw commented Oct 7, 2015

Sorry, I don't know enough about Gradle & Grails 3 yet to be helpful with
this error...
I do see that Gradle 2.7 is the latest official release of Gradle, but
perhaps it is too new??
Did you try upgrading to Grails 3.0.8? Or Gradle 2.8rc1?

--Tim

On Wed, Oct 7, 2015 at 7:12 AM Kason notifications@github.com wrote:

I did it(grails clean all) in the old project unsuccessfully.
Here is output:

Configuring > 0/1 projects > root project > Resolving dependenc1/1 projects > Resolving dependencies ':agent' > Resolving depend
BUILD SUCCESSFUL

Total time: 54.552 secs

Resolving dependencies ':testRuntime' > Resolving dependencies | Error Error initializing classpath: Unsupported method: GrailsClasspath.getError().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model. (Use --stacktrace to see the full trace)

My gradle version is 2.7


Reply to this email directly or view it on GitHub
#619 (comment).

@kasonyang
Copy link

@tnleeuw Yes.It is too new.I build the old project unsuccessfully with gradle2.7 but successfully with gradle2.4.
However it is not important to me now.There is no problem in my new project.

@tnleeuw
Copy link

tnleeuw commented Oct 7, 2015

Wondering if newer versions of Grails fix this error with Gradle, though?

On Wed, 7 Oct 2015 10:31 Kason notifications@github.com wrote:

@tnleeuw https://github.com/tnleeuw Yes.It is too new.I build the old
project unsuccessfully with gradle2.7 but successfully with gradle2.4.
However it is not important to me now.There is no problem in my new
project.


Reply to this email directly or view it on GitHub
#619 (comment).

danielnaber added a commit to languagetool-org/languagetool-community-website that referenced this issue Jan 16, 2016
kuceram added a commit to MetadataConsulting/ModelCataloguePlugin that referenced this issue Mar 30, 2016
- this should fix the problem of apache/grails-core#619
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment