JDK 10 cannot import javax.xml.namespace in Eclipse

前端 未结 4 1803
孤街浪徒
孤街浪徒 2020-12-19 11:39

It\'s very strange. I am moving a dynamic web project from Java 8 to Java 10.

The last thing I cannot get the dependency resolved is the javax.xml.namespace.QName cl

4条回答
  •  旧巷少年郎
    2020-12-19 12:24

    There probably is a duplicate dependency pulled in from some other dependency.

    In eclipse do

    1. "Navivate -> Open Type..."
    2. Type in "java.xml.namespace".
    3. If there are other results than from your (Open-)JDK, these need to be removed in the following steps. In my case it was xml-apis
    4. Open your pom.xml in eclipse, and visit the "Dependency Hierarchy" tab to check which dependency was pulling in xml-apis
    5. Type "xml-apis" in the Filter. In my case the top level dependency that was pulling xml-apis was "esapi"
    6. exclude xml-apis from the esapi dependency:

      
          org.owasp.esapi
          esapi
          2.2.0.0
      
          
              
                  xml-apis
                  xml-apis
              
          
      
      
      
    7. Right click your Project and choose "Maven -> Update Project...". Check your project and click OK.

    That's it

提交回复
热议问题