Hi Habeeb,

A better workaround for this is to simply enable the jenv plugin for
exporting JAVA_HOME:

$ jenv enable-plugin export

This will allow you to avoid setting the CLASSPATH env var. The current
JAVA_HOME will always reflect the current version that jenv is pointing at.
This works with local and global jenv configured versions.

Example:

$ jenv global oracle64-1.6.0.65
$ echo $JAVA_HOME
/Users/klund/.jenv/versions/oracle64-1.6.0.65

$ cd apache-geode-1.0.0-incubating.M3/bin
$ jenv local oracle64-1.8.0.66
$ echo $JAVA_HOME
/Users/klund/.jenv/versions/oracle64-1.8.0.66
$ ./gfsh

...and gfsh will be running under Java version 1.8.0.66 as long as you've
launched it from apache-geode-1.0.0-incubating.M3/bin. This prevents gfsh
from incorrectly using a jar file from 1.6.0_65.

gfsh>start server --name=server
Starting a Geode Server in
/Users/klund/apache-geode-1.0.0-incubating.M3/bin/server...
....
Server in /Users/klund/apache-geode-1.0.0-incubating.M3/bin/server on
pdx2-office-dhcp32.eng.vmware.com[40404] as server is currently online.
Process ID: 54719
Uptime: 2 seconds
GemFire Version: 1.0.0-incubating.M3
Java Version: 1.8.0_66
Log File:
/Users/klund/apache-geode-1.0.0-incubating.M3/bin/server/server.log
JVM Arguments: -Dgemfire.use-cluster-configuration=true
-XX:OnOutOfMemoryError=kill -KILL %p
-Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true
-Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path:
/Users/klund/apache-geode-1.0.0-incubating.M3/lib/geode-core-1.0.0-incubating.M3.jar:/Users/klund/apache-geode-1.0.0-incubating.M3/lib/geode-dependencies.jar

I will still alter the gfsh script in M4 to fix this issue for when jenv
export plugin is not enabled.

Thanks,
Kirk


On Thu, Sep 1, 2016 at 2:08 PM, Habeeb Rahman <habionl...@gmail.com> wrote:

