Skip to content

5.0.0.M1, 4.1.0.M3-4.1.0.M5 - Executable Jars BROKEN - Cannot get property 'config' on null object #11710

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
codeconsole opened this issue Jan 25, 2021 · 18 comments
Assignees
Milestone

Comments

@codeconsole
Copy link
Contributor

codeconsole commented Jan 25, 2021

Everything worked fine up until 4.1.0.M3. Now running an executable jar results in a GrailsTagException: Cannot get property 'config' on null object

This is very easy to reproduce. Just create a new web app, enable build.gradle for executable jar creation, package and run.

An example app is provided here with exact steps of how it was created:
https://github.com/codeconsole/grails4bugs

You can reproduce the error as follows:

sdk use grails 4.1.0.M5
git clone https://github.com/codeconsole/grails4bugs
cd grails4bugs
grails package
./build/libs/grails4bugs-0.1.jar 

http://localhost:8080

org.grails.taglib.GrailsTagException: [views/index.gsp:44] Error executing tag <sitemesh:captureContent>: Cannot get property 'config' on null object
	at org.grails.gsp.GroovyPage.throwRootCause(GroovyPage.java:473)
	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:415)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException: Cannot get property 'config' on null object
	at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
	at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:194)
	at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:46)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:329)
	at gsp_grails4bugs_m5index_gsp$_run_closure2$_closure4.doCall(gsp_grails4bugs_m5index_gsp.groovy:35)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
	at groovy.lang.Closure.call(Closure.java:412)
	at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:446)
	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:364)
	... 104 common frames omitted

