Setting a Bundle cosuming Spring AOP [message #731325] |
Fri, 30 September 2011 12:24  |
Eclipse User |
|
|
|
Hello,
i have a Spring powered Web bundle, there is a bean as follow:
<bean id="workbench" class="com.thingtrack.konekti.view.Workbench" scope="prototype">
<property name="advisor">
<ref bean="workbenchAdvisor" />
</property>
</bean>
I want to use Spring AOP to build the logging service, developing a Aspect that cosumes the LogService OSGi service. Configured as follow:
<!-- Logging Aspect Configuration -->
<bean id="konektiLoggingAspect" class="com.thingtrack.konekti.view.logging.KonektiLogAspect">
<property name="logService">
<ref bean="logService" />
</property>
<aop:config>
<aop:pointcut expression="execution(* com.thingtrack.konekti.view..*.*(..))" id="loggingPointcut"/>
<aop:aspect id="loggingAspect" ref=konektiLoggingAspect>
<aop:before pointcut-ref="loggingPointcut" method="logEntry" />
<aop:after pointcut-ref="loggingPointcut" method="logExit" />
<aop:after-returning pointcut-ref="loggingPointcut" method="logExitAfterReturn" />
</aop:aspect>
</aop:config>
In the MANIFEST.MF the Import-Package has the following value:
...
org.springframework.aop,
org.springframework.aop.framework,
org.springframework.beans.factory,
org.springframework.context.weaving,
...
I also added the following tag:
<context:load-time-weaver aspectj-weaving="on"/>
(as it is explained the post thread
http://www.eclipse.org/forums/index.php/t/191773/)
BUT i always obtein the same failure when one instance of this prototyped bean is about to be created:
...
javax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workbench' defined in URL [bundleentry://155.fwk1687192366/META-INF/spring/bundle-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class $Proxy256
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:999)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:548)
javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
root cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workbench' defined in URL [bundleentry://155.fwk1687192366/META-INF/spring/bundle-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class $Proxy256
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075)
com.vaadin.terminal.gwt.server.SpringApplicationOSGiServlet.getNewApplication(SpringApplicationOSGiServlet.java:102)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:973)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:801)
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:456)
javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
...
I use VirgoRT 3.0.0.REALESE
Thanks
|
|
|
Re: Setting a Bundle cosuming Spring AOP [message #731367 is a reply to message #731325] |
Fri, 30 September 2011 14:30   |
Eclipse User |
|
|
|
Try to replace all individual import packages with a single
Import-Library: org.springframework.spring;version="[3.0.5.RELEASE,3.0.5.RELEASE]"
This will rulle out any missing classes from spring. You could be missing imports for "org.aopalliance.aop.*" packages or something deeper in spring that is used by factories to create aspects.
If you get it working with library import, start stripping away bundles and go with Import-Bundle
At minimum you will need:
Import-Bundle: com.springsource.org.aopalliance;version="[1.0.0,1.0.0]",
org.springframework.aop;version="[3.0.5.RELEASE,3.0.5.RELEASE]",
org.springframework.asm;version="[3.0.5.RELEASE,3.0.5.RELEASE]",
org.springframework.beans;version="[3.0.5.RELEASE,3.0.5.RELEASE]",
org.springframework.core;version="[3.0.5.RELEASE,3.0.5.RELEASE]"
org.springframework.context;version="[3.0.5.RELEASE,3.0.5.RELEASE]"
You might need to add ".aspects" and ".context-support". With web app you will also need the ".web" and ".web.servlet".
Regards,
Dmitry
|
|
|
|
Powered by
FUDForum. Page generated in 0.03894 seconds