> Hi Kirk
> Its the same here
>
> localhost:bin hrahman$ /System/Library/Frameworks/
> JavaVM.framework/Versions/CurrentJDK/Commands/java -version
>
> java version "1.6.0_65"
>
> Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
>
> Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
>
>
> Thanks
>
> Habeeb
>
> On Thu, Sep 1, 2016 at 2:01 PM, Kirk Lund <kl...@pivotal.io> wrote:
>
>> That's good!
>>
>> Can you please give me one more piece of data? I notice that on my Mac,
>> the version of Java that is located in /System/Library/Frameworks/Jav
>> aVM.framework/Versions/CurrentJDK is 1.6.0_65 and that's apparently the
>> location that gfsh attempts to go to for the tools.jar. What version do you
>> have if you execute the following?
>>
>> $ 
>> /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java
>> -version
>> java version "1.6.0_65"
>> Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
>> Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
>>
>> Thanks,
>> Kirk
>>
>>
>> On Thu, Sep 1, 2016 at 1:49 PM, Habeeb Rahman <habionl...@gmail.com>
>> wrote:
>>
>>> Thanks Kirk for the support
>>> I was able to make it working
>>>
>>> Thanks
>>> Habeeb
>>>
>>> On Thu, Sep 1, 2016 at 1:32 PM, Kirk Lund <kl...@pivotal.io> wrote:
>>>
>>>> Hi Habeeb,
>>>>
>>>> I experience the same when I try to use apache-geode-1.0.0-incubating.M3
>>>> on Mac. It seems to fail to find the Attach API which is in the tools.jar.
>>>>
>>>> (I'm using /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/H
>>>> ome)
>>>>
>>>> $ ./gfsh
>>>>     _________________________     __
>>>>    / _____/ ______/ ______/ /____/ /
>>>>   / /  __/ /___  /_____  / _____  /
>>>>  / /__/ / ____/  _____/ / /    / /
>>>> /______/_/      /______/_/    /_/    1.0.0-incubating.M3
>>>>
>>>> Monitor and Manage Apache Geode (incubating)
>>>> gfsh>start server --name=server
>>>> Starting a Geode Server in /Users/klund/apache-geode-1.0.
>>>> 0-incubating.M3/bin/server...
>>>> An error occurred while attempting to start a Geode Cache Server:
>>>> sun.tools.attach.MacosxVirtualMachine.isLinuxThreads()Z
>>>>
>>>> The server named "server" actually starts up fine but GFSH is unable to
>>>> get its status because the GFSH process is failing to load
>>>> sun.tools.attach. MacosxVirtualMachine.
>>>>
>>>> The "gfsh" script is written for Linux, and I believe we'll need to
>>>> alter the script some to make it work on Mac. I'll file a bug for this.
>>>>
>>>> For now, the best workaround I can offer up is to add the tools.jar to
>>>> your CLASSPATH:
>>>>
>>>> $ export CLASSPATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/
>>>> Contents/Home/lib/tools.jar
>>>>
>>>> $ ./gfsh
>>>>     _________________________     __
>>>>    / _____/ ______/ ______/ /____/ /
>>>>   / /  __/ /___  /_____  / _____  /
>>>>  / /__/ / ____/  _____/ / /    / /
>>>> /______/_/      /______/_/    /_/    1.0.0-incubating.M3
>>>>
>>>> Monitor and Manage Apache Geode (incubating)
>>>> gfsh>start server --name=server
>>>> Starting a Geode Server in /Users/klund/apache-geode-1.0.
>>>> 0-incubating.M3/bin/server...
>>>> ....
>>>> Server in /Users/klund/apache-geode-1.0.0-incubating.M3/bin/server on
>>>> pdx2-office-dhcp32.eng.vmware.com[40404] as server is currently online.
>>>> Process ID: 50858
>>>> Uptime: 2 seconds
>>>> GemFire Version: 1.0.0-incubating.M3
>>>> Java Version: 1.8.0_66
>>>> Log File: /Users/klund/apache-geode-1.0.0-incubating.M3/bin/server/ser
>>>> ver.log
>>>> JVM Arguments: -Dgemfire.use-cluster-configuration=true
>>>> -XX:OnOutOfMemoryError=kill -KILL %p 
>>>> -Dgemfire.launcher.registerSignalHandlers=true
>>>> -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterva
>>>> l=9223372036854775806
>>>> Class-Path: /Users/klund/apache-geode-1.0.
>>>> 0-incubating.M3/lib/geode-core-1.0.0-incubating.M3.jar:/User
>>>> s/klund/apache-geode-1.0.0-incubating.M3/lib/geode-dependencies.jar
>>>>
>>>> Thanks,
>>>> Kirk
>>>>
>>>>
>>>> On Thu, Sep 1, 2016 at 1:06 PM, Habeeb Rahman <habionl...@gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks for the reply Swapnil
>>>>>
>>>>> I ran the following
>>>>>
>>>>> localhost:bin hrahman$ java -version
>>>>>
>>>>> java version "1.8.0_31"
>>>>>
>>>>> Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
>>>>>
>>>>> Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
>>>>>
>>>>>
>>>>> localhost:bin hrahman$ /usr/libexec/java_home -V
>>>>>
>>>>> Matching Java Virtual Machines (4):
>>>>>
>>>>>     1.8.0_31, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachi
>>>>> nes/jdk1.8.0_31.jdk/Contents/Home
>>>>>
>>>>>     1.7.0_71, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachi
>>>>> nes/jdk1.7.0_71.jdk/Contents/Home
>>>>>
>>>>>     1.6.0_65-b14-466.1, x86_64: "Java SE 6"
>>>>> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
>>>>>
>>>>>     1.6.0_65-b14-466.1, i386: "Java SE 6"
>>>>> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
>>>>>
>>>>>
>>>>> /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
>>>>>
>>>>> localhost:bin hrahman$
>>>>>
>>>>>
>>>>> I have restarted my macbook in between. So I had set the JAVA_HOME and
>>>>> PATH properties once more as they were not yet added to the bash_profile
>>>>>
>>>>> Thanks
>>>>>
>>>>> Habeeb
>>>>>
>>>>> On Thu, Sep 1, 2016 at 12:34 PM, Swapnil Bawaskar <
>>>>> sbawas...@pivotal.io> wrote:
>>>>>
>>>>>> Looks like a JDK problem. Which JDK are you using? Can you please
>>>>>> provide an output of running "/usr/libexec/java_home" and "java 
>>>>>> -version"?
>>>>>> Also did you make any changes to the jdk between your first and
>>>>>> second attempts?
>>>>>>
>>>>>> On Thu, Sep 1, 2016 at 10:56 AM, Habeeb Rahman <habionl...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi
>>>>>>> I was trying with the Apache Geode for the first time
>>>>>>> Initially I was able to start the locator and server properly and I
>>>>>>> was able to create the region as well.
>>>>>>> But when I tried next time, I am getting some error. I have ensured
>>>>>>> both the previous locator and server are killed before starting the new
>>>>>>> locator and server. But still the error is present. Even the log file 
>>>>>>> under
>>>>>>> locator and server are not providing any info
>>>>>>>
>>>>>>> Can you please help me out here
>>>>>>>
>>>>>>> gfsh>start locator --name=locator
>>>>>>>
>>>>>>> Starting a Geode Locator in /Users/hrahman/apache-geode-1.
>>>>>>> 0.0-incubating.M3/bin/locator...
>>>>>>>
>>>>>>> An error occurred while attempting to start a Locator in
>>>>>>> /Users/hrahman/apache-geode-1.0.0-incubating.M3/bin/locator on
>>>>>>> rws-habeeb.saba.com[10334]: sun.tools.attach.MacosxVirtual
>>>>>>> Machine.isLinuxThreads()Z
>>>>>>>
>>>>>>>
>>>>>>> gfsh>start server --name=server
>>>>>>>
>>>>>>> Starting a Geode Server in /Users/hrahman/apache-geode-1.
>>>>>>> 0.0-incubating.M3/bin/server...
>>>>>>>
>>>>>>> An error occurred while attempting to start a Geode Cache Server:
>>>>>>> Could not initialize class sun.tools.attach.MacosxVirtualMachine
>>>>>>>
>>>>>>>
>>>>>>> gfsh>
>>>>>>>
>>>>>>> --
>>>>>>> Regards
>>>>>>> Habeeb
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards
>>>>> Habeeb
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Regards
>>> Habeeb
>>>
>>
>>
>
>
> --
> Regards
> Habeeb
>

Reply via email to