aspose file tools*
The moose likes Other Java Products and Servers and the fly likes Cannot set up glassfish on mac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Cannot set up glassfish on mac" Watch "Cannot set up glassfish on mac" New topic
Author

Cannot set up glassfish on mac

tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
I have read the manuals and guides but still can't get glassfish to set up on my machine.
I downloaded the latest version of glassfish in zip format.
I unzipped this using the terminal so i have my glassfish3 folder.
When i navigate to this folder in terminal glassfish3/bin i enter the command start-domain.
This keeps returning an error asadmin: command not found
If i look in the bin folder i have the asadmin file but it wont execute when i navigate to it this way.
Any ideas?
Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

I don't use glassfish, but it sounds like the bin folder may not have been added to the PATH environment variable. (Though if it's in the current directory, I'd expect that it'd pick it up anyways.)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
How would i do this, to check if that is the problem?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

In your ~ folder you should have a .bash_profile or a .bashrc file. If not, you can create one.

In the file you can add the folder to the definition of the PATH variable. (Be sure to leave ":." at the end if it's already there).
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

In the file you should have a statement like the following (this is from mine -- it's a single line, wrapped here for readability).


Add the folder to this list, delimited by :.

Again, be sure to leave ":." as the trailing entry.

If this doesn't help your original issue, at least you'll have learned how to add a folder to PATH.
tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
You posted that reply when i was in the middle of mine.
I dont think i have a bash file
Could you give me a step by step of how to create one, where to put it and what to include etc? Not really sure what i should be doing.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

No probs. Do this:

  • Open a Terminal window (or get iTerm, which I prefer)
  • Do pwd. Make sure that you are "in" your home folder. That's the default so you should be. To make absolutely sure you can enter cd ~
  • Do ls -al
  • Check the results to see if you have a .bashrc or .bash_profile file in that folder. The leading dot make the files hidden, so they won't show up in Finder.

  • Post back with whether you have such a file or not.
    tom davies
    Ranch Hand

    Joined: Apr 27, 2012
    Posts: 168
    Thanks a lot.
    That is what i did to check previously.
    I only have .bash_history but not the files you mentioned
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61224
        
      66

    So you have no PATH already defined? I forget if there's a default one.

    Does echo $PATH display anything?
    tom davies
    Ranch Hand

    Joined: Apr 27, 2012
    Posts: 168
    That displays this.
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61224
        
      66

    OK, so here goes:

  • Enter touch .bash_profile (this will create the empty file)
  • Open the file with the text editor of your choice
  • Add: export PATH=$PATH:desired-list-folders:. (replacing desired-list-of-folders with a colon delimited list of folders you want on the PATH)

  • Close an reopen the Terminal window (or enter source ~/.bash_profile)
    Type echo $PATH and make sure it's correct.

    Now when you type a command, all folders in PATH will be checked for the command file.
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61224
        
      66

    When all is said and done, I believe that the lack of the trailing . on PATH may be what caused the "not found" error. Nothing was set up to cause the current folder to be searched as part of the PATH.

    I'd be surprised if this doesn't solve the issue (but stranger things have happened).
    tom davies
    Ranch Hand

    Joined: Apr 27, 2012
    Posts: 168
    Just to clarify would this be what i am looking for to put into the file?
    export PATH=$PATH:usr/documents/glassfish3/bin:.
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61224
        
      66

    tom davies wrote:Just to clarify would this be what i am looking for to put into the file?
    export PATH=$PATH:usr/documents/glassfish3/bin:.


    Close: export PATH=$PATH:/usr/documents/glassfish3/bin:.

    (absolute paths begin with /)

    But if you were always going to cd into the bin folder, you could get away with just export PATH=$PATH:.

    Adding the glassfish folder should allow to issue the commands without having to cd.
    tom davies
    Ranch Hand

    Joined: Apr 27, 2012
    Posts: 168
    Thank you. Well that has worked now. i can now input the commands i want BUT, and there had to be a but didn't there. I am now getting another error.
    asadmin> asadmin start-domain
    Remote server does not listen for requests on [localhost:4848]. Is the server up?
    No such local command, asadmin. To run remote commands, start the application server (e.g. 'asadmin start-domain').
    Command asadmin failed.

    I will have a search and see what problem this could be.
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61224
        
      66

    Yeah, now you're in Glassfish territory and I'm useless!

    But glad to help you to this point. (And now you know about PATH and the bash shell's init file!)
    tom davies
    Ranch Hand

    Joined: Apr 27, 2012
    Posts: 168
    Does anyone have any ideas about this? Really need it working asap but still have the same problem. I read somewhere that i should check my hostname resolves to an IP address? I can navigate to my etc/hosts file i just dont know what i am looking for, or what to change.
    K. Tsang
    Bartender

    Joined: Sep 13, 2007
    Posts: 2419
        
        7

    Hello you should able to cd to the bin directory and type
    "./asadmin start-domain"

    Make sure there is a ./ (dot + slash) in front to indicate it's the current directory.

    To stop it
    "./asadmin stop-domain"

    Oh there are in fact 2 bin directories. Say you have it installed in glassfish3 dir. The first one is in glassfish3/bin and the other one in glassfish3/glassfish/bin. Using either of these are fine.

    Hope this helps.


    K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
    tom davies
    Ranch Hand

    Joined: Apr 27, 2012
    Posts: 168
    I dont know how but its fixed itself. I had a mess around with the etc/hosts file and before where it used to say my-imac it now says My-iMac in capitals . . .
    I dont know if that is related to anything i did or the fact it now works but it works for now, lets hope when i restart it, it stays the same ha.
    Thanks for the help and the lessons on PATH ;) i will be back if i have any more trouble
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Cannot set up glassfish on mac