Javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory

I have some problem with Jboss-as-7.1.1, i properly deploy but when i send the request from client side i am getting some error.

javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module 

My error Log:-

18:39:50,432 INFO  [stdout] (http--127.0.0.1-8080-1) BusinessClass::sendResponse Starts...
18:39:50,434 INFO  [stdout] (http--127.0.0.1-8080-1) Enter the Try Block Edited by vivek
18:39:50,451 ERROR [stderr] (http--127.0.0.1-8080-1) javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module "deployment.responsecomponent.ear.response.war:main" from Service Module Loader
18:39:50,463 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
18:39:50,477 ERROR [stderr] (http--127.0.0.1-8080-1)    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:664)
18:39:50,482 ERROR [stderr] (http--127.0.0.1-8080-1)    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
18:39:50,483 ERROR [stderr] (http--127.0.0.1-8080-1)    at javax.naming.InitialContext.init(InitialContext.java:223)
18:39:50,485 ERROR [stderr] (http--127.0.0.1-8080-1)    at javax.naming.InitialContext.<init>(InitialContext.java:197)
18:39:50,500 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.jsp.response_jsp._jspService(response_jsp.java:118)
18:39:50,501 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
18:39:50,503 ERROR [stderr] (http--127.0.0.1-8080-1)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
18:39:50,504 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
18:39:50,516 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
18:39:50,519 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
18:39:50,520 ERROR [stderr] (http--127.0.0.1-8080-1)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
18:39:50,534 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
18:39:50,535 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
18:39:50,537 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
18:39:50,538 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
18:39:50,540 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
18:39:50,554 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
18:39:50,555 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
18:39:50,557 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
18:39:50,563 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
18:39:50,584 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
18:39:50,585 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
18:39:50,587 ERROR [stderr] (http--127.0.0.1-8080-1)    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
18:39:50,588 ERROR [stderr] (http--127.0.0.1-8080-1)    at java.lang.Thread.run(Thread.java:662)

My code is:-

Properties p = new Properties();
    System.out.println("BusinessClass::sendResponse Starts...");
    HashMap ack_gateway=null;
    try {

        System.out.println("Enter the Try Block Edited by vivek");
        p.setProperty("java.naming.factory.initial",
                    "org.jboss.naming.remote.client.InitialContextFactory");
        p.setProperty("java.naming.factory.url.pkgs",
                    "org.jboss.naming.remote:org.jboss.naming.remote.client.InitialContextFactory");
        p.setProperty("java.naming.provider.url", "remote://localhost:4447");
        Context ctx = new InitialContext(p);
        System.out.println("Got Initial Context");
        SPResponseEJBHome home = (SPResponseEJBHome) PortableRemoteObject.narrow(ctx.lookup          ("SPConnectorResponseComponent"),SPResponseEJBHome.class);

        System.out.println("BusinessClass::sendResponse Starts...");

My deployment log:-

18:38:40,949 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "response.war"
18:38:40,951 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "AsyncResponseComponentVer2.jar"
18:38:42,317 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named SPConnectorResponseComponent in deployment unit subdeployment "AsyncResponseComponentVer2.jar" of deployment "responsecomponent.ear" are as follows:

    java:global/responsecomponent/AsyncResponseComponentVer2/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBRemote
    java:app/AsyncResponseComponentVer2/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBRemote
    java:module/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBRemote
    java:jboss/exported/responsecomponent/AsyncResponseComponentVer2/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBRemote
    java:global/responsecomponent/AsyncResponseComponentVer2/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBHome
    java:app/AsyncResponseComponentVer2/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBHome
    java:module/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBHome
    java:jboss/exported/responsecomponent/AsyncResponseComponentVer2/SPConnectorResponseComponent!com.cdac.AsyncSPResponse.SPResponseEJBHome

18:38:43,173 INFO  [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /response
18:38:43,200 INFO  [org.jboss.as] (MSC service thread 1-1) JBAS015951: Admin console listening on http://127.0.0.1:9990
18:38:43,202 INFO  [org.jboss.as] (MSC service thread 1-1) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 16296ms - Started 222 of 303 services (80 services are passive or on-demand)
18:38:43,392 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "responsecomponent.ear"

Any one have idea where i m going wrong please help me.
Thanks
vivek

Solution to answer:

Is there any reason you don't use jnp? For jnp,

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

For remote jndi see below link helps you

http://middlewaremagic.com/jboss/?p=1466