|
|
|
Re: Virgo + EclipseLink JPA + Weaving + Spring [message #713978 is a reply to message #710237] |
Tue, 09 August 2011 14:05 |
Dmitry Sklyut Messages: 279 Registered: January 2010 |
Senior Member |
|
|
Hi Eric,
I only got it to work without FrameworkHook by using scoped deployment, i.e. par or a scoped plan. If this is not your goal - than FrameworkHook is the only other alternative that I can think off.
Here is what I did to get eclipse link to LTW domain classes.
1. Add <context:load-time-weaver /> to eclipselink/META-INF/spring/ejb.xml to enable LTW. Enabled LTW in persistence.xml
Result:
Exception [EclipseLink-60] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_set_customer_vh] or [_persistence_get_customer_vh] is not defined in the object [org.example.domain.Order].
Internal Exception: java.lang.NoSuchMethodException: org.example.domain.Order._persistence_get_customer_vh()
Mapping: org.eclipse.persistence.mappings.ManyToOneMapping[customer]
Descriptor: RelationalDescriptor(org.example.domain.Order --> [DatabaseTable(orders)])
Exception [EclipseLink-218] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: A NullPointerException would have occurred accessing a non-existent weaved _vh_ method [_persistence_get_customer_vh]. The class was not weaved properly - for EE deployments, check the module order in the application.xml deployment descriptor and verify that the module containing the persistence unit is ahead of any other module that uses it.
2. Created a scoped plan including changes in #1 (excluding domain bundle as it should be resolved by imports)
<plan name="org.example.forum" version="1.0.0" scoped="true" atomic="true"
xmlns="http://www.eclipse.org/virgo/schema/plan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.eclipse.org/virgo/schema/plan
http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
<artifact type="bundle" name="org.example.eclipselink-nolazy"/>
<artifact type="bundle" name="org.example.client"/>
</plan>
Result:
Same as #1
2. Added in org.example.domain to the scoped plan.
Result:
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.internal.weaving.PersistenceWeaved
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:134)
... 47 common frames omitted
3. Add Import-Bundle for org.eclipse.persistence.core;import-scope:=application and org.eclipse.persistence.jpa;import-scope:=application to the org.example.eclipselink-nolazy bundle
Result:
Classes are weaved and log output is attached.
[2011-08-09 09:57:52.377] DEBUG region-dm-5 org.example.client.Client Client invoked
[2011-08-09 09:57:52.377] DEBUG region-dm-5 org.example.client.Client Customer is a weaved class
[2011-08-09 09:57:52.377] DEBUG region-dm-5 org.example.client.Client Looking up all orders
[2011-08-09 09:57:52.385] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger client_acquired
[2011-08-09 09:57:52.386] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger acquire_unit_of_work_with_argument
[2011-08-09 09:57:52.407] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger begin_unit_of_work_flush
[2011-08-09 09:57:52.407] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger end_unit_of_work_flush
[2011-08-09 09:57:52.407] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger execute_query
[2011-08-09 09:57:52.408] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger acquire_connection
[2011-08-09 09:57:52.408] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger reconnecting_to_external_connection_pool
[2011-08-09 09:57:52.409] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger SELECT ID, CUSTOMER_ID FROM orders
[2011-08-09 09:57:52.414] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger release_connection
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger begin_unit_of_work_commit
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger end_unit_of_work_commit
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger resume_unit_of_work
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger release_unit_of_work
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger client_released
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.client.Client Done looking up orders
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger execute_query
[2011-08-09 09:57:52.415] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger execute_query
[2011-08-09 09:57:52.416] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger acquire_connection
[2011-08-09 09:57:52.416] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger reconnecting_to_external_connection_pool
[2011-08-09 09:57:52.416] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger SELECT ID, PRODUCTNAME, CUSTOMER_ID FROM orders WHERE (ID = ?)
bind => [1]
[2011-08-09 09:57:52.417] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger release_connection
[2011-08-09 09:57:52.417] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger execute_query
[2011-08-09 09:57:52.417] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger acquire_connection
[2011-08-09 09:57:52.417] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger reconnecting_to_external_connection_pool
[2011-08-09 09:57:52.418] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger SELECT ID FROM CUSTOMER WHERE (ID = ?)
bind => [1]
[2011-08-09 09:57:52.419] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger release_connection
[2011-08-09 09:57:52.419] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger execute_query
[2011-08-09 09:57:52.419] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger acquire_connection
[2011-08-09 09:57:52.419] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger reconnecting_to_external_connection_pool
[2011-08-09 09:57:52.420] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger SELECT ID, NAME FROM CUSTOMER WHERE (ID = ?)
bind => [1]
[2011-08-09 09:57:52.420] DEBUG region-dm-5 org.example.eclipselink.Slf4jSessionLogger release_connection
[2011-08-09 09:57:52.421] DEBUG region-dm-5 org.example.client.Client Fancy Product was purchased by Eric Hough
Regards,
Dmitry
-
Attachment: forum.tgz
(Size: 4.88KB, Downloaded 245 times)
|
|
|
|
Powered by
FUDForum. Page generated in 0.03657 seconds