我在實例化xml Web服務客戶端時捕獲JAXBException。我有一個使用多個wsdl的前端應用程序。我使用wsdl2java使用maven生成源代碼。沒有任何方法名稱重複。 Maven根據需要生成源代碼。例如,我需要將GetNameResponse類放在包「com.abc.ws.services.name.GetNameResponse」中,並且它實際上是真的。 Maven根據需要創建源文件。但是,當我運行代碼時,它說「com.abc.ws.services.name.GetNameResponse」類沒有名爲「name」的屬性。其實那個階級的財產存在。JAXBException - 不是類上的有效屬性
可能的答案是什麼?我一直在尋找兩天的答案。
謝謝。
package com.abc.ws.services.name;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getNameResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="getNameResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://name.services.ws.abc.com/}nameddo" minOccurs="0" form="qualified"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getNameResponse", propOrder = {
"name"
})
public class GetNameResponse {
protected Nameddo name;
/**
* Gets the value of the nameproperty.
*
* @return
* possible object is
* {@link Nameddo }
*
*/
public Nameddo getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link Nameddo }
*
*/
public void setName(Nameddo value) {
this.name = value;
}
}
這裏是堆棧跟蹤
EncodingFilter.java:22)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoin
t.java:1813)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ExceptionInInitializerError
at tr.com.fourplay.web.beans.login.Login.login(Login.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpress
ion.java:98)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:88)
... 27 more
Caused by: javax.xml.ws.WebServiceException: class tr.com.fourplay.ws.services.c
ollaborator.GetCollaboratorResponse do not have a property of the name collabora
tor
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(Resp
onseBuilder.java:500)
at com.sun.xml.internal.ws.client.sei.SEIMethodHandler.buildResponseBuil
der(SEIMethodHandler.java:160)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.<init>(SyncMetho
dHandler.java:74)
at com.sun.xml.internal.ws.client.sei.SEIStub.<init>(SEIStub.java:71)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBase
Proxy(WSServiceDelegate.java:628)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:331)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:313)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:351)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:355)
at javax.xml.ws.Service.getPort(Service.java:161)
at tr.com.fourplay.web.services.collaborator.CollaboratorServiceImpl.<cl
init>(CollaboratorServiceImpl.java:45)
... 36 more
Caused by: javax.xml.bind.JAXBException: collaborator is not a valid property on
class tr.com.fourplay.ws.services.collaborator.GetCollaboratorResponse
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementProper
tyAccessor(JAXBContextImpl.java:931)
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(Resp
onseBuilder.java:489)
... 46 more
16.Eki.2012 17:57:17 com.sun.faces.lifecycle.InvokeApplicationPhase execute
WARNING: #{login.login}: java.lang.ExceptionInInitializerError
javax.faces.FacesException: #{login.login}: java.lang.ExceptionInInitializerErro
r
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
enerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
267)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
ionPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at tr.com.fourplay.web.filter.CharacterEncodingFilter.doFilter(Character
EncodingFilter.java:22)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoin
t.java:1813)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.faces.el.EvaluationException: java.lang.ExceptionInInitializerE
rror
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
enerImpl.java:102)
... 26 more
Caused by: java.lang.ExceptionInInitializerError
at tr.com.fourplay.web.beans.login.Login.login(Login.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpress
ion.java:98)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:88)
... 27 more
Caused by: javax.xml.ws.WebServiceException: class tr.com.fourplay.ws.services.c
ollaborator.GetCollaboratorResponse do not have a property of the name collabora
tor
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(Resp
onseBuilder.java:500)
at com.sun.xml.internal.ws.client.sei.SEIMethodHandler.buildResponseBuil
der(SEIMethodHandler.java:160)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.<init>(SyncMetho
dHandler.java:74)
at com.sun.xml.internal.ws.client.sei.SEIStub.<init>(SEIStub.java:71)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBase
Proxy(WSServiceDelegate.java:628)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:331)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:313)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:351)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:355)
at javax.xml.ws.Service.getPort(Service.java:161)
at tr.com.fourplay.web.services.collaborator.CollaboratorServiceImpl.<cl
init>(CollaboratorServiceImpl.java:45)
... 36 more
Caused by: javax.xml.bind.JAXBException: collaborator is not a valid property on
class tr.com.fourplay.ws.services.collaborator.GetCollaboratorResponse
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementProper
tyAccessor(JAXBContextImpl.java:931)
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(Resp
onseBuilder.java:489)
... 46 more
ERROR ExceptionListener2012-10-16 17:57:17,418 Serious error happened!
javax.faces.FacesException: #{login.login}: java.lang.ExceptionInInitializerErro
r
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
ionPhase.java:90)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at tr.com.fourplay.web.filter.CharacterEncodingFilter.doFilter(Character
EncodingFilter.java:22)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoin
t.java:1813)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.faces.FacesException: #{login.login}: java.lang.ExceptionInInit
ializerError
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
enerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
267)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
ionPhase.java:82)
... 22 more
Caused by: javax.faces.el.EvaluationException: java.lang.ExceptionInInitializerE
rror
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
enerImpl.java:102)
... 26 more
Caused by: java.lang.ExceptionInInitializerError
at tr.com.fourplay.web.beans.login.Login.login(Login.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpress
ion.java:98)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:88)
... 27 more
Caused by: javax.xml.ws.WebServiceException: class tr.com.fourplay.ws.services.c
ollaborator.GetCollaboratorResponse do not have a property of the name collabora
tor
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(Resp
onseBuilder.java:500)
at com.sun.xml.internal.ws.client.sei.SEIMethodHandler.buildResponseBuil
der(SEIMethodHandler.java:160)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.<init>(SyncMetho
dHandler.java:74)
at com.sun.xml.internal.ws.client.sei.SEIStub.<init>(SEIStub.java:71)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBase
Proxy(WSServiceDelegate.java:628)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:331)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:313)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:351)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDel
egate.java:355)
at javax.xml.ws.Service.getPort(Service.java:161)
at tr.com.fourplay.web.services.collaborator.CollaboratorServiceImpl.<cl
init>(CollaboratorServiceImpl.java:45)
... 36 more
Caused by: javax.xml.bind.JAXBException: collaborator is not a valid property on
class tr.com.fourplay.ws.services.collaborator.GetCollaboratorResponse
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementProper
tyAccessor(JAXBContextImpl.java:931)
at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.<init>(Resp
onseBuilder.java:489)
... 46 more
你能分享GetNameResponse的代碼嗎? – Anshu
我編輯了我的帖子@Anshu –
也可以分享堆棧跟蹤嗎? – Anshu