You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Oliver Lietz <ap...@oliverlietz.de> on 2009/11/15 19:15:12 UTC
(Geronimo Blueprint/Karaf) class cast exception on proxy
hello all,
I'm exporting a service with auto-export set to all-classes, but a class cast
exception is thrown when trying to cast the proxy to a concrete class from
the class hierarchy of the exported service. Is this a known limitation?
(a similar limitation in Spring DM comes to my mind)
thanks,
O.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: (Geronimo Blueprint/Karaf) class cast exception on proxy
Posted by Oliver Lietz <ap...@oliverlietz.de>.
Am Dienstag 17 November 2009 schrieb Guillaume Nodet:
> How do you configure your <reference/> ? You need to specify
> javafx.scene.CustomNode as the interface if you want to be able to
> cast the proxies to this class.
[...]
net.sf.cglib.core.CodeGenerationException:
java.lang.AbstractMethodError-->com.example.api.ModuleNode.create()Ljavafx/scene/Node;
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:643)
at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at
org.apache.geronimo.blueprint.container.AbstractServiceReferenceRecipe$CgLibProxyFactory.createProxy(AbstractServiceReferenceRecipe.java:582)
at
org.apache.geronimo.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:244)
[…]
Abstract ModuleNode extends CustomNode and implements my ModuleView interface.
Same happens with FooNode which implements (overwrites) the create method.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: (Geronimo Blueprint/Karaf) class cast exception on proxy
Posted by Guillaume Nodet <gn...@gmail.com>.
How do you configure your <reference/> ? You need to specify
javafx.scene.CustomNode as the interface if you want to be able to
cast the proxies to this class.
On Tue, Nov 17, 2009 at 09:07, Oliver Lietz <ap...@oliverlietz.de> wrote:
> Am Montag 16 November 2009 schrieb Guillaume Nodet:
>> On Mon, Nov 16, 2009 at 22:45, Oliver Lietz <ap...@oliverlietz.de> wrote:
>> > Am Montag 16 November 2009 schrieb Guillaume Nodet:
>> >
>> > Thanks, Guillaume.
>> >
>> >> Yes, the blueprint specification only allow interfaces and use proxies
>> >> underneath, so you can't access the real class. The geronimo
>> >> blueprint implementation has a feature similar to spring-dm where you
>> >> can have proxies for classes (using cglib) instead of just interfaces.
>> >
>> > How can I use this feature? Where is it documented?
>>
>> It's not really documented.
>> You can activate it by using the custom namespace:
>>
>> <blueprint
>> xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
>> .... >
>>
>> <reference ... ext:proxy-method="classes">
>> ...
>> </reference>
>>
>> </blueprint>
>>
>> You can also use this flag on the <reference-list> element.
>>
>> >> But still you won't be able to access the exact instance that has
>> >> been registered in the OSGi registry.
>> >
>> > Does a cast or a call to instanceof work? I'm trying to figure out the
>> > most elegant way to inject a set of views in to an application's user
>> > interface. The views inherit from javafx.scene.CustomNode and it works
>> > when I use a wrapper. But I want to get rid off these wrappers of course.
>>
>> I suppose it should work, as cglib create a derived class underneath.
>
> no luck: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
> com.example.api.ModuleView$$EnhancerByCGLIB$$17150a4b cannot be cast to
> javafx.scene.Node
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: (Geronimo Blueprint/Karaf) class cast exception on proxy
Posted by Oliver Lietz <ap...@oliverlietz.de>.
Am Montag 16 November 2009 schrieb Guillaume Nodet:
> On Mon, Nov 16, 2009 at 22:45, Oliver Lietz <ap...@oliverlietz.de> wrote:
> > Am Montag 16 November 2009 schrieb Guillaume Nodet:
> >
> > Thanks, Guillaume.
> >
> >> Yes, the blueprint specification only allow interfaces and use proxies
> >> underneath, so you can't access the real class. The geronimo
> >> blueprint implementation has a feature similar to spring-dm where you
> >> can have proxies for classes (using cglib) instead of just interfaces.
> >
> > How can I use this feature? Where is it documented?
>
> It's not really documented.
> You can activate it by using the custom namespace:
>
> <blueprint
> xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
> .... >
>
> <reference ... ext:proxy-method="classes">
> ...
> </reference>
>
> </blueprint>
>
> You can also use this flag on the <reference-list> element.
>
> >> But still you won't be able to access the exact instance that has
> >> been registered in the OSGi registry.
> >
> > Does a cast or a call to instanceof work? I'm trying to figure out the
> > most elegant way to inject a set of views in to an application's user
> > interface. The views inherit from javafx.scene.CustomNode and it works
> > when I use a wrapper. But I want to get rid off these wrappers of course.
>
> I suppose it should work, as cglib create a derived class underneath.
no luck: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
com.example.api.ModuleView$$EnhancerByCGLIB$$17150a4b cannot be cast to
javafx.scene.Node
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: (Geronimo Blueprint/Karaf) class cast exception on proxy
Posted by Guillaume Nodet <gn...@gmail.com>.
On Mon, Nov 16, 2009 at 22:45, Oliver Lietz <ap...@oliverlietz.de> wrote:
> Am Montag 16 November 2009 schrieb Guillaume Nodet:
>
> Thanks, Guillaume.
>
>> Yes, the blueprint specification only allow interfaces and use proxies
>> underneath, so you can't access the real class. The geronimo
>> blueprint implementation has a feature similar to spring-dm where you
>> can have proxies for classes (using cglib) instead of just interfaces.
>
> How can I use this feature? Where is it documented?
It's not really documented.
You can activate it by using the custom namespace:
<blueprint xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
.... >
<reference ... ext:proxy-method="classes">
...
</reference>
</blueprint>
You can also use this flag on the <reference-list> element.
>
>> But still you won't be able to access the exact instance that has
>> been registered in the OSGi registry.
>
> Does a cast or a call to instanceof work? I'm trying to figure out the most
> elegant way to inject a set of views in to an application's user interface.
> The views inherit from javafx.scene.CustomNode and it works when I use a
> wrapper. But I want to get rid off these wrappers of course.
I suppose it should work, as cglib create a derived class underneath.
> Any hint is welcome.
>
>> On Sun, Nov 15, 2009 at 19:15, Oliver Lietz <ap...@oliverlietz.de> wrote:
>> > hello all,
>> >
>> > I'm exporting a service with auto-export set to all-classes, but a class
>> > cast exception is thrown when trying to cast the proxy to a concrete
>> > class from the class hierarchy of the exported service. Is this a known
>
>> > limitation? (a similar limitation in Spring DM comes to my mind)
>> >
>> > thanks,
>> > O.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> > For additional commands, e-mail: users-help@felix.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: (Geronimo Blueprint/Karaf) class cast exception on proxy
Posted by Oliver Lietz <ap...@oliverlietz.de>.
Am Montag 16 November 2009 schrieb Guillaume Nodet:
Thanks, Guillaume.
> Yes, the blueprint specification only allow interfaces and use proxies
> underneath, so you can't access the real class. The geronimo
> blueprint implementation has a feature similar to spring-dm where you
> can have proxies for classes (using cglib) instead of just interfaces.
How can I use this feature? Where is it documented?
> But still you won't be able to access the exact instance that has
> been registered in the OSGi registry.
Does a cast or a call to instanceof work? I'm trying to figure out the most
elegant way to inject a set of views in to an application's user interface.
The views inherit from javafx.scene.CustomNode and it works when I use a
wrapper. But I want to get rid off these wrappers of course.
Any hint is welcome.
> On Sun, Nov 15, 2009 at 19:15, Oliver Lietz <ap...@oliverlietz.de> wrote:
> > hello all,
> >
> > I'm exporting a service with auto-export set to all-classes, but a class
> > cast exception is thrown when trying to cast the proxy to a concrete
> > class from the class hierarchy of the exported service. Is this a known
> > limitation? (a similar limitation in Spring DM comes to my mind)
> >
> > thanks,
> > O.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: (Geronimo Blueprint/Karaf) class cast exception on proxy
Posted by Guillaume Nodet <gn...@gmail.com>.
Yes, the blueprint specification only allow interfaces and use proxies
underneath, so you can't access the real class. The geronimo
blueprint implementation has a feature similar to spring-dm where you
can have proxies for classes (using cglib) instead of just interfaces.
But still you won't be able to access the exact instance that has
been registered in the OSGi registry.
On Sun, Nov 15, 2009 at 19:15, Oliver Lietz <ap...@oliverlietz.de> wrote:
> hello all,
>
> I'm exporting a service with auto-export set to all-classes, but a class cast
> exception is thrown when trying to cast the proxy to a concrete class from
> the class hierarchy of the exported service. Is this a known limitation?
> (a similar limitation in Spring DM comes to my mind)
>
> thanks,
> O.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org