EclipseLink JPA 2.0. "unknown enum constant javax.persistence.LockModeType.NONE" - jpa

I have a Glassfish v3 with a remote EJB. I use this EJB to manipulate a data base using EclipseLink. Regarding this question, i'm now trying to import the EclipseLink jars to my client application as #James suggested.
Here are the jars i have added so far, those jars are those added on the server side of my application.
eclipselink-2.3.2.jar
javax.persistence-2.0.3.jar
org.eclipse.persistence.antlr.jar
org.eclipse.persistence.asm.jar
org.eclipse.persistence.core.jar
org.eclipse.persistence.jpa.jar
org.eclipse.persistence.jpa.jpql_1.0.1.jar
org.eclipse.persistence.jpa.modelgen.jar
org.eclipse.persistence.moxy.jar
org.eclipse.persistence.oracle.jar
But when i try to compile my netbeans module, i got this error:
error: in class file javax/persistence/NamedQuery.class(javax/persistence:NamedQuery.class): unknown enum constant javax.persistence.LockModeType.NONE
Note: Attempting to workaround javac bug #6512707
warning: No processor claimed any of these annotations: [javax.ejb.Remote]
error: in class file javax/persistence/NamedQuery.class(javax/persistence:NamedQuery.class): unknown enum constant javax.persistence.LockModeType.NONE
1 error
Why?

The error seems like you have the JPA 1.0 jar first on your classpath, but need the JPA 2.0 classes.

Related

weblogic to Jboss Migratiion JaxB issue : unknown enum constant AccessType.FIELD

We are trying to migrate one of our java application from WebLogic to JBOSS
and once we upgrade the jaxb jar from 2.0 to 2.2 we are getting the below warning.
Even deployment also we are getting same error.
We have also upgraded spring jars to 4.3.10 .
Spring annotation is looking for Access Type but JaxB 2.2 is returning
XmlAccessType.
warning: unknown enum constant AccessType.FIELD

JPA metamodel not recognized with Netbeans 7.4

I have a web application that is working fine under Netbeans 7.3. When I installed it on another computer with Netbeans 7.4, all references to the JPA metamodel are now undefined.
The import statements referring to the metamodel (those ending with an underscore, like the 3rd import statement below) are not recognized :
import bfMetier.ApplicationInitialise;
import entites.Locations;
import entites.Locations_;
And when I run the project, it aborts with a «cannot find symbol Locations_» error :
SEVERE: Exception while loading the app : EJB Container initialization error
java.lang.ExceptionInInitializerError
(...)
Caused by: java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: class Locations_
location: package entites
at beansFacades.LocationsFacade.<clinit>(LocationsFacade.java:10)
I'm using ecclipse as the JPA 2.0 provider and running the app under Glassfish 3.1.2.2.
Is there any parameter I need to add in order for the metamodel classes to be generated?
Thanks!
I created a new java project in 7.4 and found some differences...
There is no option in context menu for generating classes from database (like 7.3).
I found this option in New Java Class... Persistence category.
The entity generated by 7.4 do not have metadata classes.
Might be, the metadata classes are no longer generated/or needed by netbeans.

Unable to create editor ID org.eclipse.jst.pagedesigner.PageDesignerEditor: An unexpected exception was thrown

when i added JSF support to my project, following this tutorial
http://www.mkyong.com/jsf2/how-to-make-eclipse-ide-supports-jsf-2-0/
after restarting the eclipse, i am getting the error:
Unable to create editor ID org.eclipse.jst.pagedesigner.PageDesignerEditor: An unexpected exception was thrown.
any ideas why, and how to solve it ?
UPDATE:
when i tried to select java server faces again from the project facets, i found that it says on the right:
Conflicts with the following facets:
Application Client module
Dynamic Web Module
EAR
EJB Module
JCA Module
Static Web Module
Utility Module
Web Fragment Module
i was having JSF and ICEFaces dependencies in my pom, and i was having their libraries too in the classpath, fixed the error by removing them, and adding JSF,icefaces capabilities to my project, everything works fine now.

websphere 7 and (application based) open-jpa 2

I want to not use the built in Websphere 7 jpa plugin, instead use an application WEB-INF/lib/open-jpa 2 and a proprietary persistence provider. I cannot install the OSGI and JPA 2 feature pack for Websphere.
Originally, I was getting a sax parse error simply trying to load the persistence.xml (version="2" not supported). The error was thrown by a class in open-jpa 1.2.3. When I run websphere/appserver/bin/wsjpaversion.bat, the open-jpa 1.2.3 jar is displayed. By default it overrides the open-jpa 2 jar in the app. I created a shared library containing the open-jpa 2 jar with this config option checked: 'Use an isolated class loader for this shared library'. I set my application classloader to load parent last and assigned it the new shared library resource. The 'version 2' error is gone, but there is another problem. When I try to initialize an EntityManager I get an error:
Caused by: javax.persistence.PersistenceException: Failed to load provider from META-INF/services
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:91)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
... 2 more
Caused by: java.lang.ClassCastException: com.ibm.websphere.persistence.PersistenceProviderImpl incompatible with javax.persistence.spi.PersistenceProvider
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:110)
... 11 more
One more detail: inside the persistence.xml, the provider element is set to the proprietary PersistenceProviderImpl not the default Websphere persistence provider. So where is this websphere default coming from and how do I prevent it? (another important note: when I remove persistence.xml completely, I get the same error)
Thank you
Without installing the feature pack, you're fighting a losing battle. While it is possible to plug in your own JPA implementation, it is not possible to do that with JPA API — so WAS 7 ties you to the 1.0 version of JPA (see, for example, here how this is done — no class loader policy juggling will change that, though it seems tempting at first).

jsf-console 3.x on JBoss 6.x possible?

I'm trying to move an application from JBoss 4.2.2 AS to 6.x AS. Right now I'm trying to get jbpm 3.x running on the AS I have this problem when trying to upload a .par file to the server:
13:41:51,713 ERROR [org.jbpm.db.GraphSession] (http-127.0.0.1-8888-1) java.lang.ClassCastException: org.jbpm.graph.def.Node_$$_javassist_92 cannot be cast to javassist.util.proxy.ProxyObject
Which then results in:
13:41:51,740 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/app].[ProcessUploadServlet]] (http-127.0.0.1-8888-1) Servlet.service() for servlet ProcessUploadServlet threw exception: org.jbpm.JbpmException: couldn't find process definition 'ProcessName'.
I've tried using both old and new versions of javassist which has no positive effect. Any ideas?
It seems you are using eclipse plugins and you have class loader problem between 2 plugins, make sure that you have only one class loader to load ProxyObject (Javassist)