When using com.ibm.websphere.naming.WsnInitialContextFactory you must have the websphere lib (WebSphere\AppServer\lib ) added to your classpath AND use the java from websphere too. (WebSphere\AppServer\java\jre)