开发者

Java JBoss Security Problem

I have the following code:

import java.rmi.RMISecurityManager;
import java.uti开发者_C百科l.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;

public class Prueba01
{
public static void main(String argumentos[])
{
    try
    {
        //System.setProperty("security.policy", "client.policy");

        //System.setSecurityManager(new RMISecurityManager());

        SecurityManager sm = System.getSecurityManager();
        System.out.println("sm" + " = " + sm);

        Hashtable<String, String> environment = new Hashtable<String, String>();

        environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
        environment.put(Context.PROVIDER_URL, "jnp://10.253.68.131:1199");

        InitialContext context = new InitialContext(environment);

        // Se establece el nombre del EJB.
        Object obj = context.lookup("ipmanager/RequestDispatcher");
        System.out.println("obj" + " = " + obj);

        context.close();
    } // Fin del try.
    catch(Exception e)
    {
        System.err.println(e.getMessage());
    } // Fin del catch.
} // Fin del método main.
} // Fin de la clase Prueba01.

Now, when I execute this code I got this:

sm = java.lang.SecurityManager@111a775

Could not obtain connection to any of these urls: 10.253.68.131:1199 and discovery failed with error: java.security.AccessControlException: access denied (java.net.SocketPermission 230.0.0.4 connect,accept,resolve)

I'm trying to pass to the virtual machine this security values:

-Djava.security.manager -Djava.security.policy=C:\Java\jre1.5.0_22\lib\security\java.policy

... but doesn't seem to be working.


Well, there's always the old standby of trying to connect to the IP & port with telnet and seeing if it's reachable that way. If not, you have a firewall problem, if so, you probably have some kind of protocol / handshake problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