Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applet - Servlet socket connection using orion server

Status
Not open for further replies.

Colombian

Programmer
May 14, 2002
7
GB
Hello people,

I am trying to connect from an applet, embedded in an html page and using the java plug-in (1.4), to a servlet or jsp page on an orion j2ee application server.

On loading the applet the following exception is thrown

Exception:java.security.AccessControlException:access denied (java.net.SocketPermission 10 resolve)

I understand from looking round the internet that the problem is that the orion server is not configured to allow socket connections to this applet. If this had been a tomcat server then I think this would have been configured in the

tomcat.policy

configuration file. Does anyone know if there is an equivalent config file or alternative method for configuring the orion server to allow the applet to communicate with the server?

Thanks in advance.

Colombian
 
We have had exactly the same problem trying to port a Tomcat app to Orion involving refused SocketPermission to an RMI server.

Have you by any chance resolved this problem, and if so, could you share the solution with us?
 
I've got an applet running on tomcat that connects to a servlet and I'm using a URLConnecton. To do this the applet and servlet need to be on the same server. Here's an example. If you need more info post a reply.

URL currentPage = getCodeBase();
String protocol = currentPage.getProtocol();
String host = currentPage.getHost();
int port = currentPage.getPort();
String urlSuffix = "/servlet/SERVLET_NAME";
try{

URL dataURL = new URL(protocol,host,port,urlSuffix);
URLConnection conn = dataURL.openConnection();
conn.setUseCaches(false);
conn.setDoOutput(true);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
conn.setRequestProperty("Content-Length",String.valueOf(byteStream.size()));
conn.setRequestProperty("Content-Type","application/x- PrintWriter out = new PrintWriter(byteStream, true);

String xVen = URLEncoder.encode("REQUEST");

String data = "param1="+xVen;
out.print(data);
out.flush();
System.out.println("Trying Output Stream");
byteStream.writeTo(conn.getOutputStream());
System.out.println("Output Stream Successful");

This way you don't use sockets.
Hope it helps

Chuck T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top