Skip to main content

Installing Glassfish on Linux

14 replies [Last post]
losintikfos
Offline
Joined: 2008-02-17

Hi Experts,

I am trying to install glassfish on fedoraCORE8, but if i run the command;
lib/ant/bin/ant -f setup.xml

i get the following errors:

lib/ant/bin/ant: line 80: uname: command not found
/usr/share/java-utils/java-functions: line 135: sed: command not found
/usr/share/java-utils/java-functions: line 150: sed: command not found
/usr/share/java-utils/java-functions: line 150: sed: command not found
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:221)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
Error: Could not find the main class.
Error: A JNI error has occurred, please check your installation and try again

Can anyone spot what i am doing wrong?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Kristian Rink

Hi there:

looking at this...

glassfish@javadesktop.org schrieb:
[...]
> BUILD FAILED /root/Download/glassfish/setup.xml:156: The following
> error occurred while executing this line:
> /root/Download/glassfish/setup.xml:146: Glassfish requires JDK 1.5 or
> higher, you have java version "1.7.0" IcedTea Runtime Environment
> (build 1.7.0-b21) IcedTea Client VM (build 1.7.0-b21, mixed mode)

... and at the path in your earlier messages
(/usr/java/jdk1.6.0_06/bin), I am sort of confused which version of JDK
you are actually running on your machine. Browsing around I found [1]
reporting certain issues installing Glassfish with the IcedTea 1.7.0 JDK
package which seems to fit your problem rather well. Plus, given you
possibly(?) have two JDKs installed, maybe you're simply using the wrong
one. I am curious whether, on your machine, the output of

java -version (no full path) and

/usr/java/jdk1.6.0_06/bin/java -version

will be the same? Personally, it's things like that to initially make me
distrust distribution-specifically prepackaged JDKs and installing Java
along with Glassfish somewhere in /opt, out of the way of package
management. ;)

Cheers,
Kristian

[1] http://www.ensode.net/java_fedora_8_icedtea.html

--
Kristian Rink * http://zimmer428.net * http://flickr.com/photos/z428/
jab: kawazu@jabber.ccc.de * icq: 48874445 * fon: ++49 176 2447 2771 "One
dreaming alone, it will be only a dream; many dreaming together is the
beginning of a new reality." (Hundertwasser)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

losintikfos
Offline
Joined: 2008-02-17

i did java -version in the two folds!
one from root and one from /usr/java/jdk1.6.0_06/bin/ and got the same results.

java version "1.7.0"
IcedTea Runtime Environment (build 1.7.0-b21)
IcedTea Client VM (build 1.7.0-b21, mixed mode)

Pretty confused cos i have done something like this

export PATH=$PATH:/usr/bin:/bin/:/usr/java/jdk1.6.0_06/bin
export JAVA_HOME=/usr/java/jdk1.6.0_06/

as you you did suggest.

Kristian Rink

glassfish@javadesktop.org schrieb:
> i did java -version in the two folds!
> one from root and one from /usr/java/jdk1.6.0_06/bin/ and got the same results.
[...]
> java version "1.7.0"
> IcedTea Runtime Environment (build 1.7.0-b21)
> IcedTea Client VM (build 1.7.0-b21, mixed mode)
>
> Pretty confused cos i have done something like this
[...]

Same here. :) Is there anything else asides the jdk1.6.0_06 in
/usr/java/? I know that Fedora Core does ship with the IcedTea Java
implementation by default however why to "camouflage" a 1.7.0 build as
an 1.6.0_06 JDK implementation so far is beyond my understanding. Last
shot possibly would be to

- download an "official" Sun 1.6 JDK off java.sun.com,

- install this in a reasonable place (/opt/jdk1.6.0_06),

- set things right to make this found first in any possible case

export JAVA_HOME=/opt/jdk1.6.0_06
export PATH=$JAVA_HOME/bin:$PATH

