2

I am getting the below exception when generating pojos from WSDL.

External DTD: Failed to read external DTD 'XMLSchema.dtd', because 'http' access is not allowed due to restriction set by the accessExternalDTD property.

I found solution in [WebService Client Generation Error with JDK8

[1]: WebService Client Generation Error with JDK8 where someone has mentioned to add below jvm argument.

-Djavax.xml.accessExternalSchema=all

How do I add this argument in jvm 1.8(fyi I am using macos) or run wsimport with above jvm argument?

1 Answers1

0

I struggled with the same issue as you.

There are two ways to do that (at least those I have found).

The simply one is to invoke the WsImport as a java class via the java command with this concrete attribute:

java -Djavax.xml.accessExternalSchema=all \
     -Djavax.xml.accessExternalDTD=all \
     -cp /path/to/jdk/lib/tools.jar  com.sun.tools.internal.ws.WsImport \
     -d destination -s source  wsdl_file_location

Explanation: I invoke the concrete class (com.sun.tools.internal.ws.WsImport) that is also called from the wsimport command. I have chosen this way, as the problem is that wsimport does not provide any option to specify additional jvm arguments, this workaround was fastest for me.

Second option is to modify the JVM parameters. For that you can refer to: jvm configuration

Rafał Czabaj
  • 720
  • 7
  • 16