Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-21170

Problems with CDK Adapter resulting from missing PATH in Eclipse on Mac

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.3.1.CR1
    • 4.3.1.Beta1
    • cdk
    • None
    • Hide

      Start Eclipse from command line.
      On OS X the actual binary to use is Eclipse.app/Contents/MacOS/eclipse
      but then some icons will be broken and who knows what else is broken - maybe I would need to provide eclipse.ini on the command line.

      Show
      Start Eclipse from command line. On OS X the actual binary to use is Eclipse.app/Contents/MacOS/eclipse but then some icons will be broken and who knows what else is broken - maybe I would need to provide eclipse.ini on the command line.

    Description

      The problem is that CDK tooling relies on PATH to find vagrant. And the "vagrant up" command in turn depends on PATH to find e.g. VBoxManage.

      On Mac, when you start your Eclipse / JBDS as an app by double-clicking an icon on your Desktop or in Finder, the Eclipse instance will have no PATH env variable.

      One workaround is to start your Eclipse from command line by going inside the package:

      cd Eclipse.app/Contents/MacOS
      ./eclipse
      

      But this is definitely not the recommended way to start Eclipse - I'm not sure if eclipse.ini is located properly in this case. But at least PATH is correct then.

      There is actually one more workaround. To add your PATH to the Environment tab in Launch config. That works for me.

      So that might be a potential solution to this problem - have a predefined PATH for each OS in case there is none defined in the Eclipse process.

      After I set up a CDK server adapter and fixed the wrong path to vagrant in the launch config, I then started the server adapter and got this:
      Server CDK Server Adapter at localhost failed to start.
      Console:

      The provider 'virtualbox' that was requested to back the machine
      'default' is reporting that it isn't usable on this system. The
      reason is shown below:
      
      Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
      Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
      this to be available on the PATH. If VirtualBox is installed, please find the
      `VBoxManage` binary and add it to the PATH environmental variable.
      

      Along with this, there was an Unhandled event loop exception in the error view:

      org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
      	at org.eclipse.swt.SWT.error(SWT.java:4491)
      	at org.eclipse.swt.SWT.error(SWT.java:4406)
      	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
      	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4024)
      	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3700)
      	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
      	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
      	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
      	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
      	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
      	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
      	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
      	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
      	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
      	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
      	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
      	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
      	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:520)
      	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
      	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
      	at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
      Caused by: java.lang.NullPointerException
      	at org.jboss.tools.central.editors.GettingStartedHtmlPage.updateEarlyAccess(GettingStartedHtmlPage.java:359)
      	at org.jboss.tools.central.editors.GettingStartedHtmlPage.access$14(GettingStartedHtmlPage.java:342)
      	at org.jboss.tools.central.editors.GettingStartedHtmlPage$6$1.run(GettingStartedHtmlPage.java:327)
      	at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:162)
      	at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:154)
      	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
      	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
      	... 23 more
      

      In the command line, VBoxManage is accessible and it is located in /usr/local/bin/ and on my PATH.

      Max suggested I could try to start Eclipse from command line instead of double-clicking in Finder (which is the normal way to do it on Mac) and that helped.

      So for some reason when you start Eclipse using Eclipse.app from Finder, the PATH is incorrect.

      Attachments

        Issue Links

          Activity

            People

              rob.stryker Rob Stryker (Inactive)
              exd-mmalina Martin Malina
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: