Java 生成wsdl时出现JAXWS异常

Java 生成wsdl时出现JAXWS异常,java,web-services,wsdl,jax-ws,myeclipse,Java,Web Services,Wsdl,Jax Ws,Myeclipse,我不熟悉使用jax-ws 我在生成web服务WSDL文件时出错 从新闻服务按钮 我正在使用JavaEE6和JDK1.6 我最近为java类创建了wsdl,它不返回任何内容 信息: An internal error occurred during: "Generating JAX-WS Web Services". Unable to create JAXBContext 完整java类: @WebService public class LoginWs { // Take two stri

我不熟悉使用jax-ws

我在生成web服务WSDL文件时出错 从新闻服务按钮

我正在使用JavaEE6和JDK1.6

我最近为java类创建了wsdl,它不返回任何内容

信息:

An internal error occurred during: "Generating JAX-WS Web Services".
Unable to create JAXBContext
完整java类:

@WebService
public class LoginWs {

// Take two strings from android TextFields .

public LoginWs() {

}

@WebMethod(operationName = "login", action = "urn:Login")
public String login(String username, String password)
        throws ClassNotFoundException, SQLException, Exception,
        IllegalAccessException {

    // Make new Connection to database .
    int TID = -1;
    try {

        Dbconnection NewConnect = new Dbconnection();
        Connection con = NewConnect.MakeConnect();
        Statement stmt = con.createStatement();

        ResultSet rs = stmt
                .executeQuery("SELECT Teacher_id FROM teacher where User_Name = "
                        + "'"
                        + username
                        + "'"
                        + "and Pass = "
                        + "'"
                        + password + "'");

        while (rs.next()) {

            TID = rs.getInt(1);

        }
        rs.close();
        stmt.close();
        con.close();

    } catch (SQLException e) {
        return "-1";
    }

    return String.valueOf(TID);

} // End of login MethodWS .
}

日志文件:

!ENTRY org.eclipse.core.jobs 4 2 2013-12-31 13:30:34.762
!MESSAGE An internal error occurred during: "Generating JAX-WS Web     Services".
 !STACK 0
 javax.xml.ws.WebServiceException: Unable to create JAXBContext
at      com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:158)
at    com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
at     com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:262)
at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:225)
at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:124)
at com.genuitec.eclipse.ws.jaxws.JaxWSBUJob.wsGen(JaxWSBUJob.java:229)
at com.genuitec.eclipse.ws.jaxws.JaxWSBUJob.run(JaxWSBUJob.java:125)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
 Caused by: java.security.PrivilegedActionException:     com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of     IllegalAnnotationExceptions
 java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
    at java.lang.StackTraceElement
    at public java.lang.StackTraceElement[]      java.lang.Throwable.getStackTrace()
    at java.lang.Throwable
    at private java.lang.Throwable     com.sams.ws.jaxws.ClassNotFoundExceptionBean.exception
    at com.sams.ws.jaxws.ClassNotFoundExceptionBean

at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:148)
... 7 more
   Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1    counts of IllegalAnnotationExceptions
 java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
    at java.lang.StackTraceElement
    at public java.lang.StackTraceElement[]     java.lang.Throwable.getStackTrace()
    at java.lang.Throwable
    at private java.lang.Throwable com.sams.ws.jaxws.ClassNotFoundExceptionBean.exception
    at com.sams.ws.jaxws.ClassNotFoundExceptionBean

at    com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnn    otationsException.java:102)
at     com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>    (JAXBContextImpl.java:286)
at    com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
at    com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
at    com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:153)
at    com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:149)
... 9 more
!条目org.eclipse.core.jobs 422013-12-3113:30:34.762
!消息:“生成JAX-WS Web服务”期间发生内部错误。
!堆栈0
javax.xml.ws.WebServiceException:无法创建JAXBContext
位于com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:158)
位于com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
位于com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:262)
位于com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:225)
位于com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:124)
位于com.genuitec.eclipse.ws.jaxws.JaxWSBUJob.wsGen(JaxWSBUJob.java:229)
位于com.genuitec.eclipse.ws.jaxws.JaxWSBUJob.run(JaxWSBUJob.java:125)
位于org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
原因:java.security.PrivilegedActionException:com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:1个illegalannotationException计数
java.lang.StackTraceeElement没有无参数默认构造函数。
此问题与以下位置有关:
在java.lang.StackTraceeElement
在public java.lang.StackTraceeElement[]java.lang.Throwable.getStackTrace()中
在java.lang.Throwable
在私有java.lang.Throwable com.sams.ws.jaxws.ClassNotFoundExceptionBean.exception
在com.sams.ws.jaxws.ClassNotFoundExceptionBean上
位于java.security.AccessController.doPrivileged(本机方法)
位于com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:148)
... 还有7个
原因:com.sun.xml.bind.v2.runtime.illegalannotations异常:1次illegalannotationException计数
java.lang.StackTraceeElement没有无参数默认构造函数。
此问题与以下位置有关:
在java.lang.StackTraceeElement
在public java.lang.StackTraceeElement[]java.lang.Throwable.getStackTrace()中
在java.lang.Throwable
在私有java.lang.Throwable com.sams.ws.jaxws.ClassNotFoundExceptionBean.exception
在com.sams.ws.jaxws.ClassNotFoundExceptionBean上
位于com.sun.xml.bind.v2.runtime.illegalannationsexception$Builder.check(IllegalAnn-otationsException.java:102)
位于com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
位于com.sun.xml.bind.v2.runtime.JAXBContextImpl。(JAXBContextImpl.java:286)
位于com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
位于com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
位于com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:153)
位于com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:149)
... 9更多

由于错误中提到的原因,无法序列化异常或Throwables(Throwables所需的StackTracElement没有无参数构造函数)


您可能需要捕获login()中的其他异常,并使用您自己的异常,该异常可以被注释为web错误。有关更多信息,请参阅:

由于错误中提到的原因,无法序列化异常或Throwables(Throwables所需的StackTracElement没有无参数构造函数)


您可能需要捕获login()中的其他异常,并使用您自己的异常,该异常可以被注释为web错误。有关更多信息,请参阅:

您的注释似乎有问题。您在实现中使用的是服务端点接口还是java Bean。它的可能副本似乎与您的注释有关。您在实现中是否使用服务端点接口或java Bean。的可能重复项