11

Does anyone know if there will be support for GlassFish 5 in Eclipse in nearer future (GlassFish Tools supports 3.1 and 4.x)?

Is there another way to integrate Glassfish in Eclipse besides GlassFish Tools?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Flocke
  • 764
  • 6
  • 14

4 Answers4

12

GlassFish Tools just checks for a version as follows:

Version version = getVersion();

if (!version.matches("[3.1-5)")) {
    return new Status(Status.ERROR, GlassfishToolsPlugin.SYMBOLIC_NAME, Messages.unsupportedVersion);
}

Where getVersion() is obtained from reading [install dir]/glassfish/modules/glassfish-api.jar!META-INF/MANIFEST.MF and then the Bundle-Version entry.

So a hacky way to get Eclipse working with GlassFish 5 and Payara 5 is:

  1. cd [install dir]/glassfish/modules/
  2. mkdir META-INF
  3. unzip -p glassfish-api.jar META-INF/MANIFEST.MF > META-INF/MANIFEST.MF
  4. vim META-INF/MANIFEST.MF
  5. Change Bundle-version to start with a 4 and make sure digits are all single (i.e. 181 should become 0 or so)
  6. zip -u glassfish-api.jar META-INF/MANIFEST.MF

Now you can add a runtime and server for GlassFish 5 and Payara 5 as you would normally do, and start, debug, deploy etc.

For illustration, the entry to be changed looks as follows:

Bundle-Name: Public APIs of Glassfish
Bundle-Version: 5.181.0.Alpha4-SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_144

Should become:

Bundle-Name: Public APIs of Glassfish
Bundle-Version: 4.0.0.Alpha4-SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_144

The GlassFish tooling is currently in proposal to be donated to Eclipse, so it may take a while to be updated. Meanwhile, I'm planning to create a derivative version before long with some extra enhancements, but that too may take some time.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
  • 1
    Interesting approach - Ill give this a try tonight – farrellmr Nov 20 '17 at 09:26
  • 1
    I tried this and it lets you install Glassfish 5 on eclipse. The only problem is that you cant connect up Java 9 JDK. Thanks Arjan because it lets me do work in eclipse using GF5 – farrellmr Nov 23 '17 at 14:47
2

Eclipse Oxygen.3a (4.7.3a) now supports Glassfish 5enter image description hereenter image description here

for Eclipse photon users checkout my question and the chosen answer Cannot install Glassfish tools in Eclipse photon

usertest
  • 2,140
  • 4
  • 32
  • 51
0

Unfortunately there's no support yet, but you could build your JavaEE app (EAR,WAR) grab the .war|ear file and paste it in

[GF_LOCATION]\glassfish5\glassfish\domains\[DOMAIN]\autodeploy\

Then go to [GF_LOCATION]\glassfish5\bin\

Open a terminal and run:

asadmin start-domain [DOMAIN]

If you've configured your app correctly, you should be able to access you application locally, something like:

localhost:8080/YourApp/

If you require a datasource and connection_pool then from bin, run:

asadmin add-resources [location_to_you_app's_glassfish-resources.xml]

This should add the configuration needed in GF5 to run your app.

Alternative

Use Netbeans, I've been able to configure Glassfish 5 in netbeans. Unfortunately, currente version, 8.2 doesn't have JavaEE 8 detection and automatic file completion yet, so you will have to add this configuration manually if you plan to use JSF 2.3,Servlet 4.0, etc ..., but at least you are able con configure and run you applications from your IDE onto Glassfish 5.

Esteban Rincon
  • 2,040
  • 3
  • 27
  • 44
  • 1
    Interesting detail: The Java EE 8 - "First Cup Indroduction" recommends Glassfish5 and NetBeans >= 8.2 or Eclipse Oxygen (4.7) and describes the integration of Glassfish5 in NetBeans: https://javaee.github.io/firstcup/intro002.html – Flocke Oct 10 '17 at 15:38
-2

To integrate payara5 with Eclipse 4.7.1a via Oracle "GlassFish Tools" I hat to modify within file \payara5\glassfish\modules\glassfish-api.jar the file META-INF\MANIFEST.MF at the end of the content as follows:

...;version="4.0.0" Bundle-Name: Public APIs of Glassfish Bundle-Version: 4.0 Created-By: Apache Maven Bundle Plugin Build-Jdk: 1.8.0_152