Search code examples
javajboss

I set INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory" but still it looks for websphere


I am migrating a WebSphere 6 project to JBoss EAP 6.4. And doing so I am changing datasources and connection params.

At one of these I am facing a weird issue. Even I set INITIAL_CONTEXT_FACTORY to jboss's

   INITIAL_CONTEXT_FACTORY, 
   "org.jboss.naming.remote.client.InitialContextFactory"

Still

    env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, 
            "org.jboss.naming.remote.client.InitialContextFactory");
    initialContext = new InitialContext();

this ones initial context is used in an other function (below):

    DSReferenceFactory factory = 
            DSReferenceFactory.getInstance();       
    newconn = ((DataSource) 
           factory.initialContext.lookup(DATASOURCENAME)).getConnection();
log.debug("Connection taken");

On the line
factory.initialContext.lookup(DATASOURCENAME)).getConnection();

I throws te below error:

   java.lang.ClassNotFoundException: 
   com.ibm.websphere.naming.WsnInitialContextFactory

I am not using anything with WebSphere in my code. And I am setting jboss one manually as you can see in the code. But still somehow it throws this error which I can not really relate a logic to.

Is there any one who can help me?

Thanks


Solution

  • the issue has solved after I removed the initial context factory and re build with maven.

    And also after I removed the ws-runtime.jar from the libs.

    Thanks