Skip to content
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

NullPointerException when trying to run shebang boot script on macOS #758

Open
caleb opened this issue Dec 2, 2019 · 5 comments
Open

NullPointerException when trying to run shebang boot script on macOS #758

caleb opened this issue Dec 2, 2019 · 5 comments

Comments

@caleb
Copy link

caleb commented Dec 2, 2019

On two different machines running macOS Catalina 10.15.1 I get a NullPointerException when trying to run boot "shebang" scripts.

I've tried Oracle JDK 11, 12, and 13, and OpenJDK 13.

Inside a docker container the scripts run as expected. These scripts also used to run on macOS a couple months ago. I will try a fresh Catalina install in a VM to make sure it is not a result of having upgraded from Mojave (10.14) on both of my Macs. I will post an update once I'm able to do that.

Here is a script that throws an NPE:

#!/usr/bin/env boot

(print "Hello world")

Here is the error I get:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Boot failed to start:
java.lang.NullPointerException
	at boot.main$shebang_QMARK_.invokeStatic(main.clj:114)
	at boot.main$shebang_QMARK_.invoke(main.clj:110)
	at boot.main$_main.invokeStatic(main.clj:140)
	at boot.main$_main.invoke(main.clj:123)
	at clojure.lang.Var.invoke(Var.java:399)
	at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:154)
	at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:145)
	at boot.App.runBoot(App.java:407)
	at boot.App.main(App.java:500)

To Reproduce
Steps to reproduce the behavior:

  1. Open a terminal
  2. Run the above script ./hello.clj
  3. See error

Expected behavior
It should print "Hello world"

Versions:

  • OS: macOS 10.15.1 (Catalina)
  • java -version
    java version "12.0.1" 2019-04-16
    Java(TM) SE Runtime Environment (build 12.0.1+12)
    Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
  • boot --version
    #http://boot-clj.com
    #Sun Dec 01 23:17:27 EST 2019
    BOOT_VERSION=2.8.3
    BOOT_CLOJURE_VERSION=1.10.1
    BOOT_CLOJURE_NAME=org.clojure/clojure
@caleb
Copy link
Author

caleb commented Dec 2, 2019

Okay, I've tested this on a fresh install of Catalina and I get the same error.

I installed boot-clj and oracle-jdk from home-brew and home-brew cask respectively.

@burn2delete
Copy link
Contributor

I believe this is caused by a missing property "boot.app.path" as per the stack trace.

@burn2delete
Copy link
Contributor

I can also confirm the above script works on 10.14.6

@caleb
Copy link
Author

caleb commented Dec 2, 2019 via email

@caleb
Copy link
Author

caleb commented Dec 2, 2019

Okay, I've tracked this down to being an issue with the homebrew installation of boot. When installed manually boot works.

Now to track down what changed in the homebrew formula

EDIT:

Here's the commit that broke it:

https://github.com/Homebrew/homebrew-core/pull/46494/files

Looks like they switched from the shellscript provided by boot-clj (from the boot-bin repo) to using a homebrew generated wrapper script that calls the boot-clj jar file directly, but doesn't provide the necessary definitions.

I will submit a patch to homebrew to revert to the old installation method.

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

2 participants