Java Development

2 views
Skip to first unread message

Blaine Nelson

unread,
Dec 31, 2007, 6:21:57 PM12/31/07
to Google Data API
I'm having trouble using Java to access the Google Spreadsheet through
its GData API. While I was able to run my application successfully as
a client application running on AppletViewer, when I started to
develop a web-based version of the application, I ran into Java
security issues that I haven't been able to get around. Namely, I'm
getting the following Exception:

java.lang.RuntimeException: java.security.AccessControlException:
access denied (java.net.SocketPermission www.google.com resolve)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
886)
at
sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:
1907)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:
376)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:
318)
at
com.google.gdata.client.http.AuthSubUtil.exchangeForSessionToken(Unknown
Source)
at
com.google.gdata.client.http.AuthSubUtil.exchangeForSessionToken(Unknown
Source)
at DBInterface.getService(DBInterface.java:132)
at DBInterface.init(DBInterface.java:49)
at GUI.init(GUI.java:99)
at sun.applet.AppletPanel.run(AppletPanel.java:378)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.security.AccessControlException: access denied
(java.net.SocketPermission www.google.com resolve)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:
264)
at
java.security.AccessController.checkPermission(AccessController.java:
427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:
532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031)
at java.net.InetAddress.getAllByName0(InetAddress.java:1117)
at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
at java.net.InetAddress.getAllByName(InetAddress.java:1061)
at java.net.InetAddress.getByName(InetAddress.java:958)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:
260)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:335)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:
176)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:
747)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:
162)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
916)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:
367)
... 8 more

Clearly, I'm not properly setting up my applet. I've tried self-
signing the jar I'm using, but that doesn't seem to work and I haven't
found a good resource on how to do this properly. Does anybody have
experience or recommendations on how I can properly give the correct
permissions to my applet?

Thank you,
Blaine

Andrew Thompson

unread,
Jan 1, 2008, 12:19:36 PM1/1/08
to Google Data API
On Jan 1, 10:21 am, Blaine Nelson <blaine.nel...@gmail.com> wrote:
> I'm having trouble using Java to access the Google Spreadsheet through
> its GData API.  While I was able to run my application successfully as
> a client application running on AppletViewer, when I started to
> develop a web-based version ...

The web is a big place. Care to narrow it down
with an URL to this broken applet? ***

>..of the application, I ran into Java
> security issues that I haven't been able to get around.  Namely, I'm
> getting the following Exception:
>
> java.lang.RuntimeException: java.security.AccessControlException:
> access denied (java.net.SocketPermission www.google.com resolve)

Untrusted applets will not be allowed socket connections
to a server other than the host that is the source of
the applet. Perhaps unless the applet* is launched using
webstart, which might allow 'prompted' access via a
sandboxed** applet.

* <http://www.physci.org/jws/#jtest>

** <http://www.physci.org/jws/#kk>
(Note particularly the image that appears 'onmouseout'
of the screenshot to the right.)

> Clearly, I'm not properly setting up my applet.  I've tried self-
> signing the jar I'm using, but that doesn't seem to work

Did you verify the digital signature? ***
Are you prompted to trusting the applet when it loads? ***

Where can we see this failing applet? ***

>..and I haven't
> found a good resource on how to do this properly.  Does anybody have
> experience or recommendations ..

*** ..my recommendation is to take up any further
discussion of Java deployment/security on one
of the comp.lang.java.* Usenet newsgroups. E.G.
<http://groups.google.com/group/comp.lang.java.programmer>

--
Andrew T.
PhySci.org
Reply all
Reply to author
Forward
0 new messages