You can access your bean by using dependency injection ... e.g. if you want to access your bean from a
servlet present on the same server.. so inside servlet at class level..declare a variable of your bean type as ...
@EJB
MyBean beanRef;
public void doGet(HttpServleRequest req, HttpServletResponse res)throws...{
}
the container will automatically assign the SessionObject reference to the variable that you've declared.
See I'm guessing you are not using any deployment descriptor. So just import your package and declare ref variable.
Else you can also do the lookup and get the reference variable.
Here one point is important. If you are not using server specific deployment descriptors then you'll have to use fully qualified remote interface name while doing the lookup. Cuz with this name the bean gets registered in JNDI. Again this JNDI naming of beans is not standardized it's server specific... Glassfish V2 uses fully qualified name of interface for registering the bean in JNDI.
I hope this will solve your problem
Nitin