- unpack and setup glassfish, then, and try whether the domain starts
over fine.

For anything beyond this I am afraid I'm not that familiar with the
recent Fedora distributions anymore so, this being more an issue of the
Java configuration in Fedora Core 8 than a Glassfish related problem,
I'd possibly check back with the Fedora Java FAQ [1] and/or see whether
some Fedora newsgroup / mailing list closer to the Fedora distribution
itself can possibly be of more en-detail help on that. Sorry I can't be
of more specific help on that, good luck nevertheless... :)

Cheers,
Kristian

[1] http://fedoraproject.org/wiki/JavaFAQ

--
Kristian Rink * http://zimmer428.net * http://flickr.com/photos/z428/
jab: kawazu@jabber.ccc.de * icq: 48874445 * fon: ++49 176 2447 2771 "One
dreaming alone, it will be only a dream; many dreaming together is the
beginning of a new reality." (Hundertwasser)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

mamun_916
Offline
Joined: 2007-08-10

Hi
I got the same problem in fedore core 3. but i do not get the error on red hat enterprise edition 2. can u tell me where i am worng? or it is glassfish problem.

Mamun

lib/ant/bin/ant -f setup.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.

[root@server glassfish]# echo $PATH
bash: /usr/kerberos/sbin:/home/mamun/jdk1.6.0_10/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/mamun/bin: No such file or directory

losintikfos
Offline
Joined: 2008-02-17

I think this is perhaps got to do with Java CLASSPATH settings!

Do anyone know how to set the Java CLASSPATH in core8?

Kristian Rink

glassfish@javadesktop.org schrieb:
> I think this is perhaps got to do with Java CLASSPATH settings!

I'm not sure but overally this does look a little strange to me;
commands like "sed", "uname" and the like not being found shouldn't at
all relate to the Java installation on that machine. From that point of
view I guess it is more likely to be a $PATH issue. How does your PATH
setting look like? How did you actually start the Glassfish installer?
Personally I think the "NoClassDefFound" might be caused just by these
other issues. What JDK are you using by the way?

Cheers,
Kristian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

losintikfos
Offline
Joined: 2008-02-17

Hi Kristian,

I did echo $PATH and got the follow poped out

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/sbin:/usr/sbin:/ sbin:/usr/java/jdk1.6.0_06/bin::/root/bin

The part i am pretty interesting in is the [b]usr/java/jdk1.6.0_06/bin:[/b] which what i did specified my CLASSPATH in the command line to be.

I am currently using JDK1.6.0 Update 6.

Here is how i did start the installation;#

1.I did download the on onto my core8 machine
2.Did % java -Xmx256m -jar filename.jar to extract the content
3.Got into the glassfish directory basically using [i]cd glassfish[/i]
4. Did this chmod -R +x lib/ant/bin
5. Tried to run the setup using lib/ant/bin/ant -f setup.xml

At first i got a BUILD failed error: asking to install JDK - which i had already installed, so decided to run the command:

PATH=/usr/java/jdk1.6.0_06/bin:
export PATH

It is after this that i realised stack trace posted above.

Kristian Rink

Hi there;

glassfish@javadesktop.org schrieb:
> I did echo $PATH and got the follow poped out
>
> /usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/sbin:/usr/sbin:/
> sbin:/usr/java/jdk1.6.0_06/bin::/root/bin

Being working as 'root'? I wonder not seeing /bin and /usr/bin on this
list, that's where things like "uname" usually should be found.

> At first i got a BUILD failed error: asking to install JDK - which i
> had already installed, so decided to run the command:
>
> PATH=/usr/java/jdk1.6.0_06/bin: export PATH
>

That's close to what I supposed. Issuing this command is likely to set
your PATH to _only_ be the JDK/bin, which basically gives the system no
chance of actually knowing about / finding uname, sed and friends. ;) If
doing so, I recommend something like this:

export PATH=/usr/bin:/bin/:/usr/java/jdk1.6.0_06/bin

