Sunday, April 26, 2009

Load-Time Weaving for Spring-DM

Load-time weaving in an OSGi environment is different than in single-classpath-settings like you often have in Java. There you typically use a JVM agent or a specialized classloader that gets ClassFileTransformer components injected from your application. Those ClassFileTransformer components then to the real job of modifying bytecode at load-time. This is also used in the Spring framework to enable aspect weaving or JPA bytecode enhancements.
This gets different when you are working in an OSGi environment. Within OSGi you no longer have a single classpath application, you cannot (or at least should not) create specialized classloaders for yourself to do the magic, maybe the weaving should happen specifically for each bundle or the woven code gets additional dependencies woven into it. Using Spring in an OSGi environment doesn't make things easier. You can use Spring Dynamic Modules to implement really cool OSGi applications, but your Spring load-time weaving support remains broken to some degree (see all the related questions in the Spring-DM forum).
I often thought about using Equinox Aspects to solve these problems. Since Equinox Aspects is not tightly bound to AspectJ weaving only, you could re-use the base infrastructure to hook any kind of bytecode modifier into the Equinox runtime - and reuse the caching of Equinox Aspects at the same time.

Now I have a first sketch implemented that bridges between Spring-LTW and Equinox Aspects. The EquinoxAspectsLoadTimeWeaver class implements the LoadTimeWeaver interface of Spring and can therefore be used in your spring context as the load-time weaver component:

<context:spring-configured>
<context:annotation-config>
<context:load-time-weaver
class="org.eclipse.equinox.weaving.springweaver.EquinoxAspectsLoadTimeWeaver"/>

If you define this load-time weaver your bundle need to define an Import-Package on "org.eclipse.equinox.weaving.springweaver", of course.

To use this kind of load-time weaver definition to need to add "org.eclipse.equinox.weaving.hook" (from Equinox Aspects) to your target platform as well as "org.eclipse.equinox.weaving.springweaver":

When you launch your OSGi runtime you need to set the system property: (osgi.framework.extensions=org.eclipse.equinox.weaving.hook) and start the springweaver bundle right at startup. You can do this by adding it to the config.ini file (org.eclipse.equinox.weaving.springweaver@4:start). This is basically the same when using Equinox Aspects, except that you no longer start org.eclipse.equinox.weaving.aspectj but instead the springweaver bundle.

There are still some issues that need to be solved (see this comment in the spring forum for details), but I hope to can try it out and tell me what works fine and what needs some more work.

Feedback always welcome! Enjoy!

21 comments:

Eberhard Wolff said...

Great news! However, dm Server also supports load time weaving for AspectJ. What advantages does your approach offer?

Martin Lippert said...

Hi Eberhard!

Thanks for your comment. I am aware of dm Server also implements ltw for OSGi (not only AspectJ, but for all different kinds of lt weavers), but just for the server, not for spring-dm in general, if I remember this correctly. So if you wish to use spring-dm without a server (client-side, just OSGi, whatever) or with a different one (embedding OSGi in WebSphere, WebLogic, Tomcat, Jetty, whatever) or with a different web support (PAX-Web on top of OSGi) you are now able to use ltw for spring-dm with this bridge to Equinox Aspects.

Hope that makes the relationship clearer... Does it? ;-)

Cheers,
-Martin

Martin Lippert said...

I forgot to mention that Equinox Aspects also implements a quite performant cache for manipulated bytecode, providing zero-overhead startup times for the cached scenario. Not sure whether dm server does something similar or not...

-Martin

Eberhard Wolff said...

Hi,

thanks for explaining!

IMHO dm Server - as you mention - goes a step further and also supports byte code manipulation for JPA for example. And the scope of that is naturally defined by the application concept introduced by dm Server. Besides LTW it supports other features like WAR deployment and soon also cloning of OSGi bundles etc. That makes it a plug and play solution to many typical OSGi challenges.

I believe you could tweak dm Server to not launch a web server (for client usage) and actually I think running OSGi inside an existing Java EE application server is somewhat strange as OSGi needs a different deployment model anyway.

At the end of the day it is good to have choice - so keep up the good work! And both projects are Open Source so maybe there can even be some exchange of ideas and code.

Best regards,

Eberhard

Martin Lippert said...

To be precise here, the bridge that I implemented supports all kind of spring weavers that you have: AspectJ, JPA, whatever the future brings... ;-)
(The name "Equinox Aspects" suggests something different, I know, but you can do JPA weaving for Spring-DM with that bridge, its just an implementation of the LoadTimeWeaver interface of Spring).

Anyway, my bridge between Spring-DM and Equinox Aspects is not meant to be an alternative to dm server. I see it the other way around: dm server could adopt Equinox Aspects as the underlying technology for ltw, if they like. Then dm server could add all the other nice features on top of it?

Just some thoughts...

Cheers,
-Martin

Unknown said...

Hi Martin,