Note: using `grails run-app' works. Only running the jar does not work. Executable jars broke starting in 4.1.0.M3

You can also demonstrate executable working with 4.1.0.M2:

git checkout 4.1.0.M2
grails clean
grails package	
./build/libs/grails4bugs-0.1.jar 

http://localhost:8080

@codeconsole codeconsole changed the title 4.1.0.M5 - Executable Jars Stopped working beginning 4.1.0.M3 - Cannot get property 'config' on null object 4.1.0.M3-4.1.0.M5 - Executable Jars BROKEN - Cannot get property 'config' on null object Jan 28, 2021
@codeconsole codeconsole changed the title 4.1.0.M3-4.1.0.M5 - Executable Jars BROKEN - Cannot get property 'config' on null object 5.0.0.M1, 4.1.0.M3-4.1.0.M5 - Executable Jars BROKEN - Cannot get property 'config' on null object Feb 3, 2021
@codeconsole
Copy link
Contributor Author

codeconsole commented Feb 3, 2021

Updated https://github.com/codeconsole/grails4bugs to 5.0.0.M1, but can be replicated in 3 easy steps:

  1. Create app
    sdk use grails 5.0.0.M1
    grails create-app grails4bugs
    cd grails4bugs

  2. modified build.gradle to stop war generation

    // apply plugin:"war"

  3. modified build.gradle to create executable jar, add following to end of build.gradle

    bootJar {
    launchScript()
    }

  4. package
    grails package

  5. Run jar
    ./build/libs/grails4bugs-0.1.jar

http://localhost:8080

@puneetbehl puneetbehl added this to the 5.0.0 milestone Feb 4, 2021
@codeconsole
Copy link
Contributor Author

@puneetbehl any idea what the root cause is here or a temporary workaround?

@codeconsole
Copy link
Contributor Author

@puneetbehl any idea what broke this?

@puneetbehl
Copy link
Contributor

I am a little busy with other items at the moment and did not get a chance to look into this. I will probably look into it once we done with updating all projects publish configurations to publish to Maven Central. And, also move existing artifacts from Bintray to the Grails JFrog artifactory.

@transentia
Copy link

5.0.0M1.

I can run happily using grailsw or gradlew (and variants, including gradle in IntelliJ) but running the artefact created via bootJar (or grailsw package) results in:

java.lang.NullPointerException: Cannot get property 'message' on null object
        at gsp_IOS5_authindex_gsp$_run_closure2.doCall(gsp_IOS5_authindex_gsp.groovy:57)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:200)
        at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:102)
        at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:213)
        at org.grails.plugins.web.taglib.SitemeshTagLib.captureTagContent(SitemeshTagLib.groovy:48)
        at org.grails.plugins.web.taglib.SitemeshTagLib$_closure3.doCall(SitemeshTagLib.groovy:156)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:446)
        at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:364)
        at gsp_IOS5_authindex_gsp.run(gsp_IOS5_authindex_gsp.groovy:74)

I THINK (no real proof other than stacktraces like above) that the issue is sitemesh not finding the designated layout (or erroring out when it does find the layout file?)

Just trying to add a supporting data point in case it helps

@xpusostomos
Copy link

Yo people,

I think... this is related to what I spent the whole day tearing my hair out about. My layouts/main.gsp is not getting expanded, but ONLY when running in docker and ONLY on grails 4.10.M3 - 4.1.0.M5, and I have seen this "Cannot get property 'config' on null object", though I can't link that directly to this issue. Why this would only happen in Docker, I don't know. But I've spent a lot of time going up and down through the versions, and 4.10.M3 - 4.1.0.M5 are very broken, and 4.10.M1 - 4.1.0.M2 seem ok.

@codeconsole
Copy link
Contributor Author

@xpusostomos yeah, I would definitely recommend staying away from 4.1.0.M3-4.1.0.M5. There appear to be some serious issues with those releases.

@codeconsole
Copy link
Contributor Author

Hi @puneetbehl any timeframe on fixing Grails 4.1.0.M3-5.0.0.M1? We are heavily dependent on the newer Spring Boot. The Spring Boot (2.1.x) in Grails 4.0.x is quite old (2018).

@puneetbehl
Copy link
Contributor

I am planning to look into this next week, and will try to get this fixed with 5.0.0.RC1

@puneetbehl puneetbehl self-assigned this May 27, 2021
@codeconsole
Copy link
Contributor Author

@puneetbehl what’s the timeline for RC1?

@transentia
Copy link

I've got to admit that I have been holding my breath for a new 5 release so long that I am going blue in the face!

I guess that the COVID situation isn't helping things along (?), so some extra patience is necessary.
I notice that you have just released 4.0.11 (congratulations!), so I will take another gulp of air and keep looking out for version 5-related activity.
That said, I'd love to be able to talk meaningfully to my customers when asked "where to from here." So I'd love to hear any news you might have...

Is there anything that I (or @codeconsole or....anyone else) can do to help speed things along?

(NB: PLEASE don't think that I am attempting to "threaten you" or "pressure you" or any such thing...I'm NOT! Just wanting to see where things are at.)

@JasonTypesCodes
Copy link
Contributor

@transentia there have been a number of things that have hampered our progress on Grails 5. None of which were related to the remaining technical work (which at this point is primarily the resolution of this issue). I'd prefer not to enumerate things here, but returning to Grails 5 RC1 is our top priority after a patch release of Grails 3 that addresses the HTTPS Redirect Issue in the Grails Wrapper.

Is there anything that I (or @codeconsole or....anyone else) can do to help speed things along?

Finding, reporting, and providing details around this issue is already a massive help. Thank you so much for that. The next steps are identifying and applying fix for this issue, so any further details or fixes you are able to provide on that front are certainly welcome.

And then, of course, once RC1 has been released verifying the candidate against your use cases is very helpful towards the Grails 5 GA release.

@transentia
Copy link

Thanks for the response @JasonTypesCodes. It's is great to hear that Grails 5 is still going ahead.

The world has been a weird/horrid place recently, so I'm not surprised that "there have been a number of things that have hampered our progress on Grails 5."

I hope everybody in the community is safe and sound.

@puneetbehl
Copy link
Contributor

Relates to grails/grails-gsp#97

@codeconsole
Copy link
Contributor Author

Confirmed working in 5.0.0.M2

Thanks

@transentia
Copy link

Looks good for me in 5.0.0.M2 as well.

I am SO HAPPY! And Grateful!

This will let me go back to my clients and start to talk about the future in a more positive way...
And I can stop obsessively checking this issue ;-)

I appreciate that times are not 'normal' and so say a big "Thank You" to all involved in getting this out.

@codeconsole
Copy link
Contributor Author

Well, this problem is not fully fixed. I am now having an issue with assets not being loaded from plugins when ran from a jar.

https://github.com/codeconsole/grails4bugs

Now demonstrates this issue.

A sample plugin contains
./sample-plugin/grails-app/assets/javascripts/helloWorld.js

grails run-app results in the javascript being available, but building the executable jar results in the plugin's javascript returning a 404 even though the plugin is still built into the jar.

@codeconsole codeconsole reopened this Jul 27, 2021
@codeconsole
Copy link
Contributor Author

I am concluding that this is a separate issue and this has been resolved. I created a separate ticket here #11999 for the new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants