The problem here is the difference between running as sudo vs. running as a regular user. If you run gfsh with shell debugging, you'd see that as a regular user, java is called with a full path but under sudo, it's just being called with 'java' (assuming your PATH variable is correct). In the latter case then, the tools.jar file does not get found.
To work around the issue you should be able to do the following (setting paths as appropriate): export JAVA_HOME=/usr/lib/jvm/java-8-oracle sudo sh -c "JAVA_HOME=$JAVA_HOME /bin/path/to/gfsh" --Jens On Wed, Jan 13, 2016 at 2:52 PM, Kirk Lund <[email protected]> wrote: > This issue is now filed as "GEODE-780: GFSH should not require Attach API > to start Locators or Servers" > > It's caused by GFSH attempting to perform status using the pid of the > newly launched process. > > -Kirk > > > On Wed, Jan 13, 2016 at 1:41 PM, John Blum <[email protected]> wrote: > >> *> If you're running on Mac, then the contents from tools.jar should >> already be in your java environment.* >> >> This is only true if you are using Apple's JDK (JRE), which ceased to be >> supported and released after 1.6. In fact, the latest versions of Mac OS >> X, e.g. Yosemite and I think even Mavericks (perhaps) removed the Apple >> JDK. Since Geode requires JDK 8 you would need to use an Oracle provided >> Mac OS X JDK (since 1.7), in which case, all the same rules Kirk mentioned >> above this line apply. >> >> >> >> On Wed, Jan 13, 2016 at 1:33 PM, Kirk Lund <[email protected]> wrote: >> >>> In bash, you might check "which java" and then add the tools.jar to the >>> lib/ext dir that's parallel to the bin containing java. >>> >>> If your java is in /somedir/jre/bin then you would copy a tools.jar from >>> a jdk installation and add it to /somedir/jre/lib/ext. >>> >>> If your java is in /somedir/jdk/bin then it should already be finding >>> tools.jar but I suppose you could try adding tools.jar to >>> /somedir/jdk/jre/lib/ext. >>> >>> If you're running on Mac, then the contents from tools.jar should >>> already be in your java environment. >>> >>> -Kirk >>> >>> >>> On Wed, Jan 13, 2016 at 1:05 PM, Dor Ben Dov <[email protected]> >>> wrote: >>> >>>> This is the part again >>>> >>>> >>>> >>>> [dor@localhost apache-geode]$ sudo ./bin/gfsh >>>> >>>> [sudo] password for dor: >>>> >>>> _________________________ __ >>>> >>>> / _____/ ______/ ______/ /____/ / >>>> >>>> / / __/ /___ /_____ / _____ / >>>> >>>> / /__/ / ____/ _____/ / / / / >>>> >>>> /______/_/ /______/_/ /_/ v1.0.0-incubating-SNAPSHOT >>>> >>>> >>>> >>>> Monitor and Manage GemFire >>>> >>>> gfsh>start locator --name=locator >>>> >>>> Starting a GemFire Locator in >>>> /home/dor/Downloads/incubator-geode/gemfire-assembly/build/install/apache-geode/locator... >>>> >>>> An error occurred while attempting to start a Locator in >>>> /home/dor/Downloads/incubator-geode/gemfire-assembly/build/install/apache-geode/locator >>>> on 192.168.253.132[10334]: The Attach API classes could not be found on the >>>> classpath. Please include JDK tools.jar on the classpath or add the >>>> JDK tools.jar to the jre/lib/ext directory. >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> *From:* Kirk Lund [mailto:[email protected]] >>>> *Sent:* יום ד 13 ינואר 2016 22:52 >>>> >>>> *To:* [email protected] >>>> *Subject:* Re: failed building the latest version downloaded from >>>> github >>>> >>>> >>>> >>>> GFSH is a custom CLI tool for GemFire. It doesn't support linux >>>> commands such as sudo. >>>> >>>> >>>> >>>> You can add the tools.jar from the JDK to your classpath to fix the >>>> last problem you hit, however the code no longer requires the Attach API, >>>> so I'm surprised that you're seeing an error message about it. I'll try to >>>> fit in some time to do some experimenting with this later this week or next >>>> week. >>>> >>>> >>>> >>>> -Kirk >>>> >>>> >>>> >>>> >>>> >>>> On Wed, Jan 13, 2016 at 12:45 PM, Dor Ben Dov <[email protected]> >>>> wrote: >>>> >>>> Anthony and Dan, >>>> >>>> Cloning from git and then building the develop worked >>>> >>>> But when I am running the locator I am getting this : >>>> >>>> gfsh>sudo start locator --name=locator >>>> >>>> Command "sudo start locator --name=locator" is not valid. >>>> >>>> gfsh> >>>> >>>> gfsh>exit >>>> >>>> Exiting... >>>> >>>> [dor@localhost apache-geode]$ sudo ./bin/gfsh >>>> >>>> [sudo] password for dor: >>>> >>>> _________________________ __ >>>> >>>> / _____/ ______/ ______/ /____/ / >>>> >>>> / / __/ /___ /_____ / _____ / >>>> >>>> / /__/ / ____/ _____/ / / / / >>>> >>>> /______/_/ /______/_/ /_/ v1.0.0-incubating-SNAPSHOT >>>> >>>> >>>> >>>> Monitor and Manage GemFire >>>> >>>> gfsh>start locator --name=locator >>>> >>>> Starting a GemFire Locator in >>>> /home/dor/Downloads/incubator-geode/gemfire-assembly/build/install/apache-geode/locator... >>>> >>>> An error occurred while attempting to start a Locator in >>>> /home/dor/Downloads/incubator-geode/gemfire-assembly/build/install/apache-geode/locator >>>> on 192.168.253.132[10334]: The Attach API classes could not be found on the >>>> classpath. Please include JDK tools.jar on the classpath or add the JDK >>>> tools.jar to the jre/lib/ext directory. >>>> >>>> >>>> >>>> *From:* Anthony Baker [mailto:[email protected]] >>>> *Sent:* יום ד 13 ינואר 2016 17:02 >>>> >>>> >>>> *To:* [email protected] >>>> *Subject:* Re: failed building the latest version downloaded from >>>> github >>>> >>>> >>>> >>>> This should be fixed now: >>>> >>>> >>>> https://github.com/apache/incubator-geode/commit/0a890a56232e144d1dd76df05576bcdbb7601c87 >>>> >>>> >>>> >>>> >>>> >>>> Anthony >>>> >>>> >>>> >>>> >>>> >>>> On Jan 12, 2016, at 10:45 PM, Dor Ben Dov <[email protected]> >>>> wrote: >>>> >>>> >>>> >>>> Dan >>>> >>>> I will try cloning from git repository and then I will try again and >>>> update you guys, but if you ask me, it’s weird that the downloaded zip >>>> doesn’t compile with gradle. >>>> >>>> Dor >>>> >>>> >>>> >>>> *From:* Dan Smith [mailto:[email protected] <[email protected]>] >>>> *Sent:* יום ד 13 ינואר 2016 03:04 >>>> *To:* [email protected] >>>> *Subject:* Re: failed building the latest version downloaded from >>>> github >>>> >>>> >>>> >>>> Can you try cloning the git repository instead of downloading the >>>> source zip? It looks like it's trying to read metadata from a git checkout. >>>> >>>> -Dan >>>> >>>> >>>> >>>> On Tue, Jan 12, 2016 at 1:04 PM, Dor Ben Dov <[email protected]> >>>> wrote: >>>> >>>> Hi, >>>> >>>> >>>> >>>> I am using fedora 23 with gradle and java 8 >>>> >>>> >>>> >>>> Downloaded the latest bundle from github >>>> https://github.com/apache/incubator-geode/archive/develop.zip >>>> >>>> >>>> >>>> Then tried to gradle build according to the guidelines you wrote on the >>>> same page, >>>> >>>> >>>> >>>> But it keep failing with this error: >>>> >>>> dor@localhost incubator-geode-develop]$ sudo ./gradlew build >>>> installDist >>>> >>>> Starting a new Gradle Daemon for this build (subsequent builds will be >>>> faster). >>>> >>>> >>>> >>>> FAILURE: Build failed with an exception. >>>> >>>> >>>> >>>> * Where: >>>> >>>> Build file '/home/dor/Downloads/incubator-geode-develop/build.gradle' >>>> line: 57 >>>> >>>> >>>> >>>> * What went wrong: >>>> >>>> A problem occurred evaluating root project 'gemfire'. >>>> >>>> > Failed to apply plugin [id 'org.ajoberstar.grgit'] >>>> >>>> > One of setGitDir or setWorkTree must be called. >>>> >>>> >>>> >>>> * Try: >>>> >>>> Run with --stacktrace option to get the stack trace. Run with --info or >>>> --debug option to get more log output. >>>> >>>> >>>> >>>> BUILD FAILED >>>> >>>> >>>> >>>> Total time: 10.757 secs >>>> >>>> [dor@localhost incubator-geode-develop]$ >>>> >>>> >>>> >>>> >>>> >>>> Any ideas? What am I doing wrong ? >>>> >>>> >>>> >>>> >>>> >>>> Regards, >>>> >>>> Dor Ben Dovd >>>> >>>> >>>> >>>> This message and the information contained herein is proprietary and >>>> confidential and subject to the Amdocs policy statement, you may review at >>>> http://www.amdocs.com/email_disclaimer.asp >>>> >>>> >>>> >>>> >>>> >>> >>> >> >> >> -- >> -John >> 503-504-8657 >> john.blum10101 (skype) >> > >