Thanks very much for the plugin. I had posted (http://forum.springsource.org/showthread.php?t=71414) the problems I was facing with load time weaving in JPA using spring dm.

I am trying to use your plugin, however am facing the same problem I had described in the post.

I had to modify your a plugin manifest a bit to change the import packages to the versions I have setup in my spring dm target. Also I had to remove the Plugin Required Execution Environment (JavaSE-1.6) since I don't have this environment. Also I had to recompile your classes, your classes were compiled with higher jdk version.

I imported your bundle as plug in dependency in my service bundle. Also configured the EquinoxAspectLoadTimeWeaver as the loadtimeweaver used.
< bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" >
.....
<property name="loadTimeWeaver">
<bean class="org.eclipse.equinox.weaving.springweaver.EquinoxAspectsLoadTimeWeaver" >
.....
</property>
</bean>

I have pasted the OSGI debug output on the cosole below.

Configuration location:
file:/C:/osgi/.metadata/.plugins/org.eclipse.pde.core/Spring-DM-TP/
Configuration file:
file:/C:/osgi/.metadata/.plugins/org.eclipse.pde.core/Spring-DM-TP/config.ini loaded
Install location:
file:/C:/osgi/Spring-DM-Target-Platform/target/
Framework located:
file:/C:/osgi/Spring-DM-Target-Platform/target/org.eclipse.osgi-3.3.1.R33x_v20070828.jar
Loading extension: org.eclipse.equinox.weaving.hook
eclipse.properties not found
Framework classpath:
file:/C:/osgi/Spring-DM-Target-Platform/target/org.eclipse.osgi-3.3.1.R33x_v20070828.jar
file:/C:/osgi/Spring-DM-Target-Platform/target/
file:/C:/osgi/Spring-DM-Target-Platform/target/org.eclipse.equinox.weaving.hook_1.0.0.200905031323.jar
Debug options:
file:/C:/osgi/.metadata/.plugins/org.eclipse.pde.core/Spring-DM-TP/.options loaded
getServiceReferences(org.osgi.service.packageadmin.PackageAdmin, "null")
getServiceReferences(org.osgi.service.url.URLStreamHandlerService, "null")
getServiceReferences(org.osgi.service.packageadmin.PackageAdmin, "null")
getServiceReferences(java.net.ContentHandler, "null")
registerService[System Bundle [0]]({org.eclipse.osgi.service.runnable.StartupMonitor}={service.ranking=-2147483648, service.id=1})
registerService[System Bundle [0]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
getService[System Bundle [0]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
getService[System Bundle [0]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
registerService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})
registerService[System Bundle [0]]({org.eclipse.osgi.service.debug.DebugOptions}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.debug.FrameworkDebugOptions, service.vendor=Eclipse.org, service.id=4})
registerService[System Bundle [0]]({org.eclipse.osgi.framework.log.FrameworkLog}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.adaptor.EclipseLog, service.vendor=Eclipse.org, service.id=5})
registerService[System Bundle [0]]({org.eclipse.osgi.framework.log.FrameworkLog}={service.ranking=-2147483648, performance=true, service.pid=46org.eclipse.core.runtime.adaptor.EclipseLog, service.vendor=Eclipse.org, service.id=6})
registerService[System Bundle [0]]({javax.xml.parsers.SAXParserFactory}={service.id=7})
registerService[System Bundle [0]]({javax.xml.parsers.DocumentBuilderFactory}={service.id=8})
registerService[System Bundle [0]]({org.eclipse.osgi.service.datalocation.Location}={type=osgi.user.area, service.id=9})
registerService[System Bundle [0]]({org.eclipse.osgi.service.datalocation.Location}={type=osgi.instance.area, service.id=10})
registerService[System Bundle [0]]({org.eclipse.osgi.service.datalocation.Location}={type=osgi.configuration.area, service.id=11})
registerService[System Bundle [0]]({org.eclipse.osgi.service.datalocation.Location}={type=osgi.install.area, service.id=12})
registerService[System Bundle [0]]({org.eclipse.osgi.service.urlconversion.URLConverter}={protocol=[bundleentry,bundleresource], service.id=13})
registerService[System Bundle [0]]({org.eclipse.osgi.service.environment.EnvironmentInfo}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.EclipseEnvironmentInfo, service.vendor=Eclipse.org, service.id=14})
registerService[System Bundle [0]]({org.eclipse.osgi.service.resolver.PlatformAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.internal.baseadaptor.StateManager, service.vendor=Eclipse.org, service.id=15})
registerService[System Bundle [0]]({org.eclipse.osgi.service.pluginconversion.PluginConverter}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.PluginConverterImpl, service.vendor=Eclipse.org, service.id=16})
registerService[System Bundle [0]]({org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.EclipseCommandProvider, service.vendor=Eclipse.org, service.id=17})
registerService[System Bundle [0]]({org.eclipse.osgi.service.localization.BundleLocalization}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.BundleLocalizationImpl, service.vendor=Eclipse.org, service.id=18})
getServiceReference(org.osgi.service.startlevel.StartLevel)
getService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})
registerService[System Bundle [0]]({org.eclipse.osgi.internal.provisional.verifier.CertificateVerifierFactory}={service.id=19})
registerService[System Bundle [0]]({org.eclipse.osgi.internal.provisional.verifier.CertificateTrustAuthority}={service.ranking=-2147483648, osgi.certificate.trust.authority=org.eclipse.osgi, service.id=20})
getServiceReferences(org.eclipse.osgi.framework.console.CommandProvider, "null")
getService[System Bundle [0]]({org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.EclipseCommandProvider, service.vendor=Eclipse.org, service.id=17})
registerService[System Bundle [0]]({org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.id=21})
getService[System Bundle [0]]({org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.id=21})

