webservice 500连接异常和UnsupportedOperationException

时间:2015-03-12 20:05:12

标签: java web-services soap cxf weblogic9.x

我正致力于基于SOAP的Web服务。我需要测试一个场景,如果由于任何网络问题或登录问题而发生webservice连接错误。

这里的apache cxf问题无论Web服务抛出什么异常

 "java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1".

错误响应代码返回500,但堆栈跟踪显示" UnsupportedOpertaionException"。我可以捕获异常并打印堆栈跟踪但我需要知道它是连接错误还是其他一些不同的错误。错误日志如下

    ID: 12117
Response-Code: 500
Encoding: UTF-8
Content-Type: application/soap+xml; charset=utf-8
Headers: {connection=[close], Content-Length=[6380], content-type=[application/soap+xml; charset=utf-8], Date=[Fri, 27 Feb 2015 16:43:47 GMT], Server=[Microsoft-HTTPAPI/2.0]}
Payload: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault</a:Action><a:RelatesTo>urn:uuid:9f063eed-af54-4074-86cf-35f360a6e4d0</a:RelatesTo></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Receiver</s:Value><s:Subcode><s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.)</s:Text></s:Reason><s:Detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>The wait operation timed out</Message><StackTrace i:nil="true"/><Type>System.ComponentModel.Win32Exception</Type></InnerException><Message>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.)</Message><StackTrace>   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)&#xD;
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)&#xD;
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)&#xD;
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)&#xD;
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)&#xD;
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)&#xD;
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)&#xD;
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)&#xD;
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)&#xD;
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)&#xD;
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)&#xD;
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)&#xD;
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)&#xD;
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)&#xD;
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)&#xD;
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)&#xD;
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)&#xD;
   at System.Data.SqlClient.SqlConnection.Open()&#xD;
   at BB.Core.Libraries.Data.DataContext.Connect(IsolationLevel isolationLevel, Boolean useTransaction)&#xD;
   at BB.EBT.Libraries.Services.UniversalInterface2012.GetMissingData(String&amp; houseHoldId, Decimal&amp; cardNumber)&#xD;
   at BB.EBT.Libraries.Services.UniversalInterface2012.AddUpdateBenefits(String ActionCode, String CardNumber, String WICMISAccountID, String ReasonCode, List`1 MonthlyFoodBenefits, MessageHeader MessageHeader)&#xD;
   at SyncInvokeAddUpdateBenefits(Object , Object[] , Object[] )&#xD;
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.Data.SqlClient.SqlException</Type></ExceptionDetail></s:Detail></s:Fault></s:Body></s:Envelope>
--------------------------------------]
java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1
    at weblogic.webservice.core.soap.SOAPElementImpl.getNamespaceURI(SOAPElementImpl.java:496)
    at org.apache.cxf.jaxws.JaxWsClientProxy.createSoapFault(JaxWsClientProxy.java:208)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:154)
    at $Proxy97.addUpdateBenefits(Unknown Source)
    at gov.mass.eos.web.service.wiccardclient.EWICCardServiceClient.addUpdateBenefits(EWICCardServiceClient.java:168)
    at gov.mass.eos.web.service.wiccardclient.EWICCardServiceClient.addBenefits(EWICCardServiceClient.java:132)
    at gov.mass.eos.web.controllers.ce.benefits.EBenefitPreparationUtils.processBenefitsIssue(EBenefitPreparationUtils.java:108)
    at gov.mass.eos.web.controllers.ce.benefits.EIssueController.issueBenefits(EIssueController.java:501)
    at sun.reflect.GeneratedMethodAccessor184377.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:138)
    at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:62)
    at javax.faces.component.UICommand.broadcast(UICommand.java:106)
    at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:110)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:184)
    at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:271)
    at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:102)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at com.sun.identity.agents.filter.AmAgentBaseFilter.allowRequestToContinue(AmAgentBaseFilter.java:87)
    at com.sun.identity.agents.filter.AmAgentBaseFilter.doFilter(AmAgentBaseFilter.java:43)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at gov.mass.eos.web.servlet.filter.Log4jFilter.doFilter(Log4jFilter.java:138)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3242)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
[27 Feb 2015 11:43:46,700] [ERROR] [EosRTException] [This class does not support SAAJ 1.1]
gov.mass.eos.common.exception.EosRTException.

有人可以指导我或帮助我如何在try catch块中捕获此特定连接错误或错误500.

2 个答案:

答案 0 :(得分:1)

SAAJ API符合简单对象访问协议(SOAP)1.1和1.2规范以及SOAP with Attachments规范。在您的情况下,xcf不支持您正在使用的SOAP版本。

答案 1 :(得分:1)

这个响应有点晚了,但它在weblogic 11g中对我有用,而不更改服务器&#39;配置(https://blogs.oracle.com/sravansarraju/entry/weblogic_saaj_version_problem_javalangunsupportedoperationexception_this_class_does_not_support_saaj)。

创建SOAPMessage时只需添加SOAPConstants.SOAP_1_2_PROTOCOL

Instant
相关问题