Please see the code below... I am getting host and port in applet itself and passing it to ServerManager
//---------- code inside applet ---------------// String host = getCodeBase().getHost(); String port = getCodeBase().getPort() == -1 ? "" : ":" + getCodeBase().getPort(); //--------- code of ServerManager -------------// String url = (host + port); Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory" ); props.put(Context.PROVIDER_URL,"http://" + url + "/invoker/JNDIFactory" ); props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); try { InitialContext ctx = new InitialContext(props); Object sessionRemoteRef = ctx.lookup("testejb.session.MySessionBean"); //Line no 74 }catch(Exception e){ e.printStackTrace(); } My problem is when i access the applet from browser using address http://parag:8080/mine/TestApplet.html, everything works fine but when i try to access it using http://localhost:8080/mine/TestApplet.html it throws the following error (TestApplet.html is a simple html file with applet tag) -------------------------------------------- javax.naming.ServiceUnavailableException: Unexpected failure [Root exception is java.security.AccessControlException: access denied (java.net.SocketPermission paragxp:8080 connect,resolve)] at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:56) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45) at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:55) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85) at $Proxy0.lookup(Unknown Source) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507) at javax.naming.InitialContext.lookup(Unknown Source) at testclient.ServerManager.lookup(ServerManager.java:74) at testclient.ServerManager.(ServerManager.java:55) at testclient.ServerManagerFactory.getServerManager(ServerManagerFactory.java:28) at testclient.gui.TestApplet.initialise(TestApplet.java:260) at testclient.gui.TestApplet.init(TestApplet.java:180) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.security.AccessControlException: access denied (java.net.SocketPermission paragxp:8080 connect,resolve) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkConnect(Unknown Source) at sun.plugin.net.protocol.http.HttpURLConnection.checkPermission(Unknown Source) at sun.plugin.net.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source) at org.jboss.invocation.http.interfaces.Util.invoke(Util.java:101) at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvokerProxy.java:102) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96) at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:42) --------------------------------------------- I think it should resolve localhost to parag as parag is the name of my own machine but it is not doing so. Can someone please tell me why it throws AccessControlException when accessing from localhost ? Thanks and Regards, Parag Sagdeo View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3829772#3829772 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3829772 ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
