`
java_mzd
  • 浏览: 580381 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

access restriction

阅读更多

 在使用Jpcap 网络抓包时,前期使用一切正常。可是,今天调整了一下jre环境时,一直报错Access restriction: The type JpcapCaptor is not accessible due to restriction on required library C:\Windows\Sun\Java\lib\ext\jpcap.jar

 

查了会资料,找到此博客。感觉是写的最好的一个。也很详细,自己就转载过来了,不费时间写了。

http://hi.baidu.com/ccst2005/blog/item/c8f84a223172d0f4d6cae24b.html

 

主要问题应该是Access restrictions on Jars ,就是对一些jar包的访问受限,在一番搜索后发现,主要是过期的API不再被支持~看来过期的东西用时还是要小心~~顺便收集了一些资料,留着以后用吧。

http://www.eclipsezone.com/eclipse/forums/t97259.html

When developing plug-in projects, you may occasionally get a message saying "The type X is not accessible due to restriction on required project Y". The basic reason for this message is that the dependency of one project to another's exported packages doesn't match what you're expecting. If you depend on a bundle "Wall" that exports package "wall", and you import "wall.Brick" then that'll work fine. If, on the other hand, you import "wall.test.Brick" (and assume that the only mentioned export is Export-Package: wall) then you'll get this restriction error. 

You may also get it when depending on a specific version of the JRE (or an OSGi execution environment). That's because whilst the standard class packages (e.g. java.util etc.) are exported, the extras that come with the JRE (e.g. sun.misc.Base64Encoder) aren't technically part of the Java core libraries, and thus shouldn't be assumed to exist (there is a Apache Commons Codec project that contains a Base64 if you need it). 

You can view and edit the access rules for individual Jars or JREs; you can also specify them implicitly with the Manifest.MF's Import-Package or Require-Bundle rules (for consumers of APIs) or the Export-Package (for producers of APIs). If an OSGi manifest is provided, it will automatically set up access rules for all exported packages and hide all non-imported packages. (In addition, it's also possible to mark package references as 'internal' which is done by showing what down-stream plugins can consume particular APIs, although this should rarely be needed.) 

One final point; if you're setting up multiple plug-ins, then use the OSGi manifest to express dependencies. Don't add Jars via the .classpath (or the GUI equivalent Java Build Path) -- and whatever you do, don't export the 'required plugin dependencies' container to downstream projects; in 3.2, this could result in an access rule visibility error even when the OSGi manifests were correct. (It's fixed in 3.3.) 

For those of you not using Eclipse PDE, then the net effect is that you'll end up with bundles looking like this:

Manifest.MF
Bundle-SymbolicName: example
Export-Package:
 com.example.public, // Anyone can access com.example.public if imported
 com.example.test;x-internal:=true, // This is marked as internal, but can be used
 com.example.impl;x-friends:=com.example.other, // Only com.example.other should access it
 com.example.split;common="split";mandatory:="common" // Split is a split package



It's worth noting that the x-friends and x-internal are aspects unique to Equinox; they're not part of the standard OSGi specification. The 'common-split' is not part of the spec either, but the 'mandatory' lists attribute names (including 'common' in this case) which are needed for an importer to use those packages. Since the org.eclipse.core.runtime bundle explicitly requires the org.eclipse.equinox.common bundle, and then re-exports it, it presents a unified classpath for those wishing to use the org.eclipse.core.runtime package which acts in just this way.

(下面的这种方法指标不治本,属于鸵鸟算法~只是把error变成warning或者ignore了)

[Eclipse] Access restriction: Class is not accessible due to restriction on required library

"Access restriction: Class is not accessible due to restriction on required library"; error message may be shown while developing Java projects in Eclipse IDE. Error message is self-explanatory, some classes can not be loaded into the project since restriction rules are being imposed on those classes.

 

How to solve

This error message can be removed by changing a setting inside Eclipse IDE. Open up the dialog box shown below, using any of the following paths.

  • Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
  • (Project) Properties -> Java Compiler -> Errors/Warnings

Locate the "Forbidden reference (access rules)" option under "Deprecated and restricted API" section in the dialog box. This option decides how to handle access rules defined inside Eclipse. By default it is set to "Error" which causes Eclipse to complain about references to any restricted classes. Choosing any other option (Warning or Ignore) will remove these error messages.

"Warning" or "Ignore" options will only hide the potential issue in the project, by allowing the project to use any classes ignoring predefined access rules. To completely resolve this issue, analyze the project and located the use of restricted classes and take necessary actions (either remove those references or access rules).

分享到:
评论
1 楼 zxjlwt 2015-09-06  
学习了。

http://surenpi.com

相关推荐

    sun.misc.base64decoder.jar下载

    sun.misc.BASE64Encoder找不到jar包的解决方法?... Access restriction : The constructor BASE64Decoder() is not accessible due to restriction on required library C:\Program files\java\jre6\lib\rt.jar

    import com.sun.image.codec.jpeg.JPEGImageEncoder;包的下载

    Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar 此时解决办法: Eclipse默认把这些受访问限制的API设成了ERROR。只要...

    java识别验证码.docx

    Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar 此时解决办法: Eclipse默认把这些受访问限制的API设成了ERROR。只要把...

    EDM安全访问机制应用方案

    EDM安全存取有二种的控管方式:debug access indICation和EDM access restriction.种控管方式(debug access indication)提供了一个sideband signal用于指示从调试器(Debug host)的请求。第二种控管方式, 控制...

    嵌入式系统/ARM技术中的EDM安全访问机制应用方案

    EDM安全存取有二种的控管方式:debug access indication和EDM access restriction.第一种控管方式(debug access indication)提供了一个sideband signal用于指示从调试器(Debug host)的请求。第二种控管方式, ...

    解决eclipse导入rt包问题

    在Eclipse中处理图片,需要引入两个包: ...Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar 解决方法就在这里

    ione-whmcs-module:WHMCS的基于IONe的供应模块

    1. WHMCS预配置将IONe主机添加到WHMCS API白名单路径是: Setup -> General Settings -> Security -> API IP Access Restriction添加产品组小路: Setup -> Products/Services -> Create a New Group然后,添加一个...

    如何应用AndesCoreTM EDM安全访问机制

    EDM安全存取是AndesCoreTM内建的功能(option),应用在安全存取的控管。EDM安全存取有二种的控管方式:debug access indication和EDM access restriction。

    SQL Server Data Access Components 2.45.22 for d6

    Only TMSConnectDialog component requires Forms unit.Trial version restrictions--------------------------Note following restriction when using SDAC trial version.When SDAC based application is running...

    JASS 安全验证代码

    By changing the security set tings, this restriction could be relaxed and a downloaded applet could modify local files. Viewed mainly as a tool for writing clients, early Java didn’t seem to need ...

    JAAS In Action

    By changing the security settings, this restriction could be relaxed and a downloaded applet could modify local files. Viewed mainly as a tool for writing clients, early Java didn’t seem to need ...

    SDAC2.45 1.19

    Only TMSConnectDialog component requires Forms unit.Trial version restrictions--------------------------Note following restriction when using SDAC trial version.When SDAC based application is running...

    Security enforcement, from OS to image to VM for Production OpenStack Cloud

    · Service port restriction; · Network DDoS attack detection; · Account, Password and ssh key management; · Openstack service protocol protection; · Virtual Machine access and isolation along ...

    node-whmcs:WHMCS的API Node.js客户端

    apiKey : 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzz' , // if access without IP restriction serverUrl : 'http://127.0.0.1/includes/api.php' } ; var wclient = new WHMCS ( config ) ; 使用创建的客户端,调用所需的...

    nrComm

    Overview~~~~~~~~~~~The nrComm Lib contents:+TnrComm powerful component for direct access to serial port (nrcomm.pas)+TnrCommTAPI powerful component for Win32 TAPI services with Voice support ...

    TeeChart Pro Activex Control v5

    restriction to Microsoft's Visual Studio .NET. .Net fails to import indexed properties that reside at the root level of an ActiveX Control. The property has been replaced by a method of the same...

    NEC Aspila EX集团电话说明

    直接呼入系统(Direct Inward System Access (DISA))…………………………… 直选台(Direct Station Selection (DSS) Console)………………………………… 直接呼叫代答(Directed Call Pickup)……………………...

    BlueToolInstall

    2.2. Restriction on Modification. If and to the extent that the Software is designed to be compliant with any published communications standard (including, without limitation, DOCSIS, HomePNA, IEEE, ...

Global site tag (gtag.js) - Google Analytics