Forums Register Login

Applet Error using URLConnection

+Pie Number of slices to send: Send
I have an applet written in Jess which runs fine as an applet, reads in text files from the server, etc. However, I have now modified it to use a URLConnection to send some data to a Perl cgi on my webserver and the cgi saves the data to a text file on the server. I am getting errors when trying to use the setDoOutput method of the URLConnection class. It appears to be a security conflict based on the errors I am seeing (see below). I can post my code here, but be aware it is in Jess, so may look odd to some. Any suggestions would be much appreciated.

Code snippet:
.....
(bind ?dataString (new String "THIS IS THE DATA STRING"))
(bind ?url (new URL "http://www.myserver.com/cgi-bin/jim/update.pl"))
(bind ?con (?url openConnection))
(set-member ?con doOutput TRUE)
......
I have more code after this where I want to set the Content Type, etc., but I have all that commented out because it's bombing when I try to set doOutput to TRUE.

For any JESS users, note that I also tried this (?con setDoOutput TRUE) with no luck.

Here's the error dump (long)(I've set bold the error that seems to be the problem maker):

Jess reported an error in routine call
while executing (call (engine) runUntilHalt)
while executing deffunction run-until-halt
while executing (run-until-halt).
Message: Called method threw an exception.
Program text: ( run-until-halt ) at line 970.
Nested exception is:
Error during execution
Jess reported an error in routine Funcall.execute
while executing (set-member ?con doOutput TRUE)
while executing (if (= (str-compare ?C beginner) 0) then (bind ?dataString (new String "THIS IS THE DATA STRING")) (bind ?url (new URL "http://staging30.acuityweb.com/cgi-bin/jim/update.pl")) (bind ?con (call ?url openConnection)) (set-member ?con doOutput TRUE) else (if (= (str-compare (str-cat ?C) intermediate) 0) then (save-facts "distanceIntermediate.txt") else (if (= (str-compare (str-cat ?C) advanced) 0) then (save-facts "distanceAdvanced.txt"))))
while executing defrule MAIN::saveCurrentProblem.
Message: Error during execution.
at jess.Funcall.execute(Unknown Source)
at jess.FuncallValue.resolveValue(Unknown Source)
at jess.dw.call(Unknown Source)
at jess.ep.a(Unknown Source)
at jess.Funcall.execute(Unknown Source)
at jess.Defrule.a(Unknown Source)
at jess.Activation.if(Unknown Source)
at jess.a8.a(Unknown Source)
at jess.a8.for(Unknown Source)
at jess.a8.do(Unknown Source)
at jess.Rete.runUntilHalt(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at jess.v.call(Unknown Source)
at jess.ep.a(Unknown Source)
at jess.Funcall.execute(Unknown Source)
at jess.FuncallValue.resolveValue(Unknown Source)
at jess.Deffunction.call(Unknown Source)
at jess.ep.a(Unknown Source)
at jess.Funcall.execute(Unknown Source)
at jess.Jesp.a(Unknown Source)
at jess.Jesp.for(Unknown Source)
at jess.Jesp.parse(Unknown Source)
at jess.Jesp.parse(Unknown Source)
at jess.Main.execute(Unknown Source)
at jess.ConsoleApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:552)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.plugin.net.protocol.http)
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.checkPackageAccess(SecurityManager.java:1491)
at sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:190)
at java.lang.Class.checkMemberAccess(Class.java:1450)
at java.lang.Class.getField(Class.java:916)
at jess.af.call(Unknown Source)
at jess.ep.a(Unknown Source)
... 29 more
[ January 29, 2005: Message edited by: JimLooney ]
+Pie Number of slices to send: Send
Applets are not allowed to connect to a server other than the one they are downloaded from, so if you are loading your servlet from somewhere other than www.myserver.com, that's your problem.
Everybody's invited. Except this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1139 times.
Similar Threads
URLConnection 422 Http Error response
servlet/applet communication problem
Jess: error in routine ValueVector.get
Urgent !
jess
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:17:43.