[jboss-jira] [JBoss JIRA] (AS7-1974) Unable to access OSGI service from RESTEasy WebApp

Nikhil Joshi (Commented) (JIRA) jira-events at lists.jboss.org
Tue Oct 11 03:44:16 EDT 2011


    [ https://issues.jboss.org/browse/AS7-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633717#comment-12633717 ] 

Nikhil Joshi commented on AS7-1974:
-----------------------------------

I tried to use the workaround code getBundleContextFromClass()in attached RestEasy sample (MessageRestService.java)
It is throwing following exception at the line >> ConfigurationAdmin.class.getClassLoader();

java.lang.ClassCastException: org.jboss.modules.ModuleClassLoader cannot be cast to org.osgi.framework.BundleReference

I am trying this with 7.1.0 Alpha with following jars
org.osgi.compendium-4.2.0.jar
org.osgi.core-4.2.0.jar







                
> Unable to access OSGI service from RESTEasy WebApp
> --------------------------------------------------
>
>                 Key: AS7-1974
>                 URL: https://issues.jboss.org/browse/AS7-1974
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: OSGi
>    Affects Versions: 7.1.0.Alpha1
>         Environment: Using JBoss Developer Studio M3 on Windows 7. Server AS 7.0.0 final, 7.1.1 Alpha, EAP  6.0 (experimental) 
>            Reporter: Nikhil Joshi
>            Assignee: Thomas Diesler
>             Fix For: 7.1.0.CR1
>
>         Attachments: MessageRestService.java, OSGIWebClient.zip
>
>
> This is with reference to thread on community forum
> http://community.jboss.org/thread/172622
> I am trying to access a OSGI Bundle from a Web Application. Where getting following error.
> 12:16:04,070 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/MyRestService].[SimpleClientServlet]] (http--127.0.0.1-8080-1) Allocate exception for servlet SimpleClientServlet: java.lang.IllegalArgumentException: Can not set org.osgi.framework.BundleContext field sample.SimpleClientServlet.context to org.jboss.osgi.framework.internal.SystemBundleContext
>     at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) [:1.6.0_25]
>     at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) [:1.6.0_25]
>     at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source) [:1.6.0_25]
>     at java.lang.reflect.Field.set(Unknown Source) [:1.6.0_25]

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list