简体   繁体   中英

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

Im running a score and scoreservices class in eclipse dynamic project i created a webservice and ran it but it gives me errors saying The package javax.xml.namespace is accessible from more than one module: <unnamed>, java.xml . Dont know what to do with this output

score class

package startAgain;

import javax.xml.bind.annotation.*;
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
public class Score {
public int wins, losses, ties;
}   

ScoreServies class

package startAgain;

import javax.ejb.*;
import javax.jws.*;
@Stateless
@WebService
public class ScoreService {
private static Score score = new Score();
public Score updateScore (int wins, int losses, int ties) {
    score.wins = wins;
    score.losses = losses;
    score.ties = ties;
    return score;
}
@WebMethod(operationName="resetScore")
public void reset() {
score.wins = score.losses = score.ties = 0;
}
        public Score getScore() { return score; }
        public int increaseWins() { return score.wins++; }
        public int increaseTies() { return ++score.ties; }
        public int increaseLosses() { return ++score.losses; }
        public int getWins() { return score.wins; }
        public int getTies() { return score.ties; }
        public int getLosses() { return score.losses; }

}

Any help on this on clearing this package javax.xml.namespace error Thanks

I faced the same issue with Eclipse few days ago.

So I tried to find the library that proposed the same package ( javax.xml.namespace ) already available in the javax.xml Java built-in module, provoking package duplication.

In my case it was a lybrary under the name stax-api . I just removed it from the build, like this:

dependencies {
...
  configurations {
       compile.exclude group: 'stax', module: 'stax-api'
  }
...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM