Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Gemini JPA + Gemini Naming (Get a javax.sql.DataSource object as service in the a persistant unit)
Gemini JPA + Gemini Naming [message #730158] Tue, 27 September 2011 18:07 Go to next message
Carlos Salinas is currently offline Carlos SalinasFriend
Messages: 32
Registered: March 2011
Location: Avd. de la Argentina 132,...
Member
Hi,

I already have Gemini JPA and Gemini Naming working in a virgo instance, but i cannot integrate them, because if i test putting the DB Credentials inside the persistence.xml from a persistant bundle i can query without any problem. And also if i try to get a DataSource object registered as a service throught the JNDIContextManager service i also can get the datasource.

But when i want to edit the persistent.xml and i add the following tag in the persisten-unit:

<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/countdb)</non-jta-data-source>



The bundle from Gemini JPA cannot register any service with the EntityManagerFactory interface for that persistent-unit.

I use the lastest versions for the two Gemini projects. I think the problem is i dont edit the persistant descriptor properly.

I attach the persistent.xml file.

thanks.

Re: Gemini JPA + Gemini Naming [message #730702 is a reply to message #730158] Wed, 28 September 2011 22:49 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 216
Registered: July 2009
Senior Member
Hi Carlos,

This is unfortunately a gap in the JPA and JNDI integration support. Please enter an enhancement request against Gemini JPA, explaining this use case.

Having said that, there are a couple things that you can try.

1) Even though the EMF service will not be registered, the EMFBuilder service should still be available. Try calling the createEntityManagerFactory() method on it.

2) If 1) doesn't work then look up the datasource in the client, and then pass it to the createEntityManagerFactory() method in 1) as a property. The property name should be "javax.persistence.nonJtaDataSource", with the datasource object as the value.

Let me know how it goes.

-Mike
icon14.gif  Re: Gemini JPA + Gemini Naming [message #730843 is a reply to message #730702] Thu, 29 September 2011 10:45 Go to previous messageGo to next message
Carlos Salinas is currently offline Carlos SalinasFriend
Messages: 32
Registered: March 2011
Location: Avd. de la Argentina 132,...
Member
Hi Mike,

Ill post a enhancement request, as u said. The testing task u propose i have just done it and it works, but this workaround it is not smart. But any way i attach the code if u or anyone want to have a look.


By the way. There is no documentation about the diferent Gemini Projects, so it is hard by newbies to integrate them in the projects. So we have a open prototype implementing the full stack of a web application using the Gemini projects and Vaadin framework in the frontend, except at the moment Gemini JMX, and deployed in Virgo. So we are willing to donate this application to EclipseRT, to use it as a guide or 'PetShop App'. How can we do it?

thanks.
Re: Gemini JPA + Gemini Naming [message #730888 is a reply to message #730843] Thu, 29 September 2011 13:10 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 216
Registered: July 2009
Senior Member
Quote:
Ill post a enhancement request, as u said. The testing task u propose i have just done it and it works, but this workaround it is not smart. But any way i attach the code if u or anyone want to have a look.

Glad the workaround got you past this. I agree it is not an ideal way to solve the problem, I just wanted you to not be blocked by it. You have been the first person to ask for JNDI integration so it was not done, but I should be able to add in your enhancement request for the 1.1 release.

Quote:
By the way. There is no documentation about the diferent Gemini Projects, so it is hard by newbies to integrate them in the projects.

Funny you should mention that, since I actually have some additional doc for the Gemini JPA project that I will be putting on the wiki today. Smile

Quote:
So we have a open prototype implementing the full stack of a web application using the Gemini projects and Vaadin framework in the frontend, except at the moment Gemini JMX, and deployed in Virgo. So we are willing to donate this application to EclipseRT, to use it as a guide or 'PetShop App'. How can we do it?

Hmm, that is a tough one. We would love to have it in the Gemini project, but the upward dependencies on Vaadin and Virgo might not make Gemini the best place to host it. However, if you can enter a bug in the Demos component of the Gemini project and attach the demo then we can take a look and see if we can use it? Thanks very much!
Re: Gemini JPA + Gemini Naming [message #987836 is a reply to message #730888] Wed, 28 November 2012 10:52 Go to previous messageGo to next message
David Schmitz is currently offline David SchmitzFriend
Messages: 2
Registered: November 2012
Junior Member
Hi Mike,

is there any update for Gemini JPA 1.1 present?

I am currently trying to migrate from Aries + OpenJPA with JNDI DataSource (mentioned in persistence.xml) to Gemini JPA 1.1 and EclipseLink 2.4.1.

As I have a registered DataSource already present I would like to use this one.
The described solution with the ConfigurationAdmin in Gemini JPA documentation only allows to do plain JDBC-URL, fq DriverClass etc. specification. This would be a major drawback.

Is there any for using a JNDI DataSource with Gemini JPA?
Could you help me with this?

Kind Regards
David
Re: Gemini JPA + Gemini Naming [message #989315 is a reply to message #987836] Wed, 05 December 2012 15:57 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 216
Registered: July 2009
Senior Member
Hi David,

Sorry for the delay. Version 1.1 was released but unfortunately the JNDI support did not make it in. I will make it a priority in the work for 1.2, though, so you should see it in the next milestone.

Did you try to use the workaround solution (2) I described above by first looking up the data source yourself and then passing in the data source as a property to the builder?

-Mike
Re: Gemini JPA + Gemini Naming [message #1142259 is a reply to message #989315] Thu, 17 October 2013 13:55 Go to previous messageGo to next message
David Schmitz is currently offline David SchmitzFriend
Messages: 6
Registered: October 2010
Junior Member
Hi,

I have tried to use Eclipselink 2.5.3 with Gemini Jpa 1.2.0.M01 and Gemini Naming 1.0.3 to resolve a JNDI DataSource. Unfortunately it does not work.
Gemini JPA always tells me it cannot find the DataSource. I suppose it is missing it due to timing issues. I have played around with start levels to bring up JNDI first but also this did not work.
With Aries + OpenJpa the whole stuff is working. And just one remark my DataSource is constructed and configured at runtime via DataSourceFactory so not present from the very first start.

Can you give me some advice what to do?
Would it be possible to make this JNDI resolving more failsave so that timing should not matter?

Regards
David
Re: Gemini JPA + Gemini Naming [message #1151601 is a reply to message #1142259] Wed, 23 October 2013 13:12 Go to previous message
Michael Keith is currently offline Michael KeithFriend
Messages: 216
Registered: July 2009
Senior Member
Hi David,

You seem to always post when I am away from the Gemini forum for a period of time. Sorry about that.

Are you getting a message that the datasource is not there, or that the JNDI name was not found? What naming scheme are you using to look it up? Are you using the "osgi:service/" to get a service or did some other bundle register the datasource in JNDI directly? Note that if you are looking it up as a service then some bundle needs to register a data source as a service, since JDBC driver only registers a factory.

When you played around with start levels did you ensure that all of the bundles that relate to the datasource being in JNDI or registered as a service are started before Gemini JPA. That would mean: a) the Gemini DBAccess bundles b) the Gemini Naming bundle, and c) the bundle(s) that registers the data source in JNDI or as a service

-Mike
Previous Topic:Namespace discovery problem inside a WAR bundle
Next Topic:[Gemini DBAccess] Error while shutdown
Goto Forum:
  


Current Time: Sun Nov 23 09:58:12 GMT 2014

Powered by FUDForum. Page generated in 0.01836 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software