Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » error during startup
error during startup [message #724900] Tue, 13 September 2011 13:13 Go to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
hi all
i'm trying to apply some good practices during the initial phase of our new project here. i'm trying to use tycho (almos giving up, damn Sad) and for now, i'm facing some problems with eclipselink

i made a targetPlatform file, and added eclipselink to this target, and set this target platform as active. then, i imported javax.persistence and eclipselink bundles as dependencies of my plugin.
my persistence.xml is like this
<persistence version="1.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_1_0.xsd">
    <persistence-unit name="ecf" transaction-type="RESOURCE_LOCAL">
    	<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    	
		<properties>
			<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
			<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://127.0.0.1:5432/ecf" />
			<property name="javax.persistence.jdbc.user" value="postgres" />
			<property name="javax.persistence.jdbc.password" value="adminadmin" />

			<property name="eclipselink.jdbc.read-connections.min" value="1" />
			<property name="eclipselink.jdbc.write-connections.min" value="1" />
			<property name="eclipselink.jdbc.batch-writing" value="JDBC" />

			<property name="eclipselink.logging.level" value="FINE" />
			<property name="eclipselink.logging.thread" value="false" />
			<property name="eclipselink.logging.session" value="false" />
			<property name="eclipselink.logging.exceptions" value="true" />
			<property name="eclipselink.logging.timestamp" value="true" />
		</properties>
	</persistence-unit>
</persistence>


and made a emf like this

private static EntityManagerFactory emf = null;
    private static Map<String, Object> properties = new HashMap<String, Object>();

    private static void init() {
        properties.put(PersistenceUnitProperties.TARGET_DATABASE, "Derby");
        properties.put(PersistenceUnitProperties.JDBC_DRIVER, Driver.class.getCanonicalName());
        properties.put(PersistenceUnitProperties.JDBC_URL,"jdbc:postgresql://127.0.0.1:5432/ecf");
        properties.put(PersistenceUnitProperties.JDBC_USER, "postgres");
        properties.put(PersistenceUnitProperties.JDBC_PASSWORD, "adminadmin");
        properties.put(PersistenceUnitProperties.CONNECTION_POOL_MIN, "1");
       
        properties.put(PersistenceUnitProperties.BATCH_WRITING, "JDBC");
        properties.put(PersistenceUnitProperties.CLASSLOADER, ECFEntityManager.class.getClassLoader());
        properties.put("eclipselink.logging.level", "FINE");
        properties.put("eclipselink.logging.timestamp", "false");
        properties.put("eclipselink.logging.session", "false");
        properties.put("eclipselink.logging.thread", "false");

        emf = Persistence.createEntityManagerFactory("ecf",properties);

    }

    public static EntityManager createEntityManager() {
        if (emf == null)
            init();

        return emf.createEntityManager();
    }


but when i try to start the app, the following occours:

org.osgi.framework.BundleException: The activator br.com.german.plugin.Activator for bundle br.com.german.plugin is invalid
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:171)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:389)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1130)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named ecf
	at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
	at br.com.german.plugin.entityManager.ECFEntityManager.init(ECFEntityManager.java:33)
	at br.com.german.plugin.entityManager.ECFEntityManager.createEntityManager(ECFEntityManager.java:44)
	at br.com.german.plugin.Activator.<init>(Activator.java:24)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at java.lang.Class.newInstance0(Class.java:355)
	at java.lang.Class.newInstance(Class.java:308)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:166)
	... 12 more


what am i missing here?
thanks in advice
Re: error during startup [message #725023 is a reply to message #724900] Tue, 13 September 2011 18:33 Go to previous messageGo to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
anyone? pleeease
(no subject) [message #725046 is a reply to message #724900] Tue, 13 September 2011 18:33 Go to previous messageGo to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
anyone? pleeease
Re: error during startup [message #725353 is a reply to message #724900] Wed, 14 September 2011 15:00 Go to previous message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
JPA usage in OSGi is not the same as in Java SE. Take a look at the EclipseLink OSGi examples for details: http://wiki.eclipse.org/EclipseLink/Examples/OSGi

--Shaun

[Updated on: Wed, 14 September 2011 15:00]

Report message to a moderator

(no subject) [message #725357 is a reply to message #724900] Wed, 14 September 2011 15:00 Go to previous message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
JPA usage in OSGi is not the same as in Java SE. Take a look at the EclipseLink OSGi examples for details: http://wiki.eclipse.org/EclipseLink/Examples/OSGi

--Shaun
Previous Topic:ManyToMany relation DELETE
Next Topic:SQLServer, IDENTITY and History issue
Goto Forum:
  


Current Time: Thu Apr 18 16:38:23 GMT 2024

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

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

Back to the top