twosigma / beakerx

Beaker Extensions for Jupyter Notebook
http://BeakerX.com
Apache License 2.0
2.8k stars 381 forks source link

Cannot start server on Mac OS X 10.10 #1859

Closed egeerardyn closed 7 years ago

egeerardyn commented 9 years ago

I downloaded the last Beaker install from the website, when running the Beaker.app, no browser window opens. I tried launching it from the About window, but it says the server at 127.0.01:8801/beaker cannot be connected to.

I tried to run the actual executable at /Applications/Beaker.app/Contents/MacOS/Beaker and it produces the following log:

2015-06-29 09:44:08.582 Beaker[5289:177938] Beaker App start JVM and launch browser
2015-06-29 09:44:09.427 Beaker[5289:177938] 09:44:09.424 [main] DEBUG o.c.s.BayeuxServerImpl.1101184763 - addTransport long-polling from class org.cometd.server.transport.JSONTransport
2015-06-29 09:44:09.427 Beaker[5289:177938] 09:44:09.427 [main] DEBUG o.c.s.BayeuxServerImpl.1101184763 - addTransport callback-polling from class org.cometd.server.transport.JSONPTransport
2015-06-29 09:44:09.437 Beaker[5289:177938] 09:44:09.437 [main] DEBUG o.c.s.BayeuxServerImpl.1101184763 - addTransport websocket from class org.cometd.websocket.server.WebSocketTransport
2015-06-29 09:44:09.442 Beaker[5289:177938] Exception in thread "main" 
2015-06-29 09:44:09.442 Beaker[5289:177938] java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
2015-06-29 09:44:09.442 Beaker[5289:177938]     at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:607)
    at org.eclipse.jetty.util.log.JettyAwareLogger.warn(JettyAwareLogger.java:431)
2015-06-29 09:44:09.442 Beaker[5289:177938]     at org.eclipse.jetty.util.log.Slf4jLog.warn(Slf4jLog.java:69)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.setFailed(AbstractLifeCycle.java:204)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:74)
    at com.twosigma.beaker.shared.module.GuiceCometdModule.getBayeuxServer(GuiceCometdModule.java:124)
2015-06-29 09:44:09.443 Beaker[5289:177938] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
2015-06-29 09:44:09.443 Beaker[5289:177938]     at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
2015-06-29 09:44:09.443 Beaker[5289:177938]     at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
2015-06-29 09:44:09.444 Beaker[5289:177938]     at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179)
2015-06-29 09:44:09.444 Beaker[5289:177938] 
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at com.twosigma.beaker.core.Main.main(Main.java:200)
2015-06-29 09:44:09.464 Beaker[5289:177938] stream closed!
2015-06-29 09:44:09.464 Beaker[5289:177938] stream closed!

I do have some "non-standard" parts on my OS X 10.10 install (e.g. MacPorts is installed), but I checked that java points to /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java and it has the following version:

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b40)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b55, mixed mode)

Perhaps somebody here has more experience with this and can help me to get Beaker running?

scottdraves commented 9 years ago

Thanks for the report. That is quite baffling. Beaker includes its own JRE (java 8), so the system java should not matter. I tested on a machine with Java 7 just in case though and it worked fine.

egeerardyn commented 9 years ago

I thought so too. If I can provide any additional information or do anything to help with debugging, just let me know.

scottdraves commented 9 years ago

Do you have a CLASSPATH environment variable set? Can you try unsetting it?

scottdraves commented 9 years ago

Note that Beaker reads your .bash_profile when it starts up, so to unset it you need to remove it there, not just from the shell where you run it.

egeerardyn commented 9 years ago

No, I don't have a CLASSPATH set. These are my settings as returned by env:

