This content has been marked as final. Show 2 replies
The issue is that your persistence.xml schema is version 2.0 - not 1.0. It looks like your version of NetBeans supports JPA 2.0 since I assume that the persistence.xml was initially generated by it (since you are using the 2.0 schema but nothing in your persistence.xml requires anything beyond JPA 1.0 (IE: no cache-mode NONE)).
The NoSuchMethodError is a direct result of your version of Tomcat running the 1.0 version of javax.persistence.jar.
Either add the 2.0 version of javax.persistence.jar to Tomcat or use another catalina based servlet container like full JEE6 (JPA 2.0 included) compliant GlassFish V3 - that comes with NetBeans - you will then be fine predeploying/deploying/running your application managed WAR.
Or just change the following XSD definition from 2.0 to 1.0 - as you don't need any design-time 2.0 (I don't know if you are using 2.0 runtime in your code though). You can still run JPA 2.0 API even if you define a JPA 1.0 schema.
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
Also, in my other post I mentioned that EclipseLink JPA is an option - more so since you are running the JEE6 RI = GlassFish which runs the JPA 2.0 RI = EclipseLink.
See the recent OTN post from 20110115 detailing the latest release of Oracle WebLogic Server and some retesting of the previous issues related to JSR-317 JPA 2.0 support below.
Re: Deploy Hibernate based EAR file on Weblogic 10.3.3?
In 10.3.3.0 you were required to use the FilteringClassLoader via the *<wls:prefer-application-packages>* addition to your application managed persistence unit - this workaround is now fully deprecated and not required in 10.3.4.0 for both application and container managed persistence contexts.
As of 20110115 the 5 outstanding issues below look to be fixed by applying the http://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309 patch for QWG8 or manually prepending to the WebLogic 10.3.4.0 server classpath.
JPA 2.0 using EclipseLink as the persistence provider on WebLogic is detailed in the analysis section below1) JPA 2.0 XSD parsing
2) New JPA 2.0 schema elements like <shared-cache-mode>NONE</shared-cache-mode>
3) JPA 2.0 runtime API like a entityManager.getMetamodel(); call on the Servlet or Stateless session bean
4) JPA 2.0 weaving/instrumentation - this will require a more detailed lazy model and more debugging to verify
5) Dependency Injection of a container managed JPA 2.0 entityManager on a EJB component like a stateless session bean
Supported Oracle WebLogic Server Versionshttp://download.oracle.com/docs/cd/E15315_06/help/oracle.eclipse.tools.weblogic.doc/html/SupportedServerVersions.html
TopLink JPA 2.0 Specifichttp://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309
JPA 2.0 using EclipseLink on WebLogic analysis (XSD, Weaving, DI of @PersistenceContext)http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support