ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raja Subramanian <rs...@pcomm.hfi.unimelb.edu.au>
Subject workaround for xmlrpc-client exception in applet context
Date Wed, 01 Sep 2004 15:37:21 GMT
Hi,

I have started using xmlrpc-1.2-b1 as a client and am extremely pleased
with it.  My thanks to all the developers for their efforts.

When I run my application as a standalone app, all goes well.  But when
I run the same as an (unsigned) applet, the following exception is
raised.  Yes, yes, I'm aware of applet restrictions and such.

===== my code
import org.apache.xmlrpc.secure.SecureXmlRpcClient;
...
    try {
        fetchMethod = new SecureXmlRpcClient(fetch);
        fetchMethod.setBasicAuthentication(user, passwd);
    } catch (MalformedURLException e) {
        System.err.println("ERROR: Bad URL " + e);
    }
...
    // This bombs when called from applet context!
    result = (Hashtable) fetchMethod.execute("fetchJob", new Vector());
=====


===== Exception raised
java.security.AccessControlException: access denied (java.util.PropertyPermission org.apache.xmlrpc.TypeFactory
read)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
        at java.security.AccessController.checkPermission(AccessController.java:401)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
        at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1276)
        at java.lang.System.getProperty(System.java:573)
        at org.apache.xmlrpc.XmlRpc.<init>(XmlRpc.java:201)
        at org.apache.xmlrpc.XmlRpcClient$Worker.<init>(XmlRpcClient.java:325)
        at org.apache.xmlrpc.XmlRpcClient.getWorker(XmlRpcClient.java:234)
        at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:160)
        ...
=====

The offending line is in ./org/apache/xmlrpc/XmlRpc.java line 201.  The
following change to XmlRpc() seems to fix the problem for me.  For the
record, I'm using java 1.4.2_04 on linux.  I have not tested on other
platforms.

===== XmlRpc.java
protected XmlRpc()
{
//  System.get...() always returns null on my box anyway!
//  this(System.getProperty(TypeFactory.class.getName()));

    this((String) null);
}
=====

I admit that my workaround is too crude, but can someone offer a better
solution that is more acceptable for all?  Can someone help?

- Raja


Mime
View raw message