LC_TIME=en_GB.UTF-8
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.9SgMHyUHh9/Listeners
TERM_SESSION_ID=762026CF-8827-4F4A-B42B-E22928B9CF3B
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.wRHXUvkrCD/Render
XPC_FLAGS=0x0
LC_NUMERTIC=nl_BE.UTF-8
LC_NUMERIC=nl_BE.UTF-8
XUGGLE_HOME=/usr/local/xuggler
SECURITYSESSIONID=186dc
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/pkgconfig
TERM_PROGRAM_VERSION=343.7
TERM_PROGRAM=Apple_Terminal
DBUS_LAUNCHD_SESSION_BUS_SOCKET=/private/tmp/com.apple.launchd.Zysigi7Zta/unix_domain_listener
DISPLAY=/private/tmp/com.apple.launchd.Yx4hwwDqak/org.macosforge.xquartz:0
TRACKER_HOME=/usr/local/tracker
GPG_AGENT_INFO=/private/tmp/com.apple.launchd.oBwDFT8zam/Listeners_agent
TERM=xterm-256color
TMPDIR=/var/folders/bv/wbqcptsd0lxfts607vsxlz9r0000gn/T/
XPC_SERVICE_NAME=0
LC_MONETARY=nl_BE.UTF-8
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
SHELL=/bin/zsh
HOME=/Users/egon
LOGNAME=egon
USER=egon
PATH=/Users/egon/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/local/share/java/android-sdk-macosx/platform-tools:/usr/texbin:/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/Library/TeX/texbin
SHLVL=1
PWD=/Users/egon/Dropbox/VUB/PhD/toolbox
OLDPWD=/Users/egon/Dropbox/VUB/PhD
ZSH=/Users/egon/.oh-my-zsh
PAGER=less
LESS=-R
LC_CTYPE=en_US.UTF-8
LSCOLORS=Gxfxcxdxbxegedabagacad
DB=/Users/egon/Dropbox
VUB=/Users/egon/Dropbox/VUB
PhD=/Users/egon/Dropbox/VUB/PhD
m2t=/Users/egon/Dropbox/matlab/matlab2tikz
vcs_info_msg_0_=develop
vcs_info_msg_1_=
LANG=en_US.UTF-8
_=/usr/bin/env

I don't normally use bash, so I don't have a bash_profile file. I checked both my .zshrc and .bashrc for any classpath-altering stuff, but no luck. An empty ~/.bash_profile does not improve the situation either.

mattyb149 commented 9 years ago

I have a different (but JRE-related) error starting the latest Beaker on Mac:

mburgess-mac-2:MacOS mburgess$ ./Beaker 2015-08-19 20:08:55.528 Beaker[12711:74681] Beaker App start JVM and launch browser 2015-08-19 20:08:56.076 Beaker[12711:74681] Exception in thread "main" 2015-08-19 20:08:56.077 Beaker[12711:74681] java.lang.UnsupportedClassVersionError: com/twosigma/beaker/core/Main : Unsupported major.minor version 52.0 2015-08-19 20:08:56.077 Beaker[12711:74681] at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) 2015-08-19 20:08:56.077 Beaker[12711:74681] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 2015-08-19 20:08:56.077 Beaker[12711:74681] at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 2015-08-19 20:08:56.077 Beaker[12711:74681] at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) 2015-08-19 20:08:56.080 Beaker[12711:74681] stream closed! 2015-08-19 20:08:56.080 Beaker[12711:74681] stream closed!

I verified that core.jar is built with Java 8 but a Java 7 JRE is included. If I build from source (setting the target Java version to 7) and replace the core/ folder with the built one, it opens fine.

If a JRE 7 is to be included, the project needs to build Java 7 compatible classes. I added source and target compatibility properties to core/build.gradle, I can issue a Pull Request if you like. Thanks!

mattyb149 commented 9 years ago

https://github.com/twosigma/beaker-notebook/pull/2173 for your consideration, thank you!

scottdraves commented 9 years ago

Thanks for the report. I believe we build and ship with 1.8.

The name of the directory Beaker.app/Contents/Resources/jre1.7.0_60.jre is deceiving, as you can see from the contents of Beaker.app/Contents/Resources/jre1.7.0_60.jre/Contents/Info.plist: <string>Java SE 1.8.0_51</string>. see https://github.com/twosigma/beaker-notebook/issues/829

This probably won't get fixed since this whole application will soon be retired in favor of our electron native application.

Do you have some startup files that are setting JAVA_HOME and getting a 1.7 JRE involved?

mattyb149 commented 9 years ago

Interesting, my .bashrc file sets JAVA_HOME to JDK 7, and even if I change the variable in my shell to point to JDK 8, when I run Beaker, it still gets JDK 7. I'm guessing that it is ignoring my current shell's setting and just source'ing .bashrc (via .bash_profile probably), which is bringing in JDK 7.

If I change my .bashrc to set JAVA_HOME to JDK 8, it works. If this is going to change to Electron then my pull request is probably not needed, but at the very least maybe this issue will be indexed by Google in case others run into the same issue ;)

Thank you for your reply!

scottdraves commented 9 years ago

Indeed we do source it, by starting a login shell: https://github.com/twosigma/beaker-notebook/blob/master/core/beaker.command#L30 the reason is Anaconda puts itself in the PATH there.

What's changing in the Electron version is the dumb name for the jre directory. We haven't implemented a better way to find Anaconda though. Since we do have a prefs file, PATH is not required. I am thinking we can just grep ~/.bash_profile and if it's not found, then rely on users to set it up (with some kind of prompting).