Moving Axis 1.4 stub project to a Maven based project (Type Access restriction)

For compatibility reasons I have to build Axis 1.4 skeleton classes from exiting an wsdl-file. I use the shipped wsdl2java ant-task from Axis 14.

I'm using MyEclipse 8.5 on Java SDK 1.6.0_18, I added the required libraries to my build path and everything goes fine.

Now I moved my normal project to a Apache Maven2 project, as I added the dependencies I get following warnings (~500):

Description Resource Path Location Type Access restriction: The constructor QName(String, String) is not accessible due to restriction on required library /usr/local/uvst/standard/jdk1.6.0_18/jre/lib/rt.jar

I already have read a similar question here but I don't agree with the answers at Access restriction on class due to restriction on required library rt.jar?.

Because in a normal Java project no

Access restriction on class due to restriction

warning appears.

The classpath setup in my normal Java project contains all libraries with are shipped with the latest distribution of Axis 1.4 (I know it's rather old).

The dependency section of my pom.xml:

<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>

The class QName is located in axis-jaxrpc.jar!

Is there a possibility to make things going right, without killing class-files from libraries or disable warning settings within the IDE?


Does this happen under Eclipse only? If yes, you can modify the compiler settings as explained in the m2eclipse FAQ:

Compilation errors on restricted classes

Projects using classes from rt.jar, such as com.sun.* (and some others) can have compilation errors like: "Access restriction: The type RE is not accessible due to restriction on required library /lib/rt.jar". Such errors indicate use of non-API classes and those access rules are defined by Eclipse JDT.

You can change compiler settings to not fail on those restrictions in workspace settings in Window / Preferences / Java / Compiler / Errors/Warnings / Deprecated and restricted API / Forbidden reference (access rules) / Warnings; or per-project from Project / Properties / Java Compiler / Errors/Warnings / Deprecated and restricted API / Forbidden reference (access rules) / Warnings


随MyEclipse 8.5一起提供的Maven2插件,使用JDK 1.4配置默认的内置路径,我将它们修改为我实际的JDK 1.6安装,现在它可以正常工作。

链接地址: http://www.djcxy.com/p/12816.html

上一篇: 在Java中,“受限制的库”究竟意味着什么?

下一篇: 将Axis 1.4 stub项目移动到基于Maven的项目(类型访问限制)