james
james

Reputation: 1687

Cannot set the glassfish server runtime enviroment in eclipse

I changed my default jre to jdk 1.7x in eclipse kepler. I was getting a null pointer exception when I started glassfish 4. To fix this issue, I did all the steps to change the jre/jdk of my glassfish. On the final screen, when I click finish, nothing happens. This looks like a bug in the software. Please help me to fix my problem.

enter image description here

Note: When I try to clean the server using my server > right click > clean, I get the same null pointer exception again.

Edit- I tried one solution which does not help:

Apparently when Glassfish is installed it hard-codes its reference to your JDK location, so to fix this problem I ended up having to edit a file named asenv.bat. In short, I edited this file:

C:\glassfish\config\asenv.bat.

and I commented out the reference to JDK 6 and added a new reference to JDK 5, like this:

REM set AS_JAVA=C:\Program Files\Java\jdk1.6.0_04\jre/..
set AS_JAVA=C:\Program Files\Java\jdk1.5.0_16

This solved the problem, and Glassfish started right up after this change.

But my asenv.dat file contains no such path. Anyway, I added set AS_JAVA = my jdk path here and it did not help.

set AS_IMQ_LIB=..\..\mq\lib
set AS_IMQ_BIN=..\..\mq\bin
set AS_CONFIG=..\config
set AS_INSTALL=..
set AS_DEF_DOMAINS_PATH=..\domains
set AS_DEF_NODES_PATH=..\nodes
set AS_DERBY_INSTALL=..\..\javadb
REM I added my line here

Another solution which leaves me with the same problem: Install latest eclipse luna with latest glassfish 4.

enter image description here

Upvotes: 0

Views: 7810

Answers (4)

Jackson Cassimiro
Jackson Cassimiro

Reputation: 527

Save the server and try to add a new module again.

See more: https://www.eclipse.org/forums/index.php/t/1072242/

Upvotes: 0

Shri H.
Shri H.

Reputation: 1

Here is the Answer :

Glass-fish Requires JDK , somehow it is unable to get it. We can solve this issue just click on the JRE preference link. And add one more entry of JDK in that popup window. Now you should be able to select & proceed further with the Glass-fish installation.

Upvotes: 0

james
james

Reputation: 1687

First, delete the glassfish server in servers window in eclipse. Then, in my second screenshot, in the window below the front window, i.e where you see Invalid JRE in red, delete the glassfish server. Then, recreate a glassfish server from the servers window from scratch. Your problem will be solved. I had also reinstalled my jdk, so I am not sure if that also helps. Anyway the glassfish server is atleast running now.

Upvotes: 0

Mr_and_Mrs_D
Mr_and_Mrs_D

Reputation: 34076

It is a bug - see here the comment by BalusC

The only sure way to workaround is to delete your server runtime and create it anew.

And by the way - Luna is the latest eclipse release - maybe update ?

Upvotes: 1

Related Questions