public class SessionFactoryContext implements InitialContextFactory
{
I don't know why you have your own implementation of javax.naming.InitialContextFactory. You don't need that, as far as I can understand from that piece of code. Looking at the stacktrace, the implementation of your method is incorrect.