or, better,

export PATH=$PATH:/usr/bin:/bin/:/usr/java/jdk1.6.0_06/bin

($PATH to keep its former content and just "add" the other values to it).

About not finding the JDK, which message did the installer exactly
provide you with? Maybe you should do something like

export JAVA_HOME=/usr/java/jdk1.6.0_06/

to get this resolved?

Cheers & good luck,
Kristian

--
Kristian Rink * http://zimmer428.net * http://flickr.com/photos/z428/
jab: kawazu@jabber.ccc.de * icq: 48874445 * fon: ++49 176 2447 2771 "One
dreaming alone, it will be only a dream; many dreaming together is the
beginning of a new reality." (Hundertwasser)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

losintikfos
Offline
Joined: 2008-02-17

Hi Kristian,

You the mann! just kicked in straight like that. I really appreciate you expert advice and support.

B

Kristian Rink

glassfish@javadesktop.org schrieb:
> You the mann! just kicked in straight like that. I really appreciate
> you expert advice and support.

No problem. Glad to know it worked. :)
Cheers,
Kristian

--
Kristian Rink * http://zimmer428.net * http://flickr.com/photos/z428/
jab: kawazu@jabber.ccc.de * icq: 48874445 * fon: ++49 176 2447 2771 "One
dreaming alone, it will be only a dream; many dreaming together is the
beginning of a new reality." (Hundertwasser)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

losintikfos
Offline
Joined: 2008-02-17

Quick ONe Kristian!

I am trying to start the server using [i][b]asadmin Use[/b][/i] command at [i][b]glassfish/bin[/b][/i] directory and keep saying command not found. Can you help me please..

Kristian Rink

glassfish@javadesktop.org schrieb:
> Quick ONe Kristian!
>
> I am trying to start the server using [i][b]asadmin Use[/b][/i]
> command at [i][b]glassfish/bin[/b][/i] directory and keep saying
> command not found. Can you help me please..

Chances are that, after unpacking glassfish, you didn't run the

ant -f setup.xml

command in the glassfish folder - this is responsible for creating an
initial configuration / domain, and after doing so, asadmin and friends
will be right around waiting to be needed. ;)

Cheers,
Kristian

--
Kristian Rink * http://zimmer428.net * http://flickr.com/photos/z428/
jab: kawazu@jabber.ccc.de * icq: 48874445 * fon: ++49 176 2447 2771 "One
dreaming alone, it will be only a dream; many dreaming together is the
beginning of a new reality." (Hundertwasser)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

losintikfos
Offline
Joined: 2008-02-17

After following the previous enviroment setting you aid me through, i did this

[i]lib/ant/bin/ant -f setup.xml[/i] which i think is the same as [i]ant -f setup.xml[/i] and things kicked it + popped up BUILD SUCCESSFUL.

Having read your last post, i decided to do [i]ant -f setup.xml[/i] and keeps coming up with this error which i was having previously.

BUILD FAILED
/root/Download/glassfish/setup.xml:156: The following error occurred while executing this line:
/root/Download/glassfish/setup.xml:146: Glassfish requires JDK 1.5 or higher, you have java version "1.7.0"
IcedTea Runtime Environment (build 1.7.0-b21)
IcedTea Client VM (build 1.7.0-b21, mixed mode)

Total time: 2 seconds

losintikfos
Offline
Joined: 2008-02-17

I have followed the steps from top to down and did start to behave well again, then all of a suden i got this:

create.domain:
[exec] Domain domain1 already exists in /root/Download/glassfish/domains. U se a different domain name or the --domaindir option.
[exec] CLI130 Could not create domain, domain1

BUILD FAILED
/root/Download/glassfish/setup.xml:172: The following error occurred while execu ting this line:
/root/Download/glassfish/setup.xml:561: exec returned: 1

Is it because the installation still exist? if so why won't it allow me to start the server? anything i am doing wrong>