Upgrading GlassFish 3.1.2.2 to use JPA 2.1 - jpa

I am working with GlassFish 3.1.2.2 (I can not upgrade to 4 due to OS restrictions).
I'm interested in upgrading JPA 2.0 to JPA 2.1 GlassFish 3.1.2.2. How can I achieve this?

This is most likely not possible at all. JPA 2.1 is part of EE 7 and therefore not fully integrated with EE 6 GF 3.1.2.2.

Did you try just replacing the EclipseLink and JPA jar files in Glassfish?
It will probably work, but if you use managed persistence units they will not expose any JPA 2.1 API, you would need to unwrap the EntiyManager to access these.

I'm using Hibernate 4.3.8 (requires JPA 2.1) with Glassfish 3.1.2.2.
Note: I'm not using any services provided by glassfish. All the libraries I use are in the WEB-INF/lib.
1 - Override all JPA classes (package javax.persistence) in glassfish/modules/javax.persistence.jar with JPA 2.1 version. You should not replace the entire JAR, only override the classes. This JAR has an OSGI manifest and other classes that must remain there.
2 - Remove all javassist classes (package javasssist) from glassfish/modules/weld-osgi-bundle.jar. This solves a possible incompatibility if you are using Hibernate.

Related

Spring 4 + hibernate & jpa 2.1 on weblogic 10.3.5

Will I be able to run Hibernate with JPA 2.1 on weblogic 10.3.5.
I have specified the below lines in weblogic-application.xml and packaged the jpa 2.1 API jar in the EAR along with other jars.
<wls:prefer-application-packages>
<wls:package-name>javax.persistence</wls:package-name>
</wls:prefer-application-packages>
Some how weblogic recognizes META-INF/persistence.xml and tries to automatically create persistence unit using Eclipse Link during application deployment/startup. This is where the weblogic classloader (parent of application class loader) is trying to load the persistence unit but failing with below exception.
java.lang.IllegalArgumentException: interface javax.persistence.EntityManagerFactory is not visible from class loader
Any help with this is very much appreciated.
Have you enabled JPA 2.1 on your Weblogic Instalation ?
If you refer to :
https://docs.oracle.com/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309
and
https://docs.oracle.com/middleware/1213/wls/EJBAD/using_toplink.htm#EJBAD1309
you will note that:
"Support for JPA 2.1 in WebLogic Server is provided as a patch because JPA 2.1 is part of the Java Platform, Enterprise Edition (Java EE) 7. Therefore, enabling JPA 2.1 support in the current release results in WebLogic Server not meeting all Java EE 6 compatibility requirements. To maintain Java EE 6 compatibility, the files required for JPA 2.1 support are not enabled by default, although they are included in a standard WebLogic Server installation."
Have a look #
How to Enable Java Persistence 2.0 for Weblogic 10.3.6
and
https://docs.oracle.com/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309

Wildfly compatibility with EJB

I’m working on a migration project that woul change WebLogic application server soon to be off support to Wildfly 10.0.0.Final, the problem I’m facing is that the project was built with ejb 2.1 and I don’t know wether Wildfly 10.0.0 would be compatible or not ?
Thanks in advance
Your migration will be relatively easy unless your application makes use of CMP entity beans.
If you have more than around 3 or 4 of these then migration will get tricky as you would need to migrate the CMP beans to JPA.
Otherwise, most changes will revolve around moving to Java EE standard JNDI names

What are the supported versions of JPA does EclipseLink 2.5 support

I am trying to use EclipseLink 2.5 in my GlassFish 3.1.2.2 but it seems that its not working properly.
So What are the supported versions of JPA does EclipseLink 2.5 support ?
I am restricted to use JPA 2.0 till the moment.
EclipseLink 2.5 is implementation of JPA 2.1 specification. Because JPA 2.1 (what's new) is more or less superset of JPA 2.0, it is possible to use EclipseLink 2.5 and limit usage to features available in JPA 2.0.
GlassFish 3.1.2.2 was shipped with EclipseLink 2.3.2 (which is implementation of JPA 2 specification), so it is rather easy try is EclipseLink version source of problems. Likely not - but new bugs are of course always possible. Also then issue is not directly connected to supported JPA specification version.

converting JPA 1.0 to JPA 2.0

In eclipse ,I am trying to upgrade my JPA from 1.0 to 2.0 (EJB project). I have made changes in the library and using eclipselink also but when I am again creating a project it is not giving an option of JPA 2 in faclets to select
any one have some idea whats the problem
It will depend on the version of Eclipse, and the weblogic plugin (OEPE) you are using. Without the correct connectors Eclipse is only aware that WebLogic server can run JPA1.0.
Perhaps try the latest version of OEPE pack here and point it at your workspace.
You also need to make sure the version of WebLogic you are using supports JPA2- you have tagged the question as weblogic 10.x which only supports JPA2.0 in 10.3.4 and later, and may require you to patch weblogic to enable the support.

Upgrading GlassFish 3.1.2.2 to use JSF 2.2

I am working with GlassFish 3.1.2.2 and I can not upgrade to 4 due to OS restrictions. I'm interested in upgrading JPA 2.0 to JPA 2.1 and JSF 2.1 to JSF 2.2 in GlassFish 3.1.2.2. How can I achieve this?
I can't speak for JPA, but for JSF it's a matter of replacing javax.faces.jar file in its /modules directory by the desired version. Don't forget to clean the GlassFish cache and work folders before deploying, because the older JSF version may still hang in there and then cause conflicts.