• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

The package javax.xml.namespace is accessible from more than one module <unnamed>,java.xml

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to upgrade from java 8 to java 11.I am using maven build.

I am using classpath instead of module path, I don't have module-info.java files in my project but still I am getting the errorĀ 

"The package javax.xml.namespace is accessible from more than one module <unnamed>,java.xml"

I am getting this error when maven build system is trying to generate java classes using XML, XSD and xml parsing.

Once the classes are generated maven is trying to build.

In the generated classes I am getting this error.

Please help to let me know how to resolve the issue
 
Sheriff
Posts: 22863
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of your dependencies is not doing things the right way. Instead of depending on the code provided by the JDK/JRE, they added their own version of the javax.xml.namespace package. What you need to do is figure out which one (your IDE usually lets you browse inside the dependencies), and see if you can upgrade or replace that dependency.
 
Saloon Keeper
Posts: 28833
212
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:One of your dependencies is not doing things the right way. Instead of depending on the code provided by the JDK/JRE, they added their own version of the javax.xml.namespace package. What you need to do is figure out which one (your IDE usually lets you browse inside the dependencies), and see if you can upgrade or replace that dependency.


Yes, this was a problem that someone else had - and solved - not long ago, so search the Ranch for that thread.

Basically, the jaxb package that was part of JDK 8 was removed and now has to be supplied externally (as a Maven dependency) to build properly with later JDKs.

The sticky part is that the newer jaxb packages are now in their own module and older code not written to use modules has a problem with that. The solutions are to either pull an older non-module version of JAXB from Maven or change your code to understand the new  module usage.
 
Rob Spoor
Sheriff
Posts: 22863
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javax.xml.namespace isn't part of JAXB, it's part of the JSE java.xml module. Still, that doesn't prevent libraries from including the API. For instance, xmlsec 1.5.8 included javax.xml.crypto which is part of the java.xml.crypto module. I remember this one well because it's given me quite a lot of class loading errors in the past.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic