For Eclipselink to understand the property should be called
"javax.persistence.nonJtaDataSource"
----- Original Message -----
From: "Girish Kumar Balachandran" <Girish.Balachandran_at_Sun.COM>
To: <persistence_at_glassfish.dev.java.net>
Cc: "Nam Nguyen" <Nam.Nguyen_at_Sun.COM>
Sent: Friday, September 25, 2009 4:18 PM
Subject: Re: EntityManager lookup difference between GF V2 and V3
> We manage our own EMs and do not depend on the container. BTW, the
> difference between V2 and V3 usage in ours is, in V2 we did not use
> eclipse link in V3 we are also trying out eclipse link. Apologies for not
> mentioning it. So, would that be a reason why it is working for us in V2?
> =Girish
>
> Marina Vatkina wrote:
>> Mitesh, doesn't transaction-type="RESOURCE_LOCAL allow
>> non-jta-data-source?
>>
>> thanks,
>> -marina
>>
>> Mitesh Meswani wrote:
>>> I am surprised that it worked in V2. You should be specifying
>>> jta-data-source instead of non-jta-data-source in persitence.xml.
>>> Somethig like as follows
>>> / <persistence-unit name="*org.webonweb.runtime.impl.repository.db*"
>>> transaction-type="RESOURCE_LOCAL">
>>> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>>
>>> <non-jta-data-source>*jdbc/webonweb/repository*</non-jta-data-source>
>>> //<jta-data-source>*jdbc/webonweb/repository*</jta-data-source>/
>>>
>>> Thanks,
>>> Mitesh
>>>
>>> Girish Kumar Balachandran wrote:
>>>
>>>> Hi There,
>>>> We are trying out GF v3 for zembly.com and I am seeing following
>>>> exception in obtaining EntityManager for EntityManagerFactory (em =
>>>> emf.createEntityManager();):
>>>> /
>>>> Caused by: Exception [EclipseLink-4021] (Eclipse Persistence Services -
>>>> 1.0.1 (Build 20080905)):
>>>> org.eclipse.persistence.exceptions.DatabaseException
>>>> Exception Description: Unable to acquire a connection from driver
>>>> [null], user [null] and URL [null]. Verify that you have set the
>>>> expected driver class and URL. Check your login, persistence.xml or
>>>> sessions.xml resource. The jdbc.driver property should be set to a
>>>> class that is compatible with your database platform
>>>> at
>>>> org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:365)
>>>> at
>>>> org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:90)/
>>>>
>>>> Things work perfect with GF V2/2.1 but, V3 does not seem to work. Am I
>>>> supposed to do something more than the following?
>>>>
>>>> Any tips would be much appreciated.
>>>>
>>>> Thanks,
>>>> =Girish
>>>>
>>>> These are the configuration I have:
>>>> *
>>>> System servlet has these 2 annotations reg PU:*
>>>>
>>>> /_at_PersistenceUnits(
>>>> {
>>>> @PersistenceUnit(name =
>>>> "*webonweb/repositoryEntityManagerFactory*",
>>>> unitName =
>>>> "*org.webonweb.runtime.impl.repository.db*"),
>>>> @PersistenceUnit(name =
>>>> "*webonweb/readOnlyRepositoryEntityManagerFactory*",
>>>> unitName =
>>>> "*org.webonweb.runtime.impl.repository.db.readonly*")
>>>> }
>>>> )/
>>>>
>>>>
>>>> *Persistence.xml has (use introspection to discover all entities):*
>>>>
>>>> / <persistence-unit name="*org.webonweb.runtime.impl.repository.db*"
>>>> transaction-type="RESOURCE_LOCAL">
>>>>
>>>> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>>>
>>>> <non-jta-data-source>*jdbc/webonweb/repository*</non-jta-data-source>
>>>> <properties>
>>>> <!-- <property name="toplink.logging.level" value="FINE"/> -->
>>>> <!-- property name="toplink.logging.logger"
>>>> value="JavaLogger"/ -->
>>>> <!-- END JPA cache control properties -->
>>>> <property name="eclipselink.cache.shared.default" value="true"/>
>>>> <property name="eclipselink.logging.level" value="OFF"/>
>>>> </properties>
>>>> </persistence-unit>
>>>> <persistence-unit
>>>> name="*org.webonweb.runtime.impl.repository.db.readonly*"
>>>> transaction-type="RESOURCE_LOCAL">
>>>>
>>>> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>>>
>>>> <non-jta-data-source>*jdbc/webonweb/readonlyrepository*</non-jta-data-source>
>>>> <properties>
>>>> <property name="eclipselink.cache.shared.default" value="true"/>
>>>> <property name="eclipselink.logging.level" value="OFF"/>
>>>> </properties>
>>>> </persistence-unit>
>>>> /
>>>> *EMF was obtained by (got EMF with out any exception):*
>>>>
>>>> /protected EntityManagerFactory createEntityManagerFactory() throws
>>>> RepositoryException {
>>>> try {
>>>> InitialContext ic = new InitialContext();
>>>> return (EntityManagerFactory)
>>>> ic.lookup("*java:comp/env/webonweb/repositoryEntityManagerFactory*");
>>>> } catch (NamingException ne) {
>>>> throw new RepositoryException(ne);
>>>> }
>>>> }
>>>> protected EntityManagerFactory
>>>> createReadOnlyEntityManagerFactory() throws RepositoryException {
>>>> try {
>>>> InitialContext ic = new InitialContext();
>>>> return (EntityManagerFactory)
>>>> ic.lookup("*java:comp/env/webonweb/readOnlyRepositoryEntityManagerFactory*");
>>>> } catch (NamingException ne) {
>>>> throw new RepositoryException(ne);
>>>> }
>>>> }/
>>>>
>>>> *Made sure that the data source is getting looked up correctly by the
>>>> following code - hence not a config problem:*
>>>>
>>>> /private Connection getConnection() throws RepositoryException,
>>>> SQLException {
>>>> try {
>>>> InitialContext ic = new InitialContext();
>>>> DataSource sd = (DataSource)
>>>> ic.lookup("*java:comp/env/jdbc/webonweb/repository*");
>>>> return sd.getConnection();
>>>> } catch (NamingException ne) {
>>>> throw new RepositoryException(ne);
>>>> }
>>>> }
>>>>
>>>>
>>>> Version: Eclipse Persistence Services - 1.0.1 (Build 20080905)
>>>> GF: GlassFish v3 Prelude (build b28f)
>>>>
>>>> /
>>>>
>>
>