0 votes
1 view
in Java by (3.4k points)

I'm trying to compile Java 1.4 code that was created by IBM's WSDL2Java on Java5 without recreating the stubs and saw this error in Eclipse. I'm under the assumption that the stubs created should just compile as long as the runtime jars are available (they are).

Access restriction: The type QName is not accessible due to restriction on required library C:\Program Files\Java\jdk1.5.0_16\jre\lib\rt.jar

The full class name is javax.xml.namespace.QName

What exactly is going on here?

Is this a case where I am trying to refactor a pig from sausage? Am I better off recreating the stubs?

1 Answer

0 votes
by (46.1k points)

I guess that you are trying to replace a standard class which ships with Java 5 with one in a library you have.

This is not permitted under the terms of the license agreement, however AFAIK it wasn't implemented until Java 5

Here's a solution that also works.

  • First, Go to the Build Path settings in the project properties.
  • Delete the JRE System Library
  • Attach it back; Select "Add Library" and choose the JRE System Library. The default ran for me.

 image

image

This runs because you have multiple classes in different jar files. Deleting and re-attaching the JRE lib will make the right classes be first. If you want a basic solution make sure you omit the jar files with the same classes.

I hold javax.xml.soap.SOAPPart in three different jars: axis-saaj-1.4.jar, saaj-api-1.3.jar, and the rt.jar

Related questions

0 votes
1 answer
asked Nov 13, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
0 votes
1 answer
asked Oct 9, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...