我正在使用JBoss服务器5.0.1并使用jax-rpc编写了一个Web服务客户端。我运行它时遇到以下异常。由于JBoss Web服务不接受用户定义的Java bean要传入/传出jax-rpc,因此我将所有Java bean对象转换为字符串,字符串数组和原始数据类型。所以我从我的客户端调用Web服务,但是当我尝试调用我的Web服务时,它会抛出以下异常。请帮帮我。
17:27:09,537 ERROR [ServiceProxy] Service error
javax.xml.rpc.ServiceException: Cannot create proxy
at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ws.core.jaxrpc.client.ServiceProxy.invoke(ServiceProxy.java:127)
at $Proxy105.getCarrierWSSEIPort(Unknown Source)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalStateException: Cannot synchronize to any of these methods:
public abstract java.lang.String[] client.CarrierWSSEI.getGroupID() throws java.rmi.RemoteException
public abstract boolean client.CarrierWSSEI.checkRateData(java.lang.String) throws java.rmi.RemoteException
public abstract boolean client.CarrierWSSEI.commitZipImportData(java.lang.String) throws java.rmi.RemoteException
OperationMetaData:
qname={urn:CarrierWS/wsdl}checkPlanData2
javaName=checkPlanData
style=document/literal/WRAPPED
oneWay=false
soapAction=
ParameterMetaData:
xmlName={urn:CarrierWS/types}checkPlanData2
partName=checkPlanData2
xmlType={urn:CarrierWS/types}checkPlanData2
javaType=test.CarrierWSSEI_checkPlanData2_RequestStruct
mode=IN
inHeader=false
index=0
wrappedParameters=[[name = String_1, type = java.lang.String, typeArgs = null, variable = String_1, index = 0], [name = String_2, type = java.lang.String, typeArgs = null, variable = String_2, index = 1]]
ReturnMetaData:
xmlName={urn:CarrierWS/types}checkPlanData2Response
partName=checkPlanData2Response
xmlType={urn:CarrierWS/types}checkPlanData2Response
javaType=test.CarrierWSSEI_checkPlanData_ResponseStruct1
mode=OUT
inHeader=false
index=-1
wrappedParameters=[[name = result, type = boolean, typeArgs = null, variable = result, index = -1]]
at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:491)
at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:557)
at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:541)
at org.jboss.ws.metadata.umdm.EndpointMetaData.setServiceEndpointInterfaceName(EndpointMetaData.java:220)
at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:345)
... 33 more
17:27:09,646 ERROR [STDERR] javax.xml.rpc.ServiceException: Cannot create proxy
17:27:09,646 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:359)
17:27:09,646 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:27:09,646 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
17:27:09,646 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
17:27:09,646 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
17:27:09,646 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceProxy.invoke(ServiceProxy.java:127)
17:27:09,646 ERROR [STDERR] at $Proxy105.getCarrierWSSEIPort(Unknown Source)
17:27:09,646 ERROR [STDERR] at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
17:27:09,662 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
17:27:09,662 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
17:27:09,662 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:27:09,677 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
17:27:09,677 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
17:27:09,677 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
17:27:09,677 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
17:27:09,677 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
17:27:09,677 ERROR [STDERR] Caused by: java.lang.IllegalStateException: Cannot synchronize to any of these methods:
public abstract java.lang.String[] client.CarrierWSSEI.getGroupID() throws java.rmi.RemoteException
public abstract boolean client.CarrierWSSEI.checkRateData(java.lang.String) throws java.rmi.RemoteException
public abstract boolean client.CarrierWSSEI.commitZipImportData(java.lang.String) throws java.rmi.RemoteException
OperationMetaData:
qname={urn:CarrierWS/wsdl}checkPlanData2
javaName=checkPlanData
style=document/literal/WRAPPED
oneWay=false
soapAction=
ParameterMetaData:
xmlName={urn:CarrierWS/types}checkPlanData2
partName=checkPlanData2
xmlType={urn:CarrierWS/types}checkPlanData2
javaType=test.CarrierWSSEI_checkPlanData2_RequestStruct
mode=IN
inHeader=false
index=0
wrappedParameters=[[name = String_1, type = java.lang.String, typeArgs = null, variable = String_1, index = 0], [name = String_2, type = java.lang.String, typeArgs = null, variable = String_2, index = 1]]
ReturnMetaData:
xmlName={urn:CarrierWS/types}checkPlanData2Response
partName=checkPlanData2Response
xmlType={urn:CarrierWS/types}checkPlanData2Response
javaType=test.CarrierWSSEI_checkPlanData_ResponseStruct1
mode=OUT
inHeader=false
index=-1
wrappedParameters=[[name = result, type = boolean, typeArgs = null, variable = result, index = -1]]
17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:491)
17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:557)
17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:541)
17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.setServiceEndpointInterfaceName(EndpointMetaData.java:220)
17:27:09,756 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:345)
17:27:09,756 ERROR [STDERR] ... 33 more
JSP客户端代码如下:
<%@page import="java.util.Hashtable"%>
<%@page import="javax.naming.*,javax.xml.rpc.Stub,stubs.CarrierWS,stubs.CarrierWSSEI,stubs.CarrierWSSEI_Impl"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<% try {
InitialContext ic = new InitialContext( );
CarrierWS carrierws = (CarrierWS)ic.lookup("java:comp/env/service/CarrierWS");
out.println("========================" + carrierws);
CarrierWSSEI sei = carrierws.getCarrierWSSEIPort();
out.println("Invoking the service please wait ............." + carrierws.getCarrierWSSEIPort());
((Stub)sei)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,"http://localhost:8080/TestWS3WAR/CarrierWS");
out.println("Invoking the service please wait ............." + sei.getActiveBenData().length);
}
catch(Exception e)
{
out.println("Exception occurred : " + e.getMessage());
e.printStackTrace();
}
%>
</body></html>
提前致谢, 塞特希
答案 0 :(得分:2)
问题在于,虽然我将所有返回类型转换为String类型但是Jboss 5.0.1 GA在Web服务接口和实现中没有方法多态。