|
|
Re: Gemini JPA: Getting Started? [message #1062122 is a reply to message #1062021] |
Thu, 06 June 2013 06:24   |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
i already ran through these documents, but i did not download the package via webpage i installed it via updatemanager in eclipse, therefore the sample was not downloaded. now i got the sample.
in my case i got a main application and some bundles (thats where i use gemini)
i called my bundle lumo.osgi.service.eclipselink.impl (yep, there is also a bundle without impl.)
i copied the activator from the sample to my bundle and modified the addingService method:
public Object addingService(ServiceReference ref)
{
Bundle b = ref.getBundle();
Object service = b.getBundleContext().getService(ref);
String unitName = (String)ref.getProperty("osgi.unit.name");
if (unitName.equals("EclipseLinkTest")) {
System.out.println("EclipseLinkTest started");
// new AccountClient().run((EntityManagerFactory)service);
}
return service;
}
note: EclipseLinkTest is the name of my persistence unit defined in my src/META-INF/persistence.xml
further i added to my MANIFEST.MF the following lines:
Meta-Persistence: META-INF/persistence.xml
Bundle-Activator: osgi.Activator
my persistence.xml looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<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"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="EclipseLinkTest" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<mapping-file>META-INF/eclipselink-orm.xml</mapping-file>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:h2:D:/JAVA/relationsshipDb" />
<property name="javax.persistence.jdbc.user" value="admin" />
<property name="javax.persistence.jdbc.password" value="" />
<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.weaving" value="true"/>
</properties>
</persistence-unit>
</persistence>
when launching the application, the service gets started
log: Gemini JPA Basic Sample started.
but thats it. there is no log "EclipseLinkTest started" which i would expect to fire up.
did i miss something important from the example?
UPDATE:
just scrolled through the logs and found this:
!MESSAGE the bunldle initial@reference:file:plugins/org.eclipse.gemini.jpa_1.1.0.RELEASE/ not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.327
!MESSAGE the imported package javax.persistence_1.1.0 missing.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.342
!MESSAGE the imported package javax.persistence.criteria_1.1.0 missing.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.342
!MESSAGE the imported package javax.persistence.metamodel_1.1.0 missing.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.342
!MESSAGE the imported package javax.persistence.spi_1.1.0 missing.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-06 10:38:36.342
my require says
javax.persistence 2.1.0
org.eclipse.persistence.antlr 3.2.0
org.eclipse.persistence.asm 3.3.1
org.eclipse.persistence.core 2.5.0
org.eclipse.persistence.jpa 2.5.0
osgi.enterprise 4.2.0
and i included those jars in runtime.
this way the service starts but gemini not.
if i add
osgi.eclipse.gemini.jpa 1.1.0
to required
then the service does not start either. but the warnings are no more logged.
lumo
[Updated on: Thu, 06 June 2013 08:49] Report message to a moderator
|
|
|
|
Re: Gemini JPA: Getting Started? [message #1062419 is a reply to message #1062268] |
Fri, 07 June 2013 15:06   |
Michael Gruebsch Messages: 16 Registered: March 2012 |
Junior Member |
|
|
Hi Mike and Ludwig,
I have the same problem. In my target environment there is eclipse link 2.5.0 and gemini jpa 1.1.0. In Eclipse under run configurations I created a new OSGI Framework configuration. I added only to the list of bundles. After that I pressed the button "Add Required bundles". This selects 28 plugins, including .
When pressing the button "Validate bundles" I get the message, that 4 bundles javax.perstence, version 1.1.0 are missed.
What is going wrong? Thank you!
Michael
[Updated on: Mon, 10 June 2013 05:17] Report message to a moderator
|
|
|
Re: Gemini JPA: Getting Started? [message #1062616 is a reply to message #1062419] |
Mon, 10 June 2013 05:12   |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
@mike, i got all the Program arguments included, which are you mentioning.
not the VM arguments.
i wrote a plugin/view, which indicates me if a OSGi service is not up and running (which should be running).
@michael thats exactly what i get too (so my problem is reproduceable - thanks for your post)
[Updated on: Mon, 10 June 2013 05:24] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
Re: Gemini JPA: Getting Started? [message #1063392 is a reply to message #1063198] |
Thu, 13 June 2013 05:17   |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
when running your example i encounter the following log:
(multiple:)
!ENTRY org.eclipse.equinox.ds 4 0 2013-06-13 07:16:00.406
!MESSAGE Could not bind a reference of component org.eclipse.gemini.ext.di.emf. The reference is: Reference[name = IPreferencesService, interface = org.eclipse.core.runtime.preferences.IPreferencesService, policy = dynamic, cardinality = 0..1, target = null, bind = bindPreferencesService, unbind = unbindPreferencesService]
!ENTRY org.eclipse.equinox.ds 4 0 2013-06-13 07:16:00.421
!MESSAGE Could not bind a reference of component org.eclipse.gemini.ext.di.em. The reference is: Reference[name = EntityManagerFactory, interface = javax.persistence.EntityManagerFactory, policy = dynamic, cardinality = 0..n, target = null, bind = bindEntityManagerFactory, unbind = unbindEntityManagerFactory]
!ENTRY org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa.sample.configadmin_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa.sample.configadmin.pu_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa.sample.basic_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.spi_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!ENTRY org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa_1.1.0.RELEASE [238] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.spi_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa.sample.basic_1.1.0.RELEASE [239] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa.sample.configadmin_1.1.0.RELEASE [240] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package model.configadmin_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa.sample.configadmin.pu_1.1.0.RELEASE [242] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
all i did was checking the sample out from git, and download the package from your update site
http://p2.mukis.de/org.eclipse.gemini.ext.di/latest
thats exactly the same error we get in our RCP's
|
|
|
|
|
|
|
|
|
|
|
|
Re: Gemini JPA: Getting Started? [message #1065675 is a reply to message #1061965] |
Thu, 27 June 2013 06:05   |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
i checked the milestone.
this is what i did
1) start eclipse with a fresh workspace.
2) creating a new plugin with the org.eclipse.gemini.jpa.sample.basic_1.2.0.M1.jar
3) create a .target definition which includes DBAccess 1.1.0 RELEASE and Gemini 1.2 M
also EclipseLink 2.5.0 is in this target. (also eclipse is in the target.)
when i start the application i get the following log:
!SESSION 2013-06-27 08:03:56.202 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_AT
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data D:\JAVA\Workspace2013/../runtime-EclipseApplication -dev file:D:/JAVA/Workspace2013/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog
!ENTRY org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE Bundle reference:file:/M:/EclipseTargetPlatform/gemini/gemini-dbaccess-1.1.0.RELEASE-updates/plugins/org.eclipse.gemini.dbaccess.hsqldb_1.1.0.RELEASE.jar was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.hsqldb.jdbc.pool_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.hsqldb.jdbc_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE Bundle reference:file:/M:/EclipseTargetPlatform/gemini/gemini-dbaccess-1.1.0.RELEASE-updates/plugins/org.eclipse.gemini.dbaccess.mysql_1.1.0.RELEASE.jar was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package com.mysql.jdbc.jdbc2.optional_[5.0.0,6.0.0).
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package com.mysql.jdbc_[5.0.0,6.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE Bundle reference:file:/M:/EclipseTargetPlatform/gemini/gemini-dbaccess-1.1.0.RELEASE-updates/plugins/org.eclipse.gemini.dbaccess.h2_1.1.0.RELEASE.jar was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.h2_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.h2.jdbcx_0.0.0.
!ENTRY org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE Bundle org.eclipse.gemini.dbaccess.h2_1.1.0.RELEASE [199] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.h2_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.h2.jdbcx_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE Bundle org.eclipse.gemini.dbaccess.hsqldb_1.1.0.RELEASE [200] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.hsqldb.jdbc_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.hsqldb.jdbc.pool_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE Bundle org.eclipse.gemini.dbaccess.mysql_1.1.0.RELEASE [201] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package com.mysql.jdbc_[5.0.0,6.0.0).
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package com.mysql.jdbc.jdbc2.optional_[5.0.0,6.0.0).
please let me know whats going wrong or what i shall include.
the bundles/jar files are exactly where the log says they are searched.
do i need anything additional?
if i could get the examples up running, it would be way easier to find out how stuff works (and apply the code to my project)
just for your information.
i tried to integrate the sample into my application.
there none of the above messages gets logged, but
the Activator only logs out that "Gemini JPA Basic Sample started
and addingService gets never called...
[Updated on: Thu, 27 June 2013 06:23] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: Gemini JPA: Getting Started? [message #1066720 is a reply to message #1066707] |
Thu, 04 July 2013 05:22   |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
in your example 'Binding preferences without application restart'
https://github.com/muuki88/e4GeminiJPA/blob/master/de.mukis.gemini.sample.rcp/src/de/mukis/gemini/sample/rcp/handlers/SavePersonPreferencesHandler2.java
i dont get the point, where you set preferences... you save a DOA
i cant find any example where you do stuff without annotations (hardcoded config)
i'd need user input from a dialog which gets used in one of the handlers (afaik you cannot pass arguments into annotations...)
let me short explain what i need to get working (and what i got)
till now i had Hibernate in OSGi (but it fails at some point of my model - therefore i switch to EclipseLink, which resolves the problem fine!)
With EclipseLink i had to use JPA, and those two seem to have problems in OSGi, as Eclipse Bundles.
i had (with Hibernate) a Service, which creates a Connection and serves a Session to the database.
i was able to load/save stuff from this service (this service also monitors if something changed in the Data (in the time between load until i click save -> if nothing changed the object is thrown away, otherwise it updates the data))
this service has to be configured at runtime by passing: host, port, username and password (database driver etc... are preconfigured per PersistenceService)
my application provides multiple PersistenceServices, which means i can load stuff from different sources (all based on the same model, but can be totally different in how to retrieve the data) and save it to whatever PersistenceService i want in my application. (this for data Import/Export and merging)
so when i try to do this with gemini my problem is that gemini starts and stops the service at will (with a single query it reloaded the service.
so when working with the preferences store i need the root node of the settings
(changing the settings would look like this then?)
sorry i am totally new to Injection, those Annotations and e4 (used e3 for few years though)
public void configure(){
Preferences prefs= ConfigurationScope.INSTANCE
.getNode("org.eclipse.gemini.???.???");
// More stuff...
prefs.put(PersistenceUnitProperties.JDBC_DRIVER, "org.gjt.mm.mysql.Driver");
prefs.put(PersistenceUnitProperties.JDBC_URL, "jdbc:mysql://127.0.0.1/test");
prefs.put(PersistenceUnitProperties.JDBC_USER, "test");
prefs.put(PersistenceUnitProperties.JDBC_PASSWORD, "test");
// Persists
try {
prefs.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
}
}
i'm really willed to get this working & i tried to get this stuff working for more than a week now, its driving me nuts.
[Updated on: Fri, 05 July 2013 05:51] Report message to a moderator
|
|
|
|
|
|
|
|