felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clement Escoffier (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FELIX-552) ClassCastException when using services as dynamic proxies
Date Tue, 13 May 2008 13:40:57 GMT

    [ https://issues.apache.org/jira/browse/FELIX-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596393#action_12596393
] 

Clement Escoffier commented on FELIX-552:
-----------------------------------------

This issue comes from a cast made by factories when creating handlers (from factories as well).
Handler Factories (creating handlers) are exposed as regular factories. iPOJO detects that
it is a Handler Factory by analyzing factory service properties (handler.name and handler.namespace)
published by this factory. To avoid the described problem, handler factories need to expose
a specialized service interface avoiding the cast.

> ClassCastException when using services as dynamic proxies
> ---------------------------------------------------------
>
>                 Key: FELIX-552
>                 URL: https://issues.apache.org/jira/browse/FELIX-552
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>         Environment: Sun HotSpot JVM 1.6.0u4 + JOnAS 5.0.1
>            Reporter: Kiev Gama
>            Assignee: Clement Escoffier
>            Priority: Minor
>
> In a changed OSGi implementation that uses dynamic proxies for services, iPOJO presents
a typecast error. 
> iPOJO's implementation seems to rely on a service instance of org.apache.felix.ipojo.HandlerFactory,
but actually in this particular OSGi customization that service is dynamically replaced by
a proxied service which implements org.apache.felix.ipojo.Factory.
> java.lang.ClassCastException: $Proxy4 cannot be cast to org.apache.felix.ipojo.HandlerFactory
>         at org.apache.felix.ipojo.ComponentFactory$HandlerIdentifier.getFactory(ComponentFactory.java:964)
>         at org.apache.felix.ipojo.HandlerFactory.getHandlerInstance(HandlerFactory.java:331)
>         at org.apache.felix.ipojo.HandlerFactory.computeFactoryState(HandlerFactory.java:219)
>         at org.apache.felix.ipojo.ComponentFactory.addedService(ComponentFactory.java:220)
>         at org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:667)
>         at org.apache.felix.ipojo.util.Tracker$Tracked.trackInitialServices(Tracker.java:560)
>         at org.apache.felix.ipojo.util.Tracker.open(Tracker.java:195)
>         at org.apache.felix.ipojo.HandlerFactory.start(HandlerFactory.java:131)
>         at org.apache.felix.ipojo.Extender.start(Extender.java:243)
>         at org.apache.felix.ipojo.Extender.parse(Extender.java:147)
>         at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:123)
>         at org.apache.felix.ipojo.Extender.start(Extender.java:163)
>         at org.apache.felix.framework.util.SecureAction$Actions.start_aroundBody0(SecureAction.java:853)
>         at org.apache.felix.framework.util.SecureAction$Actions.start_aroundBody1$advice(SecureAction.java:168)
>         at org.apache.felix.framework.util.SecureAction$Actions.run(SecureAction.java:853)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:580)
>         at org.apache.felix.framework.Felix._startBundle(Felix.java:1568)
>         at org.apache.felix.framework.Felix.startBundle(Felix.java:1502)
>         at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1097)
>         at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
>         at java.lang.Thread.run(Thread.java:619)
> ERROR: Error starting file:/C:/Java/jonas-osgi-5.0.1/lib/bundles/org.apache.felix.ipojo-0.7.5-2008.01.28.jar
(org.osgi.framework.BundleException: Activator start error.)
> java.lang.ClassCastException: $Proxy4 cannot be cast to org.apache.felix.ipojo.HandlerFactory
>         at org.apache.felix.ipojo.ComponentFactory$HandlerIdentifier.getFactory(ComponentFactory.java:964)
>         at org.apache.felix.ipojo.HandlerFactory.getHandlerInstance(HandlerFactory.java:331)
>         at org.apache.felix.ipojo.HandlerFactory.computeFactoryState(HandlerFactory.java:219)
>         at org.apache.felix.ipojo.ComponentFactory.addedService(ComponentFactory.java:220)
>         at org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:667)
>         at org.apache.felix.ipojo.util.Tracker$Tracked.trackInitialServices(Tracker.java:560)
>         at org.apache.felix.ipojo.util.Tracker.open(Tracker.java:195)
>         at org.apache.felix.ipojo.HandlerFactory.start(HandlerFactory.java:131)
>         at org.apache.felix.ipojo.Extender.start(Extender.java:243)
>         at org.apache.felix.ipojo.Extender.parse(Extender.java:147)
>         at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:123)
>         at org.apache.felix.ipojo.Extender.start(Extender.java:163)
>         at org.apache.felix.framework.util.SecureAction$Actions.start_aroundBody0(SecureAction.java:853)
>         at org.apache.felix.framework.util.SecureAction$Actions.start_aroundBody1$advice(SecureAction.java:168)
>         at org.apache.felix.framework.util.SecureAction$Actions.run(SecureAction.java:853)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:580)
>         at org.apache.felix.framework.Felix._startBundle(Felix.java:1568)
>         at org.apache.felix.framework.Felix.startBundle(Felix.java:1502)
>         at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1097)
>         at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
>         at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message