This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in invoking a servlet from an applet (loaded in a browser)

 
RoshanDawrani
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using an applet which invokes a servlet on the same machine for some processing. If I use AppletViewer to see this applet, the code works fine but if I use a browser (I am using IE5), I get the following error.
The applet is passing some data to the servelt and getting the result back from it using input and output streams. Could someone please tell me how do I give authority to the applet to do that.
I am using Java(tm) Servlet Development Kit Version 2.1(server) with JDK 1.2.2 on WinNT 4.
Thanks and Regards,
Roshan

com.ms.security.SecurityExceptionEx[BaseTunnelClient._invokeMethod]: cannot access "localhost":8080
at com/ms/security/permissions/NetIOPermission.check
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.chkex
at com/ms/security/StandardSecurityManager.checkConnect
at com/ms/net/wininet/WininetURLConnection.connect
at com/ms/net/wininet/http/HttpURLConnection.getOutputStream
at BaseTunnelClient._invokeMethod
at BaseTunnelClient._initialize
at RemoteMathLiteClient.<init>
at MathLiteApplet.init
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"RoshanDawrani",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.
 
RoshanDawrani
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I modify my username to abide by the policies? I went to modify my profile but could not do it there?
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to create a new ID.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IE is a pain with security. Are you sure that the applet is coming from the same domain as the servlet?
 
Roshan Dawrani
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
yes both the applets and the servlets are coming from the same domain. I am trying something on my machine only. No other machine is involved in it right now.
Yesterday somebody told me that I should use a java plug-in to load such an applet which is passing and receiving data to the servlet. So I installed a java plug-in (version 1.2) and now I am using OBJECT tag to load the applet so that java plug-in gets loaded first to help the applet. Now I am getting this error - "protocol doesn't support output". Do you have any idea about this error message?
What else do I need to do to run this simple example?
I am JUST STUCK at this point.
I am going to try things again... hope to solve it soon. see if u can help...thanks a lot...
rgds,
Roshan
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks for choosing a new name. We do appreciate it.
 
Roshan Dawrani
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My problem is solved now. The java plug-in that was suggested to me yesterday by somebody helped. But even after that I was getting an error message, which I mentioned my earlier post. The reason I was getting that error message(Protocol does not support output) was that to open a connection to the servlet, I was using openConnection() method of URL. and the url that I was passing to it was being formed as getCodeBase() + "servlet/" + "MyServlet". I was expecting the final URL to be something like "http://localhost:8080/servlet/MyServlet" but because of the result of getCodeBase(), it was becoming something like "file:/C:/Examples/servlet/MyServlet" which was wrong and because of this wrong path, I was not able to open output stream.
getCodeBase() I was using because that's how it was given in the book. Anyway, the problem got solved when I formed the URL as "http://localhost:8080/servlet" + "MyServlet" and now everything is working.
Thanks a lot.
regards,
Roshan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic