Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Class loader issues within a plugin
[Teneo] Class loader issues within a plugin [message #108589] Mon, 28 January 2008 11:07 Go to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Hi!

I'm trying to use Teneo within an Eclipse plugin project. Unfortunately I'm
running into issues concerning the interdependencies of the JPOX, Teneo and
JDO plugins. My plugin configuration is:

Plugin name depends on jar file included

javax.jdo - jdo2-api-2.0.jar

org.jpox javax.jdo (reexport) jpox-1.1.9.jar
org.postgresql

masterDataEditor org.jpox
org.eclipse.emf.teneo.jpox
org.eclipse.emf.teneo.eclipse

This gives me the following exception upon executing the code further down:
java.lang.ClassNotFoundException: org.jpox.PersistenceManagerFactoryImpl
at java.lang.ClassLoader.findClass(ClassLoader.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:124)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:530)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
at
org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
at
org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
at
org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
at
org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:370)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:227)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:29 9)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:53 1)
<snipped/>

Teneo is at version 0.8.0.v200712280940 installed from the EMFT update site.

The problem seems to be that the class loader of the javax.jdo plugin cannot
find the jpox classes (which doesn't come as a surprise). However, I can't
solve the problem by letting javax.jdo depend on org.jpox, because that
would result in a cyclic dependency graph (and org.jpox required javax.jdo
as well). Before using Teneo, I simply passed my plugin's
(masterDataEditor) classloader to the JDOHelper class:

PersistenceManagerFactory factory =
JDOHelper.getPersistenceManagerFactory("jpox_postgre.properties ",
Activator.class.getClassLoader());
persistenceManager = factory.getPersistenceManager();

That solved the dependency problems, because both the javax.jdo as well as
the org.jpox plugins are visible to the class loader of my plugin. Could
someone please tell me how to proceed with Teneo in order to achieve the
same effect?

Cheers,
Florian


Here is the code I'm trying to run:

Properties properties = new Properties();
properties.setProperty(PMFConfiguration.JDO_DATASTORE_DRIVER NAME_PROPERTY, "com.postgresql.Driver");
properties.setProperty(PMFConfiguration.JDO_DATASTORE_URL_PR OPERTY, "jdbc:postgresql://localhost/asterisk");
properties.setProperty(PMFConfiguration.JDO_DATASTORE_USERNA ME_PROPERTY, "asterisk");
properties.setProperty(PMFConfiguration.JDO_DATASTORE_PASSWO RD_PROPERTY, "aiLiegh0");

String pmfName = "MyPMF"; // the name of the JpoxDataStore
JpoxDataStore jpoxDataStore =
JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
jpoxDataStore.setProperties(properties);
jpoxDataStore.setEPackages(new EPackage[]{MasterdataPackage.eINSTANCE});
jpoxDataStore.initialize();

// TODO Auto-generated method stub
PersistenceManagerFactory pmf = jpoxDataStore.getPMF();
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx=pm.currentTransaction();
try
{
tx.begin();

AgentGroup agentGroup = MasterdataFactory.eINSTANCE.createAgentGroup();
agentGroup.setName("myAgentGroup");
agentGroup.setMusicClass("mymusicclass");
pm.makePersistent(agentGroup);

Agent agent = MasterdataFactory.eINSTANCE.createAgent();
agent.setAgentId("6000");
agent.setName("Florian Hackenberger");
agent.setPassword("6000");
pm.makePersistent(agent);

tx.commit();
}
finally
{
if (tx.isActive())
{
tx.rollback();
}

pm.close();
}

--
Florian Hackenberger
Re: [Teneo] Class loader issues within a plugin [message #108606 is a reply to message #108589] Mon, 28 January 2008 11:54 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Florian,
I think it is related to the Eclipse-BuddyPolicy setting.
Does the javax.jdo have this line in its manifest.mf:
Eclipse-BuddyPolicy: dependent

or do you use another setting?

The same buddypolicy should be set in the org.jpox plugin.

gr. Martin


DI Florian Hackenberger wrote:
> Hi!
>
> I'm trying to use Teneo within an Eclipse plugin project. Unfortunately I'm
> running into issues concerning the interdependencies of the JPOX, Teneo and
> JDO plugins. My plugin configuration is:
>
> Plugin name depends on jar file included
>
> javax.jdo - jdo2-api-2.0.jar
>
> org.jpox javax.jdo (reexport) jpox-1.1.9.jar
> org.postgresql
>
> masterDataEditor org.jpox
> org.eclipse.emf.teneo.jpox
> org.eclipse.emf.teneo.eclipse
>
> This gives me the following exception upon executing the code further down:
> java.lang.ClassNotFoundException: org.jpox.PersistenceManagerFactoryImpl
> at java.lang.ClassLoader.findClass(ClassLoader.java:358)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at
> org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:124)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:530)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
> at
> org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:370)
> at org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:227)
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:29 9)
> at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:53 1)
> <snipped/>
>
> Teneo is at version 0.8.0.v200712280940 installed from the EMFT update site.
>
> The problem seems to be that the class loader of the javax.jdo plugin cannot
> find the jpox classes (which doesn't come as a surprise). However, I can't
> solve the problem by letting javax.jdo depend on org.jpox, because that
> would result in a cyclic dependency graph (and org.jpox required javax.jdo
> as well). Before using Teneo, I simply passed my plugin's
> (masterDataEditor) classloader to the JDOHelper class:
>
> PersistenceManagerFactory factory =
> JDOHelper.getPersistenceManagerFactory("jpox_postgre.properties ",
> Activator.class.getClassLoader());
> persistenceManager = factory.getPersistenceManager();
>
> That solved the dependency problems, because both the javax.jdo as well as
> the org.jpox plugins are visible to the class loader of my plugin. Could
> someone please tell me how to proceed with Teneo in order to achieve the
> same effect?
>
> Cheers,
> Florian
>
>
> Here is the code I'm trying to run:
>
> Properties properties = new Properties();
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_DRIVER NAME_PROPERTY, "com.postgresql.Driver");
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_URL_PR OPERTY, "jdbc:postgresql://localhost/asterisk");
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_USERNA ME_PROPERTY, "asterisk");
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_PASSWO RD_PROPERTY, "aiLiegh0");
>
> String pmfName = "MyPMF"; // the name of the JpoxDataStore
> JpoxDataStore jpoxDataStore =
> JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
> jpoxDataStore.setProperties(properties);
> jpoxDataStore.setEPackages(new EPackage[]{MasterdataPackage.eINSTANCE});
> jpoxDataStore.initialize();
>
> // TODO Auto-generated method stub
> PersistenceManagerFactory pmf = jpoxDataStore.getPMF();
> PersistenceManager pm = pmf.getPersistenceManager();
> Transaction tx=pm.currentTransaction();
> try
> {
> tx.begin();
>
> AgentGroup agentGroup = MasterdataFactory.eINSTANCE.createAgentGroup();
> agentGroup.setName("myAgentGroup");
> agentGroup.setMusicClass("mymusicclass");
> pm.makePersistent(agentGroup);
>
> Agent agent = MasterdataFactory.eINSTANCE.createAgent();
> agent.setAgentId("6000");
> agent.setName("Florian Hackenberger");
> agent.setPassword("6000");
> pm.makePersistent(agent);
>
> tx.commit();
> }
> finally
> {
> if (tx.isActive())
> {
> tx.rollback();
> }
>
> pm.close();
> }
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Class loader issues within a plugin [message #108645 is a reply to message #108606] Mon, 28 January 2008 14:24 Go to previous messageGo to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:
> Hi Florian,
> I think it is related to the Eclipse-BuddyPolicy setting.
> Does the javax.jdo have this line in its manifest.mf:
> Eclipse-BuddyPolicy: dependent

That solved it, thanks a lot!

Could someone with write access to the Teneo documentation on elver.org
please add this hint somewhere? Or have I just overlooked it (google
doesn't say so)?

Cheers,
Florian
Re: [Teneo] Class loader issues within a plugin [message #108659 is a reply to message #108645] Mon, 28 January 2008 14:45 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
It is there:
http://www.elver.org/jpox/installation.html#JPOX+Libraries

But maybe it is not clear/notable enough (although it's in bold ;-).
Let me know if you have a better location/better hint for this. I am always willing to improve this.

gr. Martin

DI Florian Hackenberger wrote:
> Martin Taal wrote:
>> Hi Florian,
>> I think it is related to the Eclipse-BuddyPolicy setting.
>> Does the javax.jdo have this line in its manifest.mf:
>> Eclipse-BuddyPolicy: dependent
>
> That solved it, thanks a lot!
>
> Could someone with write access to the Teneo documentation on elver.org
> please add this hint somewhere? Or have I just overlooked it (google
> doesn't say so)?
>
> Cheers,
> Florian
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Class loader issues within a plugin [message #108673 is a reply to message #108606] Mon, 28 January 2008 14:56 Go to previous messageGo to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:
> Hi Florian,
> I think it is related to the Eclipse-BuddyPolicy setting.
> Does the javax.jdo have this line in its manifest.mf:
> Eclipse-BuddyPolicy: dependent
>
> or do you use another setting?
>
> The same buddypolicy should be set in the org.jpox plugin.

My previous reply was a bit too enthusiastic. While your hint solved the
jpox <-> jdo cyclic dependency, the jpox plugin now fails to load the
org.postgresql classes. I read the articles [1] and [2] and I have tried to
specify BP 'dependent' for both the jpox and jdo plugins, added the postgre
plugin as a dependecy for both jdo and jpox, as well as my plugin project
and tried to use BP registered instead of dependent for both jpox and jdo
and registered my plugin masterDataEditor to both of them. Neither solution
worked. BTW. the postgre dependency is always marked as 'reexport'. The
stacktrace is:

org.jpox.exceptions.ClassNotResolvedException: Class com.postgresql.Driver
was not found in the CLASSPATH. Please check your specification and your
CLASSPATH.
at
org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:214)
at
org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:373)
at
org.jpox.datasource.DriverManagerDataSource.<init>(DriverManagerDataSource.java:73)
at
org.jpox.AbstractPersistenceManagerFactory.freezeConfigurati on(AbstractPersistenceManagerFactory.java:257)
at
org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager Factory(PersistenceManagerFactoryImpl.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:534)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
at
org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
at
org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
at
org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
at
org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
<snipped/>

I'm a bit lost. Help is greatly appreciated :-)

[1]http://www.eclipsezone.com/articles/eclipse-vms/
[2] http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhan cements#Buddy_Policy

Cheers,
Florian

--
Florian Hackenberger
Re: [Teneo] Class loader issues within a plugin [message #108687 is a reply to message #108673] Mon, 28 January 2008 15:07 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I just put all the jars in one plugin is this also a structure you can use? It would probably be
easier. And if this works then you can try to move the jars to their individual plugins.

gr. Martin


DI Florian Hackenberger wrote:
> Martin Taal wrote:
>> Hi Florian,
>> I think it is related to the Eclipse-BuddyPolicy setting.
>> Does the javax.jdo have this line in its manifest.mf:
>> Eclipse-BuddyPolicy: dependent
>>
>> or do you use another setting?
>>
>> The same buddypolicy should be set in the org.jpox plugin.
>
> My previous reply was a bit too enthusiastic. While your hint solved the
> jpox <-> jdo cyclic dependency, the jpox plugin now fails to load the
> org.postgresql classes. I read the articles [1] and [2] and I have tried to
> specify BP 'dependent' for both the jpox and jdo plugins, added the postgre
> plugin as a dependecy for both jdo and jpox, as well as my plugin project
> and tried to use BP registered instead of dependent for both jpox and jdo
> and registered my plugin masterDataEditor to both of them. Neither solution
> worked. BTW. the postgre dependency is always marked as 'reexport'. The
> stacktrace is:
>
> org.jpox.exceptions.ClassNotResolvedException: Class com.postgresql.Driver
> was not found in the CLASSPATH. Please check your specification and your
> CLASSPATH.
> at
> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:214)
> at
> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:373)
> at
> org.jpox.datasource.DriverManagerDataSource.<init>(DriverManagerDataSource.java:73)
> at
> org.jpox.AbstractPersistenceManagerFactory.freezeConfigurati on(AbstractPersistenceManagerFactory.java:257)
> at
> org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager Factory(PersistenceManagerFactoryImpl.java:99)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:534)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
> <snipped/>
>
> I'm a bit lost. Help is greatly appreciated :-)
>
> [1]http://www.eclipsezone.com/articles/eclipse-vms/
> [2] http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhan cements#Buddy_Policy
>
> Cheers,
> Florian
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Class loader issues within a plugin [message #108701 is a reply to message #108659] Mon, 28 January 2008 17:15 Go to previous messageGo to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:

> It is there:
> http://www.elver.org/jpox/installation.html#JPOX+Libraries
>
> But maybe it is not clear/notable enough (although it's in bold ;-).
> Let me know if you have a better location/better hint for this. I am
> always willing to improve this.

Ok thanks, I should see my oculist :-). I probably even read this, but at
that point in time, I had no idea what it was supposed to mean (buddy
policy) and obviously did not bother googling it either (very lazy indeed).
Maybe another sentence explaining the reason for placing all jars in one
plugin and why the Buddy policy is required if they are placed in separate
plugins. Thanks for your help!

Cheers,
Florian

--
Florian Hackenberger
Re: [Teneo] Class loader issues within a plugin [message #109293 is a reply to message #108687] Tue, 29 January 2008 18:51 Go to previous message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

It should be a matter of buddy-policies. i had lots of pain with spring
and hibernate on that, but finally with the right buddy policies
everything is fine. look at policy: registered and Register-Buddy.

Martin Taal schrieb:
> I just put all the jars in one plugin is this also a structure you can
> use? It would probably be easier. And if this works then you can try to
> move the jars to their individual plugins.
>
> gr. Martin
>
>
> DI Florian Hackenberger wrote:
>> Martin Taal wrote:
>>> Hi Florian,
>>> I think it is related to the Eclipse-BuddyPolicy setting.
>>> Does the javax.jdo have this line in its manifest.mf:
>>> Eclipse-BuddyPolicy: dependent
>>>
>>> or do you use another setting?
>>>
>>> The same buddypolicy should be set in the org.jpox plugin.
>>
>> My previous reply was a bit too enthusiastic. While your hint solved the
>> jpox <-> jdo cyclic dependency, the jpox plugin now fails to load the
>> org.postgresql classes. I read the articles [1] and [2] and I have
>> tried to
>> specify BP 'dependent' for both the jpox and jdo plugins, added the
>> postgre
>> plugin as a dependecy for both jdo and jpox, as well as my plugin project
>> and tried to use BP registered instead of dependent for both jpox and jdo
>> and registered my plugin masterDataEditor to both of them. Neither
>> solution
>> worked. BTW. the postgre dependency is always marked as 'reexport'. The
>> stacktrace is:
>>
>> org.jpox.exceptions.ClassNotResolvedException: Class
>> com.postgresql.Driver
>> was not found in the CLASSPATH. Please check your specification and your
>> CLASSPATH.
>> at
>> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:214)
>>
>> at
>> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:373)
>>
>> at
>> org.jpox.datasource.DriverManagerDataSource.<init>(DriverManagerDataSource.java:73)
>>
>> at
>> org.jpox.AbstractPersistenceManagerFactory.freezeConfigurati on(AbstractPersistenceManagerFactory.java:257)
>>
>> at
>> org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager Factory(PersistenceManagerFactoryImpl.java:99)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:534)
>> at
>> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
>> at
>> org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
>>
>> at
>> org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
>>
>> at
>> org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
>>
>> at
>> org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
>>
>> <snipped/>
>>
>> I'm a bit lost. Help is greatly appreciated :-)
>>
>> [1]http://www.eclipsezone.com/articles/eclipse-vms/
>> [2] http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhan cements#Buddy_Policy
>>
>>
>> Cheers,
>> Florian
>>
>
>
Re: [Teneo] Class loader issues within a plugin [message #614111 is a reply to message #108589] Mon, 28 January 2008 11:54 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Florian,
I think it is related to the Eclipse-BuddyPolicy setting.
Does the javax.jdo have this line in its manifest.mf:
Eclipse-BuddyPolicy: dependent

or do you use another setting?

The same buddypolicy should be set in the org.jpox plugin.

gr. Martin


DI Florian Hackenberger wrote:
> Hi!
>
> I'm trying to use Teneo within an Eclipse plugin project. Unfortunately I'm
> running into issues concerning the interdependencies of the JPOX, Teneo and
> JDO plugins. My plugin configuration is:
>
> Plugin name depends on jar file included
>
> javax.jdo - jdo2-api-2.0.jar
>
> org.jpox javax.jdo (reexport) jpox-1.1.9.jar
> org.postgresql
>
> masterDataEditor org.jpox
> org.eclipse.emf.teneo.jpox
> org.eclipse.emf.teneo.eclipse
>
> This gives me the following exception upon executing the code further down:
> java.lang.ClassNotFoundException: org.jpox.PersistenceManagerFactoryImpl
> at java.lang.ClassLoader.findClass(ClassLoader.java:358)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at
> org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:124)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:530)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
> at
> org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:370)
> at org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:227)
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:29 9)
> at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:53 1)
> <snipped/>
>
> Teneo is at version 0.8.0.v200712280940 installed from the EMFT update site.
>
> The problem seems to be that the class loader of the javax.jdo plugin cannot
> find the jpox classes (which doesn't come as a surprise). However, I can't
> solve the problem by letting javax.jdo depend on org.jpox, because that
> would result in a cyclic dependency graph (and org.jpox required javax.jdo
> as well). Before using Teneo, I simply passed my plugin's
> (masterDataEditor) classloader to the JDOHelper class:
>
> PersistenceManagerFactory factory =
> JDOHelper.getPersistenceManagerFactory("jpox_postgre.properties ",
> Activator.class.getClassLoader());
> persistenceManager = factory.getPersistenceManager();
>
> That solved the dependency problems, because both the javax.jdo as well as
> the org.jpox plugins are visible to the class loader of my plugin. Could
> someone please tell me how to proceed with Teneo in order to achieve the
> same effect?
>
> Cheers,
> Florian
>
>
> Here is the code I'm trying to run:
>
> Properties properties = new Properties();
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_DRIVER NAME_PROPERTY, "com.postgresql.Driver");
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_URL_PR OPERTY, "jdbc:postgresql://localhost/asterisk");
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_USERNA ME_PROPERTY, "asterisk");
> properties.setProperty(PMFConfiguration.JDO_DATASTORE_PASSWO RD_PROPERTY, "aiLiegh0");
>
> String pmfName = "MyPMF"; // the name of the JpoxDataStore
> JpoxDataStore jpoxDataStore =
> JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
> jpoxDataStore.setProperties(properties);
> jpoxDataStore.setEPackages(new EPackage[]{MasterdataPackage.eINSTANCE});
> jpoxDataStore.initialize();
>
> // TODO Auto-generated method stub
> PersistenceManagerFactory pmf = jpoxDataStore.getPMF();
> PersistenceManager pm = pmf.getPersistenceManager();
> Transaction tx=pm.currentTransaction();
> try
> {
> tx.begin();
>
> AgentGroup agentGroup = MasterdataFactory.eINSTANCE.createAgentGroup();
> agentGroup.setName("myAgentGroup");
> agentGroup.setMusicClass("mymusicclass");
> pm.makePersistent(agentGroup);
>
> Agent agent = MasterdataFactory.eINSTANCE.createAgent();
> agent.setAgentId("6000");
> agent.setName("Florian Hackenberger");
> agent.setPassword("6000");
> pm.makePersistent(agent);
>
> tx.commit();
> }
> finally
> {
> if (tx.isActive())
> {
> tx.rollback();
> }
>
> pm.close();
> }
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Class loader issues within a plugin [message #614114 is a reply to message #108606] Mon, 28 January 2008 14:24 Go to previous message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:
> Hi Florian,
> I think it is related to the Eclipse-BuddyPolicy setting.
> Does the javax.jdo have this line in its manifest.mf:
> Eclipse-BuddyPolicy: dependent

That solved it, thanks a lot!

Could someone with write access to the Teneo documentation on elver.org
please add this hint somewhere? Or have I just overlooked it (google
doesn't say so)?

Cheers,
Florian
Re: [Teneo] Class loader issues within a plugin [message #614115 is a reply to message #108645] Mon, 28 January 2008 14:45 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
It is there:
http://www.elver.org/jpox/installation.html#JPOX+Libraries

But maybe it is not clear/notable enough (although it's in bold ;-).
Let me know if you have a better location/better hint for this. I am always willing to improve this.

gr. Martin

DI Florian Hackenberger wrote:
> Martin Taal wrote:
>> Hi Florian,
>> I think it is related to the Eclipse-BuddyPolicy setting.
>> Does the javax.jdo have this line in its manifest.mf:
>> Eclipse-BuddyPolicy: dependent
>
> That solved it, thanks a lot!
>
> Could someone with write access to the Teneo documentation on elver.org
> please add this hint somewhere? Or have I just overlooked it (google
> doesn't say so)?
>
> Cheers,
> Florian
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Class loader issues within a plugin [message #614116 is a reply to message #108606] Mon, 28 January 2008 14:56 Go to previous message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:
> Hi Florian,
> I think it is related to the Eclipse-BuddyPolicy setting.
> Does the javax.jdo have this line in its manifest.mf:
> Eclipse-BuddyPolicy: dependent
>
> or do you use another setting?
>
> The same buddypolicy should be set in the org.jpox plugin.

My previous reply was a bit too enthusiastic. While your hint solved the
jpox <-> jdo cyclic dependency, the jpox plugin now fails to load the
org.postgresql classes. I read the articles [1] and [2] and I have tried to
specify BP 'dependent' for both the jpox and jdo plugins, added the postgre
plugin as a dependecy for both jdo and jpox, as well as my plugin project
and tried to use BP registered instead of dependent for both jpox and jdo
and registered my plugin masterDataEditor to both of them. Neither solution
worked. BTW. the postgre dependency is always marked as 'reexport'. The
stacktrace is:

org.jpox.exceptions.ClassNotResolvedException: Class com.postgresql.Driver
was not found in the CLASSPATH. Please check your specification and your
CLASSPATH.
at
org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:214)
at
org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:373)
at
org.jpox.datasource.DriverManagerDataSource.<init>(DriverManagerDataSource.java:73)
at
org.jpox.AbstractPersistenceManagerFactory.freezeConfigurati on(AbstractPersistenceManagerFactory.java:257)
at
org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager Factory(PersistenceManagerFactoryImpl.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:534)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
at
org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
at
org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
at
org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
at
org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
<snipped/>

I'm a bit lost. Help is greatly appreciated :-)

[1]http://www.eclipsezone.com/articles/eclipse-vms/
[2] http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhan cements#Buddy_Policy

Cheers,
Florian

--
Florian Hackenberger
Re: [Teneo] Class loader issues within a plugin [message #614117 is a reply to message #108673] Mon, 28 January 2008 15:07 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I just put all the jars in one plugin is this also a structure you can use? It would probably be
easier. And if this works then you can try to move the jars to their individual plugins.

gr. Martin


DI Florian Hackenberger wrote:
> Martin Taal wrote:
>> Hi Florian,
>> I think it is related to the Eclipse-BuddyPolicy setting.
>> Does the javax.jdo have this line in its manifest.mf:
>> Eclipse-BuddyPolicy: dependent
>>
>> or do you use another setting?
>>
>> The same buddypolicy should be set in the org.jpox plugin.
>
> My previous reply was a bit too enthusiastic. While your hint solved the
> jpox <-> jdo cyclic dependency, the jpox plugin now fails to load the
> org.postgresql classes. I read the articles [1] and [2] and I have tried to
> specify BP 'dependent' for both the jpox and jdo plugins, added the postgre
> plugin as a dependecy for both jdo and jpox, as well as my plugin project
> and tried to use BP registered instead of dependent for both jpox and jdo
> and registered my plugin masterDataEditor to both of them. Neither solution
> worked. BTW. the postgre dependency is always marked as 'reexport'. The
> stacktrace is:
>
> org.jpox.exceptions.ClassNotResolvedException: Class com.postgresql.Driver
> was not found in the CLASSPATH. Please check your specification and your
> CLASSPATH.
> at
> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:214)
> at
> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:373)
> at
> org.jpox.datasource.DriverManagerDataSource.<init>(DriverManagerDataSource.java:73)
> at
> org.jpox.AbstractPersistenceManagerFactory.freezeConfigurati on(AbstractPersistenceManagerFactory.java:257)
> at
> org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager Factory(PersistenceManagerFactoryImpl.java:99)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:534)
> at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
> at
> org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
> at
> org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
> <snipped/>
>
> I'm a bit lost. Help is greatly appreciated :-)
>
> [1]http://www.eclipsezone.com/articles/eclipse-vms/
> [2] http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhan cements#Buddy_Policy
>
> Cheers,
> Florian
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Class loader issues within a plugin [message #614118 is a reply to message #108659] Mon, 28 January 2008 17:15 Go to previous message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:

> It is there:
> http://www.elver.org/jpox/installation.html#JPOX+Libraries
>
> But maybe it is not clear/notable enough (although it's in bold ;-).
> Let me know if you have a better location/better hint for this. I am
> always willing to improve this.

Ok thanks, I should see my oculist :-). I probably even read this, but at
that point in time, I had no idea what it was supposed to mean (buddy
policy) and obviously did not bother googling it either (very lazy indeed).
Maybe another sentence explaining the reason for placing all jars in one
plugin and why the Buddy policy is required if they are placed in separate
plugins. Thanks for your help!

Cheers,
Florian

--
Florian Hackenberger
Re: [Teneo] Class loader issues within a plugin [message #614164 is a reply to message #108687] Tue, 29 January 2008 18:51 Go to previous message
Thomas is currently offline ThomasFriend
Messages: 151
Registered: July 2009
Senior Member
It should be a matter of buddy-policies. i had lots of pain with spring
and hibernate on that, but finally with the right buddy policies
everything is fine. look at policy: registered and Register-Buddy.

Martin Taal schrieb:
> I just put all the jars in one plugin is this also a structure you can
> use? It would probably be easier. And if this works then you can try to
> move the jars to their individual plugins.
>
> gr. Martin
>
>
> DI Florian Hackenberger wrote:
>> Martin Taal wrote:
>>> Hi Florian,
>>> I think it is related to the Eclipse-BuddyPolicy setting.
>>> Does the javax.jdo have this line in its manifest.mf:
>>> Eclipse-BuddyPolicy: dependent
>>>
>>> or do you use another setting?
>>>
>>> The same buddypolicy should be set in the org.jpox plugin.
>>
>> My previous reply was a bit too enthusiastic. While your hint solved the
>> jpox <-> jdo cyclic dependency, the jpox plugin now fails to load the
>> org.postgresql classes. I read the articles [1] and [2] and I have
>> tried to
>> specify BP 'dependent' for both the jpox and jdo plugins, added the
>> postgre
>> plugin as a dependecy for both jdo and jpox, as well as my plugin project
>> and tried to use BP registered instead of dependent for both jpox and jdo
>> and registered my plugin masterDataEditor to both of them. Neither
>> solution
>> worked. BTW. the postgre dependency is always marked as 'reexport'. The
>> stacktrace is:
>>
>> org.jpox.exceptions.ClassNotResolvedException: Class
>> com.postgresql.Driver
>> was not found in the CLASSPATH. Please check your specification and your
>> CLASSPATH.
>> at
>> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:214)
>>
>> at
>> org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:373)
>>
>> at
>> org.jpox.datasource.DriverManagerDataSource.<init>(DriverManagerDataSource.java:73)
>>
>> at
>> org.jpox.AbstractPersistenceManagerFactory.freezeConfigurati on(AbstractPersistenceManagerFactory.java:257)
>>
>> at
>> org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager Factory(PersistenceManagerFactoryImpl.java:99)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:534)
>> at
>> javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.j ava:478)
>> at
>> org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:526)
>>
>> at
>> org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:217)
>>
>> at
>> org.acoveo.callcenter.masterdataeditor.NavigationView.create SampleData(NavigationView.java:195)
>>
>> at
>> org.acoveo.callcenter.masterdataeditor.NavigationView.create PartControl(NavigationView.java:170)
>>
>> <snipped/>
>>
>> I'm a bit lost. Help is greatly appreciated :-)
>>
>> [1]http://www.eclipsezone.com/articles/eclipse-vms/
>> [2] http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhan cements#Buddy_Policy
>>
>>
>> Cheers,
>> Florian
>>
>
>
Previous Topic:[Compare] How to compare ecore models, content types
Next Topic:Re: Modeling tools
Goto Forum:
  


Current Time: Fri Apr 19 22:23:20 GMT 2024

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

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

Back to the top