Announcement Announcement Module
Collapse
No announcement yet.
How to config the bootdelegation in config.ini? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to config the bootdelegation in config.ini?

    Now I find another problem, and the exception message is shown as below:

    Caused by: java.lang.NoClassDefFoundError: javax/naming/directory/Attributes
    at org.jivesoftware.smack.ConnectionConfiguration.<in it>(ConnectionConfiguration.java:81)
    at org.jivesoftware.smack.XMPPConnection.<init>(XMPPC onnection.java:190)
    at com.okooo.osgi.common.service.impl.XmppServiceImpl .connect(XmppServiceImpl.java:47)
    at com.okooo.osgi.common.service.impl.XmppServiceImpl .start(XmppServiceImpl.java:34)
    at com.okooo.osgi.common.Activator.configXmppService( Activator.java:139)
    at com.okooo.osgi.common.Activator.start(Activator.ja va:60)
    at org.eclipse.osgi.framework.internal.core.BundleCon textImpl$2.run(BundleContextImpl.java:1009)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleCon textImpl.startActivator(BundleContextImpl.java:1

    It seems that DM Server can't load some classes inside JDK.

    When I use Equinox, I can config bootdelegation in config.ini to resolve this problem, for example:
    org.osgi.framework.bootdelegation=cn.sendsms.*,sun .*,com.sun.*,javax.*,org.w3c.*,org.xml.*,sunw.*

    Then I can load such classes.

    But when I use DM Server, I can't find config.ini.

    Will anybody tell me how to find config.int?

    Thanks!

  • #2
    In both vanilla Equinox and dm Server, the javax.naming.directory package is exported by the System bundle. This means that to access it, you should import it into your bundle that depends upon it, e.g.:

    Code:
    Import-Package: javax.naming.directory
    Generally, I would not recommend making changes to the packages that are boot delegated and the packages that are exported by the system bundle, as a means of 'fixing' your application's imports. A better solution is to include the correct Import-Package statements in your manifest(s) such that your application will work with an unmodified boot-delegation/system-bundle-export configuration.

    If you really want to change the packages that are boot-delegated and the packages that are exported by the system bundle, then you can do so by editing either java5-server.profile, or java6-server.profile, as appropriate for your JDK version. Both of these files can be found in dm Server's lib directory.

    Comment


    • #3
      Thanks for your reply.

      Now I know how to do or how to resolve such problem:

      (1) Add following declarasion to MANIFEST.MF can not resolve such problem or there is not effect on it:
      Code:
      Import-Package: javax.naming.directory
      javax.naming.directory is a system package provided by JDK, and it is not exported by any bundle.

      (2) Add following declarasion to DM_SERVER_HOME/lib/java6-server.profile:
      Code:
       javax.*,\
      And it is OK.

      Comment


      • #4
        Originally posted by jiangyubao View Post
        javax.naming.directory is a system package provided by JDK, and it is not exported by any bundle.
        In the default configuration for both Equinox and dm Server the javax.naming.directory package is exported: it's exported by the System bundle.

        You can confirm this by using the telnet console. In dm Server this will show the package being exported by the System bundle, and being imported by two Tomcat-related bundles:

        Code:
        osgi> packages javax.naming.directory
        javax.naming.directory; version="0.0.0"<System Bundle [0]>
          file:////opt/springsource-dm-server-1.0.1.RELEASE/repository/bundles/ext/com.springsource.org.apache.catalina-6.0.18.jar [56] imports
          file:////opt/springsource-dm-server-1.0.1.RELEASE/repository/bundles/subsystems/com.springsource.server.servlet/com.springsource.server.servlet.tomcat-1.0.1.RELEASE.jar [68] imports
        (2) Add following declarasion to DM_SERVER_HOME/lib/java6-server.profile:
        Code:
         javax.*,\
        And it is OK.
        I'd caution against making such a large change. This change will mean that all attempts to load any javax class will be routed through boot delegation, which I suspect is not what you want.

        Boot delegated classes are handled specially by OSGi, such that it's one of the first places that will be checked during class loading. If a class is successfully loaded via boot delegating then nowhere else will be checked, i.e. the class available via boot delegation will always win, and you won't be able to depend on any other version of the class.

        The ability to depend on a specific version of a class is one of the main benefits of OSGi, and by boot delegating all of the javax packages you are losing this benefit for a huge number of classes. I would, whereever possible, stick to using Import-Package to define your dependencies and to make classes available to your application. This will work absolutely fine in the case of javax.naming.directory as it's exported by the System bundle.

        Comment

        Working...
        X