public void statefulTest() throws Exception { InitialContext ctx = new InitialContext(); StatefulTestLocal test = (StatefulTestLocal) ctx.lookup("initial-ejb3-test/StatefulTestBean/local"); test.setState("hello world"); if (!test.getState().equals("hello world")) throw new Exception("state was not retained"); }