Here's an alternate Spring 3 / OpenJPA 2 / Maven configuration. Make sure that
your version of Spring is at least 3.0.2 due to
<https://issues.springframework.org/browse/SPR-6975>:
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
<spring.security.version>3.0.3.RELEASE</spring.security.version>
<junit.version>4.7</junit.version>
<openjpa.version>2.0.1</openjpa.version>
</properties>
<dependencies>
<dependency>
<!-- WARNING: Moving to 1.2.15 introduces unwanted JMS/JMX
dependencies -->
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- Spring & BlazeDS -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>org.springframework.security.core</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>org.springframework.security.config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>org.springframework.security.web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<!-- Data access (i.e. OpenJPA) -->
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>${openjpa.version}</version>
</dependency>
<!-- Test additions -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
On Nov 29, 2010, at 9:21 AM, Mark Struberg [via OpenJPA] wrote:
> hi!
>
> which JPA API jar do you use?
>
> I'm using
> <dependency>
> <groupId>org.apache.geronimo.specs</groupId>
> <artifactId>geronimo-jpa_2.0_spec</artifactId>
> <version>1.1</version>
> </dependency>
> which contains the needed method.
> So you might have to exclude some transitive dependency [1] to a JPA-1 api
> jar from your spring dependency.
> Probably something like
> <dependency>
> <groupId>org.hibernate.java-persistence</groupId>
> <artifactId>jpa-api</artifactId>
> </dependency>
> ?
>
>
> LieGrue,
> strub
>
> [1]
> http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
>
>
>
> --- On Sun, 11/28/10, gkorland <[hidden email]> wrote:
>
> > From: gkorland <[hidden email]>
> > Subject: Error running on Spring 3
> > To: [hidden email]
> > Date: Sunday, November 28, 2010, 3:55 PM
> >
> > I tried creating an EntityManagerFactory with Spring 3 but
> > I keep getting the
> > following error:
> >
> > Caused by: java.lang.NoSuchMethodError:
> > javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
> >
> > at
> > org.apache.openjpa.persistence.PersistenceUnitInfoImpl.toOpenJPAProperties(PersistenceUnitInfoImpl.java:457)
> >
> > at
> > org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:314)
> >
> >
> > It seems like the issue is that this method was added in
> > JPA 2.0 while the
> > version supported by Spring is only OpenJPA 1.1.0 (which is
> > I guess JPA 1.0
> > compatible)
> >
> > I couldn't find on SpringSource repository newer version
> > than 1.1.0.
> > Any ideas?
> >
> > Thanks,
> > Guy
> > --
> > View this message in context:
> > http://openjpa.208410.n2.nabble.com/Error-running-on-Spring-3-tp5781867p5781867.html
> > Sent from the OpenJPA Users mailing list archive at
> > Nabble.com.
> >
>
>
>
>
>
> View message @
> http://openjpa.208410.n2.nabble.com/Error-running-on-Spring-3-tp5781867p5784450.html
> To start a new topic under OpenJPA Users, email
> [email protected]
> To unsubscribe from OpenJPA Users, click here.
--
View this message in context:
http://openjpa.208410.n2.nabble.com/Error-running-on-Spring-3-tp5781867p5786875.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.