users@jersey.java.net

JerseyTest framework and JPA 2.0

From: schong <dr.steve.chong_at_gmail.com>
Date: Wed, 24 Mar 2010 06:53:36 -0800 (PST)

Hello,
I am trying to use the JerseyTest framework as is described in Naresh's
blog:
(http://blogs.sun.com/naresh/entry/jersey_test_framework_makes_it).

I have a class AddressService which gets called by my AddressTest (which
extends JerseyTest).

AddressService works fine with a very simple method which returns a string.
My problem occurs when I try to do some more complicated work....

I put a method on AddressService which tries to create a
javax.persistence.EntityManager using an EntityManagerFactory. I get the
following Exception:

Provider named org.eclipse.persistence.jpa.PersistenceProvider threw
unexpected exception at create EntityManagerFactory:
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 1.0.1 (Build
20080905)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader: java.net.URLClassLoader_at_20fa83
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence
Services - 1.0.1 (Build 20080905)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing
persistence.xml from URL:
file:/home/schong/svn/ProofOfConcept/addressJPANew/src/main/resources/
Internal Exception:
(1. cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element
'persistence' is not valid with respect to the corresponding attribute use.
Attribute 'version' has a fixed value of '1.0'.)
        at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:121)

I have a persistence unit (persistence.xml) defined - here is the first two
lines:

<?xml version="1.0" encoding="UTF-8"?>
<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">

I am guessing that there is an incompatibility between Grizzly and JPA 2.0.

I specifically want to use JPA 2.0 as I will eventually be deploying int
Glassfish V3 in production. But I want to try to test my code on a Light
weight server and not Glasssfish v3.



Does anyone have any advice or pointers where I should look or alternatives
I should try for testing on a light weight Web Server

Thank you in advance.
Steve







-- 
View this message in context: http://n2.nabble.com/JerseyTest-framework-and-JPA-2-0-tp4791446p4791446.html
Sent from the Jersey mailing list archive at Nabble.com.