axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: AccessControlException from HttpClient - Causes ServiceClient instance to fail
Date Sun, 06 Sep 2009 21:46:58 GMT

that would be my suggestion

// Here are permissions to connect to noaa.gov on Port 80

grant codeBase "file:${catalina.home}/webapps/examples/-" {
      permission java.net.SocketPermission "*.noaa.gov:80", "connect,resolve";
};

you'll need those same permissions (connect,resolve) to connect to your own webservice host
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.




Date: Sun, 6 Sep 2009 14:18:50 -0700
From: yrajaram@cisco.com
To: axis-dev@ws.apache.org; axis-user@ws.apache.org
Subject: AccessControlException from HttpClient - Causes ServiceClient instance to fail









Hi All: 


Have you used Axis2 web services on WebSphere 
with security turned on so you have to use was.policy file to grant the required 
permissions? If so you might be able to help. 


We have a Web Service (WS1) calling another 
WebService (WS2) using ServiceClient. However we get the following 
exception when WS1 calls WS2. 



  [8/27/09 19:18:55:774 EDT] 42e54fb1 SystemErr R 
  Aug 27, 2009 7:18:55 PM org.apache.axis2.deployment.ServiceDeployer 
  deploy
  INFO: Deploying Web service: 
  PartnerService
  [8/27/09 19:18:55:797 EDT] 42e54fb1 SystemErr R 
  Aug 27, 2009 7:18:55 PM org.apache.axis2.deployment.ServiceDeployer 
  deploy
  INFO: Deploying Web service: 
  version-1.3.aar
  [8/27/09 19:23:27:132 EDT] 66cbcfb1 SystemErr R 
  java.security.AccessControlException: access denied 
  (java.net.SocketPermission xxx.xx.xx.xxx:80 connect,resolve)
  [8/27/09 19:23:27:132 EDT] 66cbcfb1 SystemErr R 
  at 
  java.security.AccessControlContext.checkPermission(AccessControlContext.java(Compiled 
  Code))
  [8/27/09 19:23:27:132 EDT] 66cbcfb1 SystemErr R 
  at 
  java.security.AccessController.checkPermission(AccessController.java(Compiled 
  Code))
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at java.lang.SecurityManager.checkPermission(SecurityManager.java(Compiled 
  Code))
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at 
  com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java(Compiled 
  Code))
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at 
  java.lang.SecurityManager.checkConnect(SecurityManager.java:1040)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at java.net.Socket.connect(Socket.java:473)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at java.net.Socket.connect(Socket.java:429)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at java.net.Socket.<init>(Socket.java:336)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at java.net.Socket.<init>(Socket.java:212)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at 
  org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at 
  org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(ControllerThreadSocketFactory.java:90)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at 
  org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$SocketTask.run(ControllerThreadSocketFactory.java:157)
  [8/27/09 19:23:27:133 EDT] 66cbcfb1 SystemErr R 
  at java.lang.Thread.run(Thread.java:571)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  java.lang.NullPointerException
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:720)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
  [8/27/09 19:23:27:134 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
  [8/27/09 19:23:27:135 EDT] 65520fb0 SystemErr R 
  at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
  [8/27/09 19:23:27:135 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  com.cisco.ws.partnerService.PartnerService.pullAction(PartnerService.java:78)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at java.lang.reflect.Method.invoke(Method.java:391)
  [8/27/09 19:23:27:136 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:165)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:62)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at 
  org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
  [8/27/09 19:23:27:137 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1036)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:544)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:210)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:139)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:332)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:254)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:657)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:453)
  [8/27/09 19:23:27:140 EDT] 65520fb0 SystemErr R 
  at 
  com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:937)
I found a similar 
issue posted on the Web where the user was calling HttpClient from a JavaScript 
in an Applet. After tweaking the policy file he was able to get it working. I 
think the current issue could be due to one of the 
following:
1. Missing 
was.policy file entries that would allow the WebService under WEB-INF/services 
folder to use HttpClient. Or
2. We have not set 
some properties in WS1 on ServiceClient instance before invoking 
WS2.
 
Would greatly 
appreciate any help.
thanks,
Yash
_________________________________________________________________
Windows Live: Make it easier for your friends to see what you’re up to on Facebook.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_facebook:082009
Mime
View raw message