marți, 15 iulie 2014

Some Glassfish issues: instalation, stuff.....

In order to have the Glassfish server working, you must install JDK 1.7xxxxx.
So, download from here the jdk kit.
Then, download from here the glassfish server. I preffer the linux version.
Now, let's assume that you have the jdk folder under /usr/java and glassfish4 folder under /opt.
Make an environment script:
export JAVA_HOME=/usr/java/jdk1.7.0_60/bin
export PATH=$JAVA_HOME/bin:/opt/glassfish4/bin:$PATH

and run the script.
All you have to do now is to start the domain:
/opt/glassfish4/bin/asadmin start-domain
Let's study some problems that can appear:
• Exception in thread "main" java.lang.UnsupportedClassVersionError: org/glassfish/admin/cli/AsadminMain : Unsupported major.minor version 51.0
the problem is java executable is another version, lower one. Make a symbolic link:
 rm /usr/bin/java
 ln -s /usr/java/jdk1.7.0_60/bin/java /usr/bin/java ws1: ws1: Temporary failure in name resolution
your /etc/hosts file is wrong.
There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
Could be the same problem as above, the file /etc/hosts should resolve the ip properly, or can be a problem with that port. The netstat will help:
netstat -natp
if you'll receive something like this:
tcp   0  0 :::4848       :::*            LISTEN      7943/java
just kill that process, if it is not a wanted process for you:
ps -ef | grep java
root      7943     1 15 11:12 pts/1    00:00:38 /usr/java/jdk1.7.0_60/bin/java  .....................
kill -9 7943
and that's all.
Now, you should see this:
/opt/glassfish4/bin/asadmin start-domain
Waiting for domain1 to start .......
Successfully started the domain : domain1
domain  Location: /opt/glassfish4/glassfish/domains/domain1
Log File: /opt/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Open in a browser
http:<your hostname or ip>:4848
Now, you can experience the following error:

Secure Admin must be enabled to access the DAS remotely

First, you have to change the admin password, otherwise the secure mode cannot be enabled.

/opt/glassfish4/bin/asadmin change-admin-password

the old password is blank (or adminadmin, or admin, ...). As far as i know, is blank.

After the password is changed:




and now everything should be fine.
The admin console has to be there.

Now, let's create a jdbc connection pool:

copy the ojdbc6.jar from here and put it here:


then restart the domain:

> create-jdbc-connection-pool --restype javax.sql.DataSource --datasourceclassname oracle.jdbc.pool.OracleDataSource --property "user=hr:password=hr: url=jdbc\\:oracle\\:thin\\:@ws1\\:1521\\:ws1" ws1pool

where we assume that hr/hr is the user credentials, ws1 is the hostname, 1521 the listener port and ws1 the service name.

Now go to the admin console, jdbc connection pools, click on the new connection pool name, and then ping it. You should receive the message "ping succeeded".

Niciun comentariu:

Trimiteți un comentariu