我在eclipse动态项目中运行一个Score and Score预留服务类,我创建了一个Web服务并运行它,但它给出错误代码The package javax.xml.namespace is accessible from more than one module: <unnamed>, java.xml
。不知道如何处理此输出
记分班
package startAgain;
import javax.xml.bind.annotation.*;
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
public class Score {
public int wins, losses, ties;
}
ScoreServies类
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; }
}
有关清除此程序包的任何帮助javax.xml.name空间错误,谢谢
1条答案
按热度按时间t5fffqht1#
几天前,我在使用Eclipse时遇到了同样的问题。
因此,我试图找到提出
javax.xml
Java内置模块中已有的相同包(javax.xml.namespace
)的库,这会引起包复制。在我的例子中,它是一个名为
stax-api
的库。我刚刚将其从构建中删除,如下所示: