You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guillaume Sauthier (JIRA)" <ji...@apache.org> on 2013/06/27 09:41:20 UTC

[jira] [Commented] (FELIX-4148) ClassCastException on getService(ServiceReference)

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

Guillaume Sauthier commented on FELIX-4148:
-------------------------------------------

For info, [~clement.escoffier] proposed a workaround:

        if (reference instanceof TransformedServiceReference) {
            return ((TransformedServiceReference) reference).getWrappedReference();
        }

                
> ClassCastException on getService(ServiceReference)
> --------------------------------------------------
>
>                 Key: FELIX-4148
>                 URL: https://issues.apache.org/jira/browse/FELIX-4148
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>    Affects Versions: ipojo-runtime-1.10
>         Environment: runtime 1.10.1
>            Reporter: Guillaume Sauthier
>
> I got the following exception:
> java.lang.ClassCastException: org.apache.felix.ipojo.dependency.impl.TransformedServiceReferenceImpl cannot be cast to org.eclipse.osgi.internal.serviceregistry.ServiceReferenceImpl at org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(BundleContextImpl.java:594) at com.peergreen.security.internal.realm.manager.DefaultAccountStoreManager$ScopedAccountManager.findAccountStore(DefaultAccountStoreManager.java:93) at com.peergreen.security.realm.manager.AccountStoreManager$$Proxy.findAccountStore(Unknown Source) at com.peergreen.shelbie.security.internal.ListAccountsAction.__M_execute(ListAccountsAction.java:73) at com.peergreen.shelbie.security.internal.ListAccountsAction.execute(ListAccountsAction.java) at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35) at org.ow2.shelbie.core.internal.handler.CommandHandler.__M_execute(CommandHandler.java:178) at org.ow2.shelbie.core.internal.handler.CommandHandler.execute(CommandHandler.java) at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78) at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477) at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403) at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) at org.ow2.shelbie.core.console.JLineConsole.run(JLineConsole.java:172) at com.peergreen.shelbie.console.internal.PrivilegedRunnable$1.run(PrivilegedRunnable.java:38) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at com.peergreen.shelbie.console.internal.PrivilegedRunnable.run(PrivilegedRunnable.java:36) at com.peergreen.shelbie.console.internal.SecuredConsoleRunnable.run(SecuredConsoleRunnable.java:90) at java.lang.Thread.run(Thread.java:722)
> I have a component that is a ServiceFactory (creates the real services with the client BundleContext provided by ServiceFactory.getService(BundleContext, ServiceRegistration)). It is also bound to external services (but is injected with ServiceReference instead of the service instance).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira