Gert Kommer
Gert Kommer

Reputation: 1243

JRE 9 module requires a module that was not found

When running my project I get the error that says:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.xml.soap not found, required by java.xml.ws

As far as I understand java.xml.ws is a JRE module and java.xml.soap is not, based on the list provided in the documentation. The way I start my program is:

java --upgrade-module-path c:/git/projectdir --add-modules java.xml.bind,java.xml.ws,java.xml.ws.annotation  -cp c:/git/projectdir/Uservice.jar com.gert.DynamicService "arg1" "arg2" "arg3"

When I try to add java.xml.soap to add-modules it cannot find the module.

My question is:

I'm using java 9.0.1

Upvotes: 3

Views: 3318

Answers (1)

ZhekaKozlov
ZhekaKozlov

Reputation: 39526

Is the java.xml.soap a JRE module?

No, this is a not a platform module. Run java --list-modules and you will not see java.xml.soap in the output.

If java.xml.soap isn't a JRE module, why does the java.xml.ws module depend on a module that isn't in the JRE?

There are two java.xml.ws modules.

The first one is a platform module and it is deprecated (you should not use it).

The second one is a standalone module which is deployed to Maven central as jaxws-api (you should use this module).

While these two modules are similar, there are a number of differences. One of them is that standalone java.xml.ws has its own dependencies. E.g. java.xml.ws depends on java.xml.soap which is deployed to Maven central too (as javax.xml.soap-api).

Where to find the java.xml.soap module?

See above. You can find it in Maven central. If you use Maven, it should be picked up automatically as a dependency of jaxws-api.

I think, java.xml.soap is missing in your upgradeable folder c:/git/projectdir. You should copy the jar from .m2\repository\javax\xml\soap\javax.xml.soap-api.

Upvotes: 3

Related Questions