我有一个代码,它是围绕 Web 服务的 java 包装器,在异常时它会引发 AxisFault 异常(如下所示)
org.apache.axis2.AxisFault: Policy enforcement failed to authenticate the request.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:446)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.tibco.n2.de.services.EntityResolverServiceStub.lookupUser(EntityResolverServiceStub.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
代码如下所示,
try {
lookupUserResponse = myIntializedObject.lookupUser("someuser", null, null, true);
} catch (InvalidServiceRequestFault e) {
// TODO Auto-generated catch block
//e.printStackTrace();
} catch (InternalServiceFault e) {
// TODO Auto-generated catch block
//e.printStackTrace();
} catch (SecurityFault e) {
// TODO Auto-generated catch block
//e.printStackTrace();
}
finally{
if(lookupUserResponse==null)
return false;
}
我也尝试用 Exception e 的单个块替换所有 catch 块,但它仍然没有捕获异常