osgi> getServiceReference(org.osgi.service.startlevel.StartLevel)
getService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})
ungetService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})
getServiceReference(org.osgi.service.packageadmin.PackageAdmin)
getService[System Bundle [0]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
ungetService[System Bundle [0]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
getServiceReferences(org.eclipse.osgi.service.runnable.StartupMonitor, "null")
getService[System Bundle [0]]({org.eclipse.osgi.service.runnable.StartupMonitor}={service.ranking=-2147483648, service.id=1})
removeServiceListener[System Bundle [0]](org.osgi.util.tracker.ServiceTracker$Tracked@18f5824)
ungetService[System Bundle [0]]({org.eclipse.osgi.service.runnable.StartupMonitor}={service.ranking=-2147483648, service.id=1})
Time to load bundles: 2124
getServiceReference(org.osgi.service.startlevel.StartLevel)
getService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})
ungetService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})
getServiceReferences(org.eclipse.osgi.service.runnable.StartupMonitor, "null")
getService[System Bundle [0]]({org.eclipse.osgi.service.runnable.StartupMonitor}={service.ranking=-2147483648, service.id=1})
registerService[initial@reference:file:org.eclipse.equinox.weaving.springweaver_0.1.1.jar/ [4]]({org.eclipse.equinox.service.weaving.IWeavingServiceFactory}={service.id=22})
Persistence bundle starting...
getServiceReferences(javax.persistence.spi.PersistenceProvider, "null")
Persistence bundle started.
May 7, 2009 5:20:30 PM org.springframework.osgi.web.tomcat.internal.Activator$1 run
INFO: Starting Apache Tomcat/6.0.18 ...
May 7, 2009 5:20:30 PM org.springframework.osgi.web.tomcat.internal.Activator createCatalinaServer
INFO: Using default XML configuration bundleresource://14/conf/default-server.xml
May 7, 2009 5:20:30 PM org.springframework.osgi.extender.internal.activator.ContextLoaderListener start
INFO: Starting [org.springframework.osgi.extender] bundle v.[1.1.3.RELEASE]
getServiceReference(org.osgi.service.packageadmin.PackageAdmin)
getService[initial@reference:file:org.springframework.osgi.extender-1.1.3.RELEASE.jar/ [32]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
May 7, 2009 5:20:30 PM org.apache.catalina.startup.ClusterRuleSetFactory getClusterRuleSet
INFO: Unable to find a cluster rule set in the classpath. Will load the default rule set.
May 7, 2009 5:20:30 PM org.apache.catalina.startup.ClusterRuleSetFactory getClusterRuleSet
INFO: Unable to find a cluster rule set in the classpath. Will load the default rule set.
May 7, 2009 5:20:32 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
May 7, 2009 5:20:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1242 ms
May 7, 2009 5:20:32 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 7, 2009 5:20:32 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
May 7, 2009 5:20:32 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 7, 2009 5:20:32 PM org.springframework.osgi.web.tomcat.internal.Activator$1 run
INFO: Succesfully started Apache Tomcat/6.0.18 @ Catalina:8080
registerService[initial@reference:file:catalina.start.osgi-1.0-SNAPSHOT.jar/ [14]]({org.osgi.service.url.URLStreamHandlerService}={url.handler.protocol=jndi, service.id=23})
getService[System Bundle [0]]({org.osgi.service.url.URLStreamHandlerService}={url.handler.protocol=jndi, service.id=23})
registerService[initial@reference:file:catalina.start.osgi-1.0-SNAPSHOT.jar/ [14]]({org.apache.catalina.core.StandardService, org.apache.catalina.Service, javax.management.MBeanRegistration, org.apache.catalina.Lifecycle}={Bundle-Version=6.0.18.0, service.vendor=Spring Dynamic Modules, service.description=Apache Tomcat/6.0.18, Bundle-Name=org.springframework.osgi.catalina.start.osgi, org.springframework.osgi.bean.name=tomcat-server, service.id=24})
May 7, 2009 5:20:32 PM org.springframework.osgi.web.tomcat.internal.Activator$1 run
INFO: Published Apache Tomcat/6.0.18 as an OSGi service
registerService[initial@reference:file:org.springframework.osgi.extender-1.1.3.RELEASE.jar/ [32]]({org.springframework.beans.factory.xml.NamespaceHandlerResolver}={service.id=25})
registerService[initial@reference:file:org.springframework.osgi.extender-1.1.3.RELEASE.jar/ [32]]({org.xml.sax.EntityResolver}={service.id=26})
May 7, 2009 5:20:34 PM org.springframework.osgi.extender.internal.support.ExtenderConfiguration init
INFO: No custom extender configuration detected; using defaults...
May 7, 2009 5:20:34 PM org.springframework.scheduling.timer.TimerTaskExecutor afterPropertiesSet
INFO: Initializing Timer
getServiceReferences(null, "(objectClass=org.springframework.osgi.context.event.OsgiBundleApplicationContextListener)")
getServiceReference(org.osgi.service.packageadmin.PackageAdmin)
getService[initial@reference:file:org.eclipse.persistence.jpa-1.1.0.jar/ [33]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
registerService[initial@reference:file:org.eclipse.persistence.jpa-1.1.0.jar/ [33]]({javax.persistence.spi.PersistenceProvider}={javax.persistence.spi.PersistenceProvider=org.eclipse.persistence.jpa.osgi.PersistenceProviderOSGi, service.id=27})
ProviderTracker: New service detected...
getService[initial@reference:file:javax.persistence-1.99.0.jar/ [16]]({javax.persistence.spi.PersistenceProvider}={javax.persistence.spi.PersistenceProvider=org.eclipse.persistence.jpa.osgi.PersistenceProviderOSGi, service.id=27})
ProviderTracker: Added service org.eclipse.persistence.jpa.osgi.PersistenceProviderOSGi
registerService[initial@reference:file:org.springframework.osgi.test-1.1.3.RELEASE.jar/ [59]]({org.springframework.osgi.test.internal.TestRunnerService}={service.id=28})
unregisterService[initial@reference:file:org.springframework.osgi.test-1.1.3.RELEASE.jar/ [59]]({org.springframework.osgi.test.internal.TestRunnerService}={service.id=28})
May 7, 2009 5:20:34 PM org.springframework.scheduling.timer.TimerTaskExecutor afterPropertiesSet
INFO: Initializing Timer
May 7, 2009 5:20:34 PM org.springframework.osgi.web.extender.internal.activator.WarLoaderListener start
INFO: Starting [org.springframework.osgi.web.extender] bundle v.[1.1.3.RELEASE]
May 7, 2009 5:20:34 PM org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator createApplicationContext
INFO: Discovered configurations {osgibundle:/META-INF/spring/*.xml} in bundle [agClinical Services (com.arisglobal.agclinical.osgi.services)]
May 7, 2009 5:20:34 PM org.springframework.osgi.web.extender.internal.activator.WarListenerConfiguration init
INFO: No custom extender configuration detected; using defaults...
May 7, 2009 5:20:34 PM org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer afterPropertiesSet
INFO: No Catalina Service set; looking for one in the OSGi service registry...
getServiceReferences(null, "(objectClass=org.apache.catalina.Service)")
getServiceReference(org.osgi.service.packageadmin.PackageAdmin)
getService[initial@reference:file:org.springframework.osgi.extender-1.1.3.RELEASE.jar/ [32]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
getService[initial@reference:file:org.springframework.osgi.web.extender-1.1.3.RELEASE.jar/ [13]]({org.apache.catalina.core.StandardService, org.apache.catalina.Service, javax.management.MBeanRegistration, org.apache.catalina.Lifecycle}={Bundle-Version=6.0.18.0, service.vendor=Spring Dynamic Modules, service.description=Apache Tomcat/6.0.18, Bundle-Name=org.springframework.osgi.catalina.start.osgi, org.springframework.osgi.bean.name=tomcat-server, service.id=24})
getService[initial@reference:file:org.springframework.osgi.web.extender-1.1.3.RELEASE.jar/ [13]]({org.apache.catalina.core.StandardService, org.apache.catalina.Service, javax.management.MBeanRegistration, org.apache.catalina.Lifecycle}={Bundle-Version=6.0.18.0, service.vendor=Spring Dynamic Modules, service.description=Apache Tomcat/6.0.18, Bundle-Name=org.springframework.osgi.catalina.start.osgi, org.springframework.osgi.bean.name=tomcat-server, service.id=24})
May 7, 2009 5:20:34 PM org.springframework.osgi.web.deployer.tomcat.TomcatWarDeployer afterPropertiesSet
INFO: Found service Catalina
May 7, 2009 5:20:34 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@1797795: display name [OsgiBundleXmlApplicationContext(bundle=com.arisglobal.agclinical.osgi.services, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Thu May 07 17:20:34 IST 2009]; root of context hierarchy
May 7, 2009 5:20:35 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from URL [bundleentry://55/META-INF/spring/agclinicalservices-osgi.xml]
getServiceReferences(null, "(objectClass=org.xml.sax.EntityResolver)")
getService[initial@reference:file:../../com.arisglobal.agclinical.osgi.services/ [55]]({org.xml.sax.EntityResolver}={service.id=26})
getServiceReferences(null, "(objectClass=org.xml.sax.EntityResolver)")
getService[initial@reference:file:../../com.arisglobal.agclinical.osgi.services/ [55]]({org.xml.sax.EntityResolver}={service.id=26})
getServiceReferences(null, "(objectClass=org.springframework.beans.factory.xml.NamespaceHandlerResolver)")
getService[initial@reference:file:../../com.arisglobal.agclinical.osgi.services/ [55]]({org.springframework.beans.factory.xml.NamespaceHandlerResolver}={service.id=25})
May 7, 2009 5:20:35 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from URL [bundleentry://55/META-INF/spring/agclinicalservices.xml]
getServiceReferences(null, "(objectClass=org.xml.sax.EntityResolver)")
getService[initial@reference:file:../../com.arisglobal.agclinical.osgi.services/ [55]]({org.xml.sax.EntityResolver}={service.id=26})
getServiceReferences(null, "(objectClass=org.xml.sax.EntityResolver)")
getService[initial@reference:file:../../com.arisglobal.agclinical.osgi.services/ [55]]({org.xml.sax.EntityResolver}={service.id=26})
getServiceReference(org.osgi.service.packageadmin.PackageAdmin)
getService[initial@reference:file:../../com.arisglobal.agclinical.osgi.services/ [55]]({org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2})
getServiceReferences(null, "(objectClass=org.springframework.beans.factory.xml.NamespaceHandlerResolver)")
getService[initial@reference:file:../../com.arisglobal.agclinical.osgi.services/ [55]]({org.springframework.beans.factory.xml.NamespaceHandlerResolver}={service.id=25})
May 7, 2009 5:20:35 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@1797795]: org.springframework.beans.factory.support.DefaultListableBeanFactory@12cd19d
May 7, 2009 5:20:36 PM org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor stageOne
INFO: No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=com.arisglobal.agclinical.osgi.services, config=osgibundle:/META-INF/spring/*.xml)
May 7, 2009 5:20:36 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12cd19d: defining beans [personnelServiceOsgi,dataSource,persistenceUnitManager,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,personnelService]; root of factory hierarchy
May 7, 2009 5:20:36 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: oracle.jdbc.OracleDriver
May 7, 2009 5:20:36 PM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
INFO: Building JPA container EntityManagerFactory for persistence unit 'AG_CLINICAL_MAIN_DS'
[EL Config]: 2009-05-07 17:20:37.069--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The access type for the persistent class [class com.arisglobal.agclinical.osgi.entities.Phone] is set to [FIELD].
[EL Config]: 2009-05-07 17:20:37.1--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The alias name for the entity class [class com.arisglobal.agclinical.osgi.entities.Phone] is being defaulted to: Phone.
[EL Config]: 2009-05-07 17:20:37.1--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The table name for entity [class com.arisglobal.agclinical.osgi.entities.Phone] is being defaulted to: PHONE.
[EL Config]: 2009-05-07 17:20:37.179--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The access type for the persistent class [class com.arisglobal.agclinical.osgi.entities.Address] is set to [FIELD].
[EL Config]: 2009-05-07 17:20:37.179--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The alias name for the entity class [class com.arisglobal.agclinical.osgi.entities.Address] is being defaulted to: Address.
[EL Config]: 2009-05-07 17:20:37.179--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The table name for entity [class com.arisglobal.agclinical.osgi.entities.Address] is being defaulted to: ADDRESS.
[EL Config]: 2009-05-07 17:20:37.194--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The access type for the persistent class [class com.arisglobal.agclinical.osgi.entities.Personnel] is set to [FIELD].
[EL Config]: 2009-05-07 17:20:37.194--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The alias name for the entity class [class com.arisglobal.agclinical.osgi.entities.Personnel] is being defaulted to: Personnel.
[EL Config]: 2009-05-07 17:20:37.194--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The table name for entity [class com.arisglobal.agclinical.osgi.entities.Personnel] is being defaulted to: PERSONNEL.
[EL Config]: 2009-05-07 17:20:37.241--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The target entity (reference) class for the many to one mapping element [private com.arisglobal.agclinical.osgi.entities.Personnel com.arisglobal.agclinical.osgi.entities.Address.personnel] is being defaulted to: class com.arisglobal.agclinical.osgi.entities.Personnel.
[EL Config]: 2009-05-07 17:20:37.272--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The primary key column name for the mapping element [private com.arisglobal.agclinical.osgi.entities.Personnel com.arisglobal.agclinical.osgi.entities.Address.personnel] is being defaulted to: RECORD_ID.
[EL Config]: 2009-05-07 17:20:37.272--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The target entity (reference) class for the one to many mapping element [private java.util.List com.arisglobal.agclinical.osgi.entities.Personnel.addresses] is being defaulted to: class com.arisglobal.agclinical.osgi.entities.Address.
[EL Config]: 2009-05-07 17:20:37.304--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The target entity (reference) class for the one to many mapping element [private java.util.List com.arisglobal.agclinical.osgi.entities.Personnel.phones] is being defaulted to: class com.arisglobal.agclinical.osgi.entities.Phone.
[EL Config]: 2009-05-07 17:20:37.304--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The target entity (reference) class for the many to one mapping element [private com.arisglobal.agclinical.osgi.entities.Personnel com.arisglobal.agclinical.osgi.entities.Phone.personnel] is being defaulted to: class com.arisglobal.agclinical.osgi.entities.Personnel.
[EL Config]: 2009-05-07 17:20:37.304--ServerSession(7363880)--Thread(Thread[Start Level Event Dispatcher,5,main])--The primary key column name for the mapping element [private com.arisglobal.agclinical.osgi.entities.Personnel com.arisglobal.agclinical.osgi.entities.Phone.personnel] is being defaulted to: RECORD_ID.
May 7, 2009 5:20:37 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12cd19d: defining beans [personnelServiceOsgi,dataSource,persistenceUnitManager,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,personnelService]; root of factory hierarchy
May 7, 2009 5:20:37 PM org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext completeRefresh
SEVERE: Post refresh error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personnelServiceOsgi': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personnelService': Injection of persistence methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://55/META-INF/spring/agclinicalservices.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:288)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageTwo(DependencyWaiterApplicationContextExecutor.java:316)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:258)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:173)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:136)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:741)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.maybeCreateApplicationContextFor(ContextLoaderListener.java:788)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$ContextBundleListener.handleEvent(ContextLoaderListener.java:229)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$BaseListener.bundleChanged(ContextLoaderListener.java:172)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:1210)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:195)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:141)
at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1558)
at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1509)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:355)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:195)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:297)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personnelService': Injection of persistence methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://55/META-INF/spring/agclinicalservices.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:324)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:998)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:236)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://55/META-INF/spring/agclinicalservices.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:507)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:473)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:599)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:570)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:192)
at org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:117)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:321)
... 50 more
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:78)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:227)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
at com.arisglobal.aglite.jpa.AGEntityManagerFactoryBean.createNativeEntityManagerFactory(AGEntityManagerFactoryBean.java:23)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 66 more
May 7, 2009 5:20:37 PM org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext doClose
INFO: Unpublishing application context OSGi service for bundle agClinical Services (com.arisglobal.agclinical.osgi.services)
May 7, 2009 5:20:37 PM org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor fail
SEVERE: Unable to create application context for [com.arisglobal.agclinical.osgi.services], unsatisfied dependencies: none
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personnelServiceOsgi': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personnelService': Injection of persistence methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://55/META-INF/spring/agclinicalservices.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:288)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageTwo(DependencyWaiterApplicationContextExecutor.java:316)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:258)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:173)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:136)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:741)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.maybeCreateApplicationContextFor(ContextLoaderListener.java:788)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$ContextBundleListener.handleEvent(ContextLoaderListener.java:229)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$BaseListener.bundleChanged(ContextLoaderListener.java:172)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:1210)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:195)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:141)
at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1558)
at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1509)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:355)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:195)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:297)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personnelService': Injection of persistence methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://55/META-INF/spring/agclinicalservices.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:324)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:998)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:236)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://55/META-INF/spring/agclinicalservices.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:507)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:473)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:599)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:570)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:192)
at org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:117)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:321)
... 50 more
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:78)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:227)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
at com.arisglobal.aglite.jpa.AGEntityManagerFactoryBean.createNativeEntityManagerFactory(AGEntityManagerFactoryBean.java:23)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 66 more
removeServiceListener[System Bundle [0]](org.osgi.util.tracker.ServiceTracker$Tracked@cc5436)
ungetService[System Bundle [0]]({org.eclipse.osgi.service.runnable.StartupMonitor}={service.ranking=-2147483648, service.id=1})
getServiceReferences(org.osgi.service.startlevel.StartLevel, "null")
getService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})
removeServiceListener[System Bundle [0]](org.osgi.util.tracker.ServiceTracker$Tracked@bb6086)
ungetService[System Bundle [0]]({org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3})

Also I see that the springweaver bundle is started from the osgi prompt.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.3.1.R33x_v20070828
Fragments=1
1 RESOLVED org.eclipse.equinox.weaving.hook_1.0.0.200905031323
Master=0
2 ACTIVE com.springsource.javax.xml.stream_1.0.1
3 ACTIVE org.springframework.context_2.5.6.A
4 ACTIVE org.eclipse.equinox.weaving.springweaver_0.1.1
5 ACTIVE org.eclipse.persistence.asm_1.1.0
6 ACTIVE org.springframework.osgi.mock_1.1.3.RELEASE
7 ACTIVE com.springsource.javax.xml.bind_2.0.0
8 ACTIVE com.springsource.org.apache.catalina_6.0.18
Fragments=10, 47
9 ACTIVE org.springframework.jdbc_2.5.6.A
10 RESOLVED com.springsource.org.apache.coyote_6.0.18
Master=8
11 ACTIVE org.eclipse.persistence.moxy_1.1.0
12 ACTIVE com.springsource.org.apache.taglibs.standard_1.1.2
13 ACTIVE org.springframework.osgi.web.extender_1.1.3.RELEASE
14 ACTIVE org.springframework.osgi.catalina.start.osgi_1.0.0.SNAPSHOT
15 ACTIVE com.springsource.javax.mail_1.4.0
16 ACTIVE javax.persistence_1.99.0
17 ACTIVE com.springsource.org.aspectj.runtime_1.6.1
18 ACTIVE com.springsource.javax.xml.rpc_1.1.0
19 INSTALLED org.springframework.osgi.log4j.config_1.0.0
20 ACTIVE org.springframework.aspects_2.5.6.A
21 ACTIVE org.eclipse.persistence.sdo_1.1.0
22 ACTIVE org.springframework.osgi.core_1.1.3.RELEASE
23 ACTIVE com.springsource.org.apache.jasper.org.eclipse.jdt_6.0.18
24 ACTIVE org.eclipse.persistence.core_1.1.0
25 ACTIVE com.springsource.javax.xml.soap_1.3.0
26 ACTIVE com.springsource.javax.ejb_3.0.0
27 ACTIVE com.springsource.org.apache.commons.beanutils_1.7.0
28 ACTIVE org.springframework.web.servlet_2.5.6.A
29 ACTIVE com.springsource.javax.servlet.jsp_2.1.0
30 ACTIVE org.springframework.web_2.5.6.A
31 ACTIVE com.springsource.org.apache.commons.digester_1.8.0
32 ACTIVE org.springframework.osgi.extender_1.1.3.RELEASE
33 ACTIVE org.eclipse.persistence.jpa_1.1.0
34 ACTIVE com.springsource.javax.annotation_1.0.0
35 ACTIVE org.springframework.transaction_2.5.6.A
36 ACTIVE org.springframework.context.support_2.5.6.A
37 ACTIVE com.springsource.org.objectweb.asm_2.2.3
38 ACTIVE com.springsource.javax.servlet_2.5.0
39 ACTIVE com.springsource.javax.activation_1.1.1
40 ACTIVE org.springframework.test_2.5.6.A
41 ACTIVE com.springsource.junit_3.8.2
42 ACTIVE com.springsource.org.apache.el_6.0.18
43 ACTIVE org.springframework.orm_2.5.6.A
44 ACTIVE org.springframework.aop_2.5.6.A
45 ACTIVE com.springsource.org.apache.commons.logging_1.1.1
46 ACTIVE org.eclipse.persistence.antlr_1.1.0
47 RESOLVED com.springsource.org.apache.jasper_6.0.18
Master=8
48 ACTIVE com.springsource.org.apache.juli.extras_6.0.18
49 ACTIVE com.arisglobal.aglite_1.4.0.1
50 ACTIVE com.springsource.javax.el_1.0.0
51 ACTIVE com.springsource.org.aopalliance_1.0.0
52 ACTIVE org.springframework.osgi.io_1.1.3.RELEASE
53 ACTIVE org.springframework.osgi.web_1.1.3.RELEASE
54 INSTALLED com.springsource.slf4j.log4j_1.5.0
55 ACTIVE com.arisglobal.agclinical.osgi.services_1.0.0
56 RESOLVED com.springsource.slf4j.jcl_1.5.0
Master=62
57 ACTIVE com.springsource.javax.servlet.jsp.jstl_1.1.2
58 ACTIVE org.springframework.beans_2.5.6.A
59 RESOLVED org.springframework.osgi.test_1.1.3.RELEASE
60 ACTIVE com.springsource.org.apache.commons.collections_3.2.0
61 ACTIVE com.springsource.javax.xml.ws_2.1.1
62 ACTIVE com.springsource.slf4j.api_1.5.0
Fragments=56
63 ACTIVE org.springframework.core_2.5.6.A

Do you see anything wrong I am doing here?

Thanks for your help,
Shashi

Anonymous said...

Hello Martin,
I tried to use the org.eclipse.equinox.weaving.springweaver with spring 3.0.2 and SpringDM 2.0.0.M1, but they are not in the version range.
Will there be a new springweaver with updated dependency versions?

Martin Lippert said...

There are no plans for a new version at the moment. So if you would like to use the springweaver right now, I would recommend you patch the version specs within the manifest yourself. I haven't tried your setting myself, so let me know if you observe any problems.

HTH,
Martin

Angelo said...

Hi Martin,

At first, thank a lot for your work. I have tried to use org.eclipse.equinox.weaving.springweaver with EclipseLink and Equinox but I have problems.

Indead I have several bundles :

1) Domain bundle
2) DAO (API) bundle
3) DAO/JPA bundle wich define my bean entityManagerFactory with my bean loadTimeWeaver.

My problem is that my class from Domain bundle is never woven (I have checked your requiremenet). So I have studied your code and the problem come from that ClassFileTransformerRegistry store into Map(Bundle, List(ClassFileTransformer)) the ClassFileTransformer.

Into my case this Map contains BundleJPA/SpringClassFileTransformer

So Only my BundleJPA has a ClassFileTransformer. My Bundle Domain has never ClassFileTransformer.

If I set my domain classes into the bundle JPA/DAO, the woven is done correctly.

I'm trying to resolve this problem. If I find a solution I will send you a patch.

Regards Angelo

Angelo said...

Hi Martin,

I have updated your Springweaver bundle to manage JPA/Eclipselink. Please see at http://angelozerr.wordpress.com/2010/04/30/springweaver_step1/

You will find explanation of the problem with your Springweaver and try to explain how I fix it. There is too a sample with JPA/Eclipselink, that I will explain into another post.

Regards Angelo

Ɓukasz Koniecki said...

I’m experiencing problem with EquinoxLoadTimeWaver and org.springframework.beans.factory.config.PropertyPlaceholderConfigurer used in one bundle. Properties are not being resolved properly. If I comment out



properties are being substituted properly. I’m using Spring 2.5.5.

Have anyone had similar problem?

Eric Jain said...

I believe "class" should be "weaving-class"?

btw what's the difference between org.eclipse.equinox.weaving.springweaver.EquinoxAspectsLoadTimeWeaver and org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver (both with aspectj-weaving="on")?

Martin Lippert said...

The InstrumentationLoadTimeWeaver tries to add bytecode modifyers to the classloader itself if that classloader is of a specific type. This is not the case for OSGi environments where the OSGi runtime controls the classloader creation. Therefore I worked on the Equinox load time weaver.

Unknown said...

Thank you. Great plug-in I'm using it in RCP and RAP applications. Spring and RAP just the perfect combination!

Martin Lippert said...

Hi Miroslav,

glad to hear you like it!!!
Thanks for the nice feedback!!!

Cheers,
-Martin

Rich Mayfield said...

So, lets say that I've taken your code and have brought it up to date to work with OSGi Blueprint (instead of Spring DM) and the OSGi Weaving Service (instead of the Equinox Weaving Service).

What would you recommend as the best way to get this to the general public?

Martin Lippert said...

Hey Rick. That sounds awesome and I would love to see the code public. I would recommend to setup a project at GitHub (http://github.com) and post the project there. That makes the most sense nowadays. Feel free to ping me if you have any further questions. Cheers!

Rich Mayfield said...

Hi Martin. I've created a github repository (https://github.com/richmayfield/spring-osgi-weaving) seeded first with your original source. Modifications to that enable use of the OSGi Weaving Service and OSGi Blueprint.

I'm surprised that nobody has done this already and I guess maybe a question I should have asked from the beginning. Is there no (or low) demand for this because there's a more attractive alternative?

In any event, let me know what you think.

Charlie said...

Hi Rich,

Angelo Zerr did a multi bundle weaving project, based on the Martin's one. Also Virgo supports weaving in it's core component (a long time ago, I was searching for these things).

If you're going to improve this project, I'll advise you to look at these things.

Cheers Charlie

Christian Trutz said...

Hi Martin,

i am playing around with your springweaver bundle togheter with Gemini 2.0.0.RC (to be exact, I'm using the patch from richmayfield) and found a subtle problem:

I annotated an Eclipse command handler with @Configurable/@Autowired and hopped to get another Spring bean injected into my Eclipse command handler. This works, if I start my plugin manually before first use of the handler.

But if my plugin is activated just before first use of my handler (lazy loading), the classloading of my handler and the Spring context initialization are running parallel in two different threads. It happens that the classloading is faster and the Spring context is not informed about handler class loading and cannot wire it with dependent spring beans.

If I delay the class loading of my handler (e.g. class break point), then everything is OK and my handler is wired with dependent Spring beans.

I think the solution of this problem can only be a classloading hook in Equinox which delays class loading of an bundle until Spring context is initialized. What do you think about this?

Martin Lippert said...

Hey Christian!

I think this is similar to the problem that I faced with the Spring Extension Factory (https://github.com/martinlippert/spring-extension-factory), a bridge between the Eclipse extension point mechanism and Spring DM (or blueprint now). It waits for the spring context to be available (with a timeout). The code is in the getApplicationContext function here: https://github.com/martinlippert/spring-extension-factory/blob/master/org.eclipse.springframework.util/src/org/eclipse/springframework/util/SpringExtensionFactory.java#L104. Maybe this could be combined with the spring-osgi-weaver that you are using?

I haven't touched this code for a long time, therefore I am not exactly sure where and how to inject this piece, but I would take a look into this direction.

HTH,
Martin