1 Reply Latest reply on Aug 30, 2012 9:21 AM by Thomas Chang

    Problem with JNDI remote lookup

    Thomas Chang Apprentice



      Formerly as I use the Jboss AS 5 and AS 6 I have no problem to run following program which uses the HA 1100  for JNDI lookup. Now in Jboss AS 7 this is not supported. I've tried to change the code accrording to some examples from internet but not succeede.


      Here are my codes used in Jboss AS 5 and 6.




      import javax.ejb.Remote;



      public interface Counter {

            public void printCount(int messageNumber);







      import javax.ejb.Stateless;

      import org.jboss.annotation.ejb.Clustered;



      public class CounterBean implements Counter {

            public String printCount(int countNumber) {

                  System.out.println("Request from Client " + countNumber);

                  String rt = new Integer(countNumber).toString();

                  return "Response from server " + rt;







      import javax.naming.Context;

      import javax.naming.InitialContext;


      public class ClientCluster {

            public static void main(String[] args) throws Exception {

                  Properties properties = new Properties();





                  properties.put("java.naming.provider.url", "");

                  InitialContext ctx = new InitialContext(properties);

                  Counter s = (Counter) ctx.lookup("CounterBean/remote");

                  System.out.println("The result can be seen in JBoss AS Console");

                  for (int i = 0; i < 100; i++) {