[RCP+Spring] interface org.eclipse.ui.IViewPart is not visible from class loader [message #449812] |
Fri, 19 May 2006 10:06  |
Eclipse User |
|
|
|
Hi,
I'm investigating Eclipse RCP + Spring integration (by Neil Bartlett,
http://sourceforge.net/projects/eclipse-spring). Basic idea is to replace
a view in my application with generic 'not authorized' view utilizing
spring aop + acegi.
It sort of works (plain spring, that is) but now I tried to fetch a view
from context through ProxyFactoryBean and it failed with the following
error:
INFO [net.sourceforge.eclipsespring.SpringExtensionFactory] - Returning
bean [perspective] from bean factory [ctx]
INFO [net.sourceforge.eclipsespring.SpringExtensionFactory] - Returning
bean [view] from bean factory [ctx]
INFO [org.springframework.aop.framework.DefaultAopProxyFactory] - CGLIB2
available: proxyTargetClass feature enabled
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'view': FactoryBean threw exception on object creation;
nested exception is java.lang.IllegalArgumentException: interface
org.eclipse.ui.IWorkbenchPart2 is not visible from class loader
Caused by: java.lang.IllegalArgumentException: interface
org.eclipse.ui.IWorkbenchPart2 is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at
org.springframework.aop.framework.JdkDynamicAopProxy.getProx y(JdkDynamicAopProxy.java:104)
at
org.springframework.aop.framework.JdkDynamicAopProxy.getProx y(JdkDynamicAopProxy.java:94)
at
org.springframework.aop.framework.ProxyFactoryBean.getProxy( ProxyFactoryBean.java:347)
<snip>
[NB: Strange enough, when I started writing this post,
org.eclipse.ui.IViewPart was problematic, but now it's IWorkbenchPart2]
My setup:
RcpWithSpring - RCP project based on mail rcp template
org.springframework - plugin with spring, cglib, aopalliance, log4j and
commons-logging jars - seems to work fine
net.sourceforge.eclipsespring - plugin by N. Bartlett, added some
'generic' views but basically same as original.
RcpWithSpring loads view and perspective from spring context through
SpringExtensionFactory and it works fine, but when AOP is introduced it
fails with above mentioned error.
Context file:
---------
<bean id="viewTarget" singleton="false" class="rcpwithspring.View"/>
<bean id="perspective" singleton="true"
class="rcpwithspring.Perspective"/>
<bean id="view"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="viewTarget"/>
<property name="interceptorNames">
<list>
<value>secureViewAdvice</value>
</list>
</property>
</bean>
<bean id="secureViewAdvice"
class="net.sourceforge.eclipsespring.security.SecureViewAdvice "/>
----------
rcpwithspring.View is from mail rcp app template.
net.sourceforge.eclipsespring.security.SecureViewAdvice is plain simple
and in reality doens't do anything, just returns mentioned view:
public class SecureViewAdvice implements MethodInterceptor {
public Object invoke(MethodInvocation invocation) throws Throwable {
// return new SecureView(); // idea is to return another, generic
view
return invocation.proceed(); // but now just return target
}
}
I'd say this is not directly related to Spring nor RCP+Spring, but rather
to RCP class loading issues. I remember seeing some Spring AOP + Eclipse
class loader issues in older version of eclipse, but they are fixed.
My configuration:
Eclipse 3.2 RC 3 (and Eclipse 3.1 too)
Spring 2.0 M4
Recent eclipse-spring plugin
Ahh...:-)
I hope my post is not too confusing. If more details are needed I'd be
happy to provide them.
Thanks in advance,
Davor
|
|
|
Re: [RCP+Spring] interface org.eclipse.ui.IViewPart is not visible from class lo [message #449822 is a reply to message #449812] |
Fri, 19 May 2006 14:29  |
Eclipse User |
|
|
|
Just a short addition:
With tracing enabled (in run configuration), different classes cannot be
loaded, e.g.
interface org.eclipse.ui.part.IWorkbenchPartOrientation is not visible
from class loader
and later
interface org.eclipse.ui.IWorkbenchPart2 is not visible from class loader
When disabled, IViewPart cannot be loaded. I guess it has to do something
with classpath entry order.
Cheers,
Davor
|
|
|
Powered by
FUDForum. Page generated in 0.03822 seconds