When you make a remote call to an EJB, you need to do so from a JNDI/initial context. Each app server provides certain properties for doing this lookup which is the first half of your code.
Then you have the context go into the JNDI (directory) and get the remote object. In EJB 2.1, there is an extra step where you have to get the home interface first and lookup the bean from it. In EJB 3 - which your sample is using - it looks like you get the bean directly. (I didn't know you could do this.)