2

I have a Maven jersey-quickstart-webapp Project I am developing in Eclipse. The project is a JERSEY REST backend with angularjs javascript frontend.

I would like to know how to check what version of EclipseLink my project is using.

Where can I find this property? I've searched high and low but I can't find it - I know that I did stumble across it before, so it definitely exists....

This question is trying to get to the bottom of the following question I posed months ago about a problem with eclipselink and Jersey REST, that still hasn't been fixed: Class not found when using JAX-RS with Eclipse and Glassfish This should be fixed with jersey 2.22.1 and eclipselink 2.6.1, but I think somewhere in my setup, eclipselink 2.6.0 is still hanging around and screwing the whole thing up. Highly frustrating!

I know that eclipselink is being used in this project, because the following code returns 2.6.1 when the project is running. However, previously I saw that even though this was saying 2.6.1, that the eclipselink configuration somewhere(I can't remember where - doh!) was still saying version 2.6.0.

//This helps us tell what version of eclipse link we are using
Class<?> myClass = Class.forName("org.eclipse.persistence.Version");
Method myMethod = myClass.getMethod("getVersion");
String version = myMethod.invoke(null).toString();
System.out.println("version = " + version);

Here is what the Maven dependency hierarchy looks like - as you can see it has no eclipselink stuff in there: Maven dependency hierarchy

All help highly appreciated...

Community
  • 1
  • 1
Tom O'Brien
  • 1,741
  • 9
  • 45
  • 73
  • What happens if you go to help ->install new software->what's already installed->checked the version of eclipse installed... – saurav Mar 04 '16 at 13:32
  • I've had a look there - the only think that mentions eclipse link is "Dali Java Persistence Tools". I don't know what these are, and the version numbers look very different to the current 2.6.1/2 for eclipselink. I'll upload a screen shot to the question in a minute... Tom – Tom O'Brien Mar 04 '16 at 13:49
  • According to the pom above, your project is not using EclipseLink. Let's step back a bit: what makes you think your project uses EclipseLink and what is the actual problem you are trying to solve? – E-Riz Mar 04 '16 at 15:00
  • I'm still trying to get to the bottom of a problem I've described here: http://stackoverflow.com/questions/33129219/class-not-found-when-using-jax-rs-with-eclipse-and-glassfish. I know that eclipselink is being used by my project - I'll update the question to show this. – Tom O'Brien Mar 04 '16 at 15:25

2 Answers2

2

The eclipselink you're running is provided by the Glassfish server. Look in the glassfish/modules directory and find the org.eclipse.persistence.core.jar file. Inside it will be a readme.html. Open that and the version of eclipselink that is installed in Glassfish will be there.

Mine says, for glassfish 4 (somewhat old) is:

<B>EclipseLink 2.5 Read Me</B>
K.Nicholas
  • 10,956
  • 4
  • 46
  • 66
  • When I have a look in there, Nicholas, it says it is version 2.6 - not 2.6.1 or 2.6.2. How do I look to upgrade this? Is it simply a matter of getting the latest jar and placing it in this folder? If so, do you know where I can get my hands on it? – Tom O'Brien Mar 04 '16 at 15:43
  • That I don't know. Sounds like a separate question though :-). – K.Nicholas Mar 04 '16 at 16:12
  • I'm wondering what version [Tomcat EE+](http://tomee.apache.org/apache-tomee.html) uses. Maybe the rest stuff you are trying to do works there? – K.Nicholas Mar 04 '16 at 16:37
  • yeah - but I have so much stuff set up, to change it all seems ridiculous. I did manage to get a hack working today - by putting the latest core.jar and moxy.jar in the modules directory. Must try and find the correct way to fix this though. Many thanks Nicholas - yours was the biggest help i've got in months of trying! – Tom O'Brien Mar 04 '16 at 17:10
2

Duplicated! Refer this

There is a static class and static method to get this information. Example: How to print in java code

AbstractSessionLog.getLog().log(SessionLog.INFO, DatabaseLogin.getVersion());
Community
  • 1
  • 1
Gaurav Gharat
  • 1,921
  • 1
  • 10
  • 5