Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
6 replies Latest Post - ‏2012-02-06T07:13:38Z by steven_screen
SystemAdmin
SystemAdmin
2233 Posts
ACCEPTED ANSWER

Pinned topic No available bundle exports package 'javax.naming'

‏2011-10-06T13:31:40Z |
My environment: WASCEv3, Windows XP
I created a web application bundle which is using jndi lookup for a osgi service deployed by another bundle.
In the MANIFEST.XML i imported javax.naming and javax.naming.spi, but the GEP plugin marks these two packages as error.
See the attached picture.

If i do not import these packages the code does not work and fails with ClassNotFoundException.

I think the bundle is fine and this is only a GEP problem. Can someone confirm this ?

tamguru
Updated on 2012-02-06T07:13:38Z at 2012-02-06T07:13:38Z by steven_screen
  • JohnYiXiao
    JohnYiXiao
    5 Posts
    ACCEPTED ANSWER

    Re: No available bundle exports package 'javax.naming'

    ‏2011-10-08T01:43:28Z  in response to SystemAdmin
    Hi, I think the package javax.naming and javax.naming.spi could not be found in your project's classpath either in OSGI Dependencies or lib directory, you can try to add the jar files which contain the packages into the project's classpath to solve the problem.
    • SystemAdmin
      SystemAdmin
      2233 Posts
      ACCEPTED ANSWER

      Re: No available bundle exports package 'javax.naming'

      ‏2011-10-10T07:11:22Z  in response to JohnYiXiao
      javax.naming and javax.naming.spi are part of jdk6 (see pic) which is included in the jre system library.
      That is why i am thinking its a plugin problem.
      • JohnYiXiao
        JohnYiXiao
        5 Posts
        ACCEPTED ANSWER

        Re: No available bundle exports package 'javax.naming'

        ‏2011-10-11T05:56:31Z  in response to SystemAdmin
        I think you need not import the javax.naming.spi explicitly, as the osgi framework would use system classloade to load the classes in that package.
        If you really want to import the packages manually, you need to have a bundle that contains all the packages.
  • Forrest_Xia
    Forrest_Xia
    82 Posts
    ACCEPTED ANSWER

    Re: No available bundle exports package 'javax.naming'

    ‏2011-10-10T16:39:33Z  in response to SystemAdmin
    what tools you are using to develop your web application bundle?

    GEP/WEP works together with an free OSGi tool "IBM Rational Development Tools for OSGi Applications" to manage the OSGi enterprise programming model artifacts.

    You can get more information on this link:
    http://www.ibm.com/developerworks/rational/downloads/10/rationaldevtoolsforosgiapplications.html
    • SystemAdmin
      SystemAdmin
      2233 Posts
      ACCEPTED ANSWER

      Re: No available bundle exports package 'javax.naming'

      ‏2011-10-11T06:42:45Z  in response to Forrest_Xia
      see attachment
      • steven_screen
        steven_screen
        1 Post
        ACCEPTED ANSWER

        Re: No available bundle exports package 'javax.naming'

        ‏2012-02-06T07:13:38Z  in response to SystemAdmin
        etc/config.properties

        1. javax.transaction is needed to avoid class loader constraint violation when using javax.sql
        org.osgi.framework.bootdelegation=sun.,com.sun.,javax.naming, javax.naming.* ....