0 Replies Latest reply on Jun 13, 2012 6:27 PM by shadowcreeper

    JBoss 7.1 JNDI lookup using PROVIDER_URL without PRINCIPAL and CREDENTIALS

    shadowcreeper Apprentice

      When using the jboss-ejb-client.properties file I can set the following to allow me to leave out login details:

       

      {code}remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

      remote.connection.localhost.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false{code}

       

      I don't want to do this in production, but I was just wondering if this was possible using the following PROVIDER_URL method:

       

      {code}// stand-alone integration test (not run from within JBoss, and no jboss-ejb-client.properties available in the class path)

      Properties jndiProperties = new Properties();

      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

      jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");

      jndiProperties.put("jboss.naming.client.ejb.context", true);

      jndiProperties.put(Context.SECURITY_PRINCIPAL, "login");

      jndiProperties.put(Context.SECURITY_CREDENTIALS, "password");

      InitialContext context = new InitialContext( jndiProperties );

      // stand-alone integration test (not run from within JBoss, and no jboss-ejb-client.properties available in the class path)

      try

      {

         MyRemoteBean myRemoteBean = (MyRemoteBean)context.lookup( "my-ear/my-jar/MyBeanEJB!my.bean.MyRemoteBean" );

         myRemoteBean.doSomething();

      }

      finally

      {

         context.close();

      }{code}

       

      Is there something I can add to the jndiProperties above to allow me use anonymous credentials (to leave out the principal and credentials information)?