Equinox Weaving Problem [message #493930] |
Wed, 28 October 2009 10:35  |
Eclipse User |
|
|
|
Hey folks,
I'm trying to give my application a big performance boost by making the lazy-loading work. Therefore I am trying to make use of dynamic weaving. As I couldn't get it to work within my Eclipse RCP application, I set up a minimalistic Equinox test environment (very similar to [1]) which can be run outside of the Eclipse IDE - it can be downloaded from [4], the complete test case including all third-party libs can be downloaded from [5].
I followed the bundle-start-level rules described in [1], weaving is enabled in persistence.xml, the weaving-hook-fragment is registered properly to the org.eclipse.osgi master bundle... I can't see what's going wrong with my test case.
Here is the code of my bundle's Activator:
public class Activator implements BundleActivator {
public void start(final BundleContext context) throws Exception {
if (createEntityManagerFactory()) {
if (Helper.classImplementsInterface(Foo.class, PersistenceWeaved.class)) {
System.out.println("Foo is woven");
} else {
System.err.println("Foo is not woven");
}
if (Helper.classImplementsInterface(Bar.class, PersistenceWeaved.class)) {
System.out.println("Bar is woven");
} else {
System.err.println("Bar is not woven");
}
}
}
public boolean createEntityManagerFactory() {
final Properties properties = new Properties();
properties.put(PersistenceUnitProperties.CLASSLOADER, this.getClass().getClassLoader());
final EntityManagerFactory emf = new PersistenceProvider().createEntityManagerFactory("default", properties);
if (null == emf) {
return false;
}
final EntityManager em = emf.createEntityManager();
if (null == em) {
emf.close();
return false;
}
em.close();
return true;
}
public void stop(final BundleContext context) throws Exception {
}
}
As you can imagine, the resulting output looks like this:
Foo is not woven
Bar is not woven
The short status of my bundles looks like this:
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.6.0.v20090914
Fragments=1
1 RESOLVED org.eclipse.persistence.jpa.equinox.weaving_1.2.0.v20091016-r5565
Master=0
2 RESOLVED org.apache.derby_10.1.2.1_v200803061811
3 RESOLVED org.eclipse.persistence.jpa.equinox_1.2.0.v20091016-r5565
Master=9
4 RESOLVED org.eclipse.persistence.antlr_1.2.0.v20091016-r5565
5 RESOLVED org.eclipse.persistence.core_1.2.0.v20091016-r5565
6 RESOLVED org.eclipse.persistence.asm_1.2.0.v20091016-r5565
7 ACTIVE org.eclipse.equinox.common_3.5.100.v20090817
8 ACTIVE javax.persistence_1.99.6.v200910161445
9 ACTIVE org.eclipse.persistence.jpa_1.2.0.v20091016-r5565
Fragments=3
10 ACTIVE test.weaving_1.0.0.200910290705
My persistence.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<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="default" transaction-type="RESOURCE_LOCAL">
<class>test.weaving.Foo</class>
<class>test.weaving.Bar</class>
<properties>
<property name="eclipselink.weaving" value="true"/>
<property name="eclipselink.jdbc.url" value="jdbc:derby:weavingtest;create=true"/>
<property name="javax.persistence.jdbc.user" value="xyz"/>
<property name="javax.persistence.jdbc.password" value="xyz"/>
<property name="eclipselink.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="eclipselink.target-database" value="Derby"/>
<property name="eclipselink.jdbc.read-connections.min" value="1"/>
<property name="eclipselink.jdbc.write-connections.min" value="1"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
<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="false"/>
</properties>
</persistence-unit>
</persistence>
Here are the versions I am currently using for this test:
- Equinox/Eclipse: 3.6M2
- Derby ([2]): 10.1.2
- EclipseLink ([3]): 1.2.0 OSGI bundles
Help is very appreciated!!!
Thanks in advance,
Oliver
[1] http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_By te_Code_Weaving
[2] http://download.eclipse.org/tools/orbit/downloads/drops/R200 90825191606/
[3] http://www.eclipse.org/downloads/download.php?file=/rt/eclip selink/releases/1.2.0/eclipselink-plugins-1.2.0.v20091016-r5 565.zip
[4] http://www.filefactory.com/file/a1e99hf/n/equinox_weaving_fa ilure_zip/
[5] http://www.filefactory.com/file/a07f82b/n/equniox_weaving_fa ilure_complete_zip
[Updated on: Thu, 29 October 2009 02:23] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05577 seconds