when i run the applet i got the following error while connecting to the servlt from applet here the following error com.ms.security.SecurityExceptionEx[Appl.init]: cannot access "127.0.0.1":8080 hree the applet code import java.applet.*; import java.awt.*; import java.net.*; public class Appl extends Applet { String alt,paraSub,urlmsg,error,message; public void init() { alt = getParameter("alt"); paraSub = getParameter("parasub"); URL url = getCodeBase(); urlmsg = " code base => " +url.toString(); url = getDocumentBase(); urlmsg+= " documebt base => "+url.toString(); urlmsg+=alt; urlmsg+=paraSub; String location = "http://127.0.0.1:8080/servlet/Test?urlmsgserv="+URLEncoder.encode(urlmsg); try { URL testServlet = new URL(location); URLConnection servletConnection = testServlet.openConnection(); servletConnection.connect(); } catch(Exception exp) { error="there is some error starting srevlet"+exp; repaint(); } } public void paint(Graphics g) { g.drawString(urlmsg,5,10); g.drawString(alt,5,30); g.drawString(paraSub,5,60); g.drawString("the servlet has been started",5,85); g.drawString(error,5,95); } }
Before digging into this...are you servlet and applet runding under the same application context or are you running the applet at myhost.com/someapp and the other at myhost.come/someotherapp? Exactly what is your configuration here? Thanks! Cory
Fahad tebateba
Greenhorn
Joined: Jan 05, 2003
Posts: 10
posted
0
my applet class file is in c:\files while the servlet which will it hits is present in c:\javawebserver\servlets\ i m using javawebserver hope this will help hope to c ya -fahad.
Cory Wilkerson
Ranch Hand
Joined: Aug 14, 2001
Posts: 84
posted
0
Fahad, Make sure that your applet and your servlet (when deployed) reside on the same host. If they don't, you'll run into all manner of security exceptions. Applets can communicate only with their host server -- that said, make sure they're in the same place.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.