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.
Related
I use UML Designer for Eclipse 4.7.0 and got the following error while trying to add a new element to a diagram:
An error has occurred. See error log for more details. loader
constraint violation: when resolving field "IS_DETACHMENT" the class
loader (instance of
org/eclipse/osgi/internal/loader/EquinoxClassLoader) of the referring
class,
org/eclipse/sirius/business/internal/session/danalysis/DanglingRefRemovalTrigger,
and the class loader (instance of
org/eclipse/osgi/internal/loader/EquinoxClassLoader) for the field's
resolved type, com/google/common/base/Predicate, have different Class
objects for that type
Do I have to change some settings?
UML Designer 8.0.0 compatible with Eclipse 0xygen 4.7.0 is not yet released, the current version is an alpha version. According to your error, it seems that there is an imcompatibility between the version of Guava needed by UML designer and the one you have installed.
Which version of guava is installed in your Eclipse?
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.
I'm trying to generate the metamodel definitions in Eclipse as documented on:
http://www.datanucleus.org/products/accessplatform/jpa/jpql_criteria.html
My project compiler level is set to 1.6 and the mentioned datanucleus jars are added to the factory path.
When the project builds I get the following error:
Errors occurred during the build.
Errors running builder 'Java Builder' on project 'X'.
Could not initialize class org.datanucleus.jpa.query.JPACriteriaProcessor
When using mvn compile the metamodel definitions are generated successfully, so it's probably related to Eclipse annnotation processing.
I'm using latest Spring Tool Suite 3.1.0.RELEASE based on Eclipse 4.2.1
Not put persistence-api.jar (or equivalent, such as Geronimo specs JPA2) in the Factory Path? Either way one of the deps is missing
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.
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).