如何从OSGI捆绑包访问内部sun.security类? [英] How to access the internal sun.security class from an OSGI bundle?

查看:91
本文介绍了如何从OSGI捆绑包访问内部sun.security类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要向Maven构建或Java运行时添加哪些选项来访问内部sun.security类? OSGI捆绑包中有Akamai的Java代码,需要访问内部sun.security类. Apache Felix控制台给出了OSGI捆绑软件的错误:

What options do I need to add to the maven build or the java runtime to access the internal sun.security classes? There is Java code from Akamai in an OSGI bundle needs access to internal sun.security classes. The Apache Felix console gives errors for the OSGI bundle:

sun.awt.image.codec -- Cannot be resolved
sun.io -- Cannot be resolved
sun.misc -- Cannot be resolved
sun.rmi.rmic -- Cannot be resolved
sun.security.action -- Cannot be resolved
sun.security.ec -- Cannot be resolved
sun.security.internal.interfaces -- Cannot be resolved
...

我查看了有关使用内部sun类的文章,但仅指的是javac.我的Maven构建开始如下:

I looked at this article about using internal sun classes but it only refers to javac. My maven build starts like:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>cdncache</artifactId>
  <packaging>bundle</packaging>
  <name>NCDN Cache</name>
  <description>Classes and interfaces to expire resource from the Akamai CDN cache [build:${build.number}]\
</description>
  <version>1.0-${build.number}</version>
  <properties>
    <!-- Skip tests, so maven execution is faster. -->
    <maven.test.skip>true</maven.test.skip>
    <file.encoding>utf-8</file.encoding>
  </properties>
  <build>
    <plugins>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>2.0.1</version>
    <extensions>true</extensions>
    <configuration>
      <instructions>
        <Export-Package>
          com.nymag.akamai,
          com.akamai.*,
          ...
        </Export-Package>
        <Private-Package>
          org.apache.axis.*,
          ...
          sun.security,
          sun.security.ec,
        </Private-Package>
        <Bundle-Version>1.0</Bundle-Version>
        <Bundle-Activator>com.nymag.akamai.Activator</Bundle-Activator>
      </instructions>
    </configuration>
  </plugin>
  ...

推荐答案

所有这些都是非公共API类,因此不能依靠它们出现在所有jre发行版中.我相信它们都是当前的Sun发行版,但不在IBM发行版中.尝试在Sun发行版上运行,但这看起来像是在针对未记录的功能进行构建的情况,

All of these are non public API classes and cannot be relied upon to be present in all jre distributions. I believe that they are all present sun distributions, but not in IBM distributions etc. Try running against a Sun distribution, but this looks like a case of building against undocumented features, a big no no.

这篇关于如何从OSGI捆绑包访问内部sun.security类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