2 Replies Latest reply on Jan 24, 2002 11:12 AM by scott mccrimmon

    NamingContextFactory fails to instantiate on EJB ic lookup.

    scott mccrimmon Newbie

      I'm upgrading from the jboss 2.4.3/tomcat 3.2.3 bundle to 2.4.4/4.0.1. Everything is working great except for looking up deployed EJB's from a webapp. It seems that the ic lookup is throwing a NamingException. The same code runs fine on the previous version of jboss/tomcat, and there were no errors in the deployment of either the ejb or the war files. Have I missed a configuration step for the jboss/catalina bundle?

      Here is the stack trace:

      Cannot instantiate class: org.jnp.interfaces.NamingContextFactory at com.marex.contact.util.FormElements.initialize(FormElements.java:180) at org.apache.jsp.CustomerSearch$jsp._jspService(CustomerSearch$jsp.java:134) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106) at java.lang.Thread.run(Unknown Source)


      Sorry if this topic has already been covered, there seems to be a problem with the search functionality in the forums.

      Thanks much,

      Scott

        • 1. Re: NamingContextFactory fails to instantiate on EJB ic look
          F Zemen Newbie

          I'm using Jboss 3.0 with Catalina.

          What I discovered was I had to explicitly configure the IntialContext with the initial context factory information because catalina provides its own JNDI library. I couldn't get it working using the jndi.properties file.

          Properties _props = new Properties();
          _props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

          _props.setProperty(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");

          _props.setProperty(Context.PROVIDER_URL, "localhost:1099");

          InitialContext jBossContext = new InitialContext(_props);

          • 2. Re: NamingContextFactory fails to instantiate on EJB ic look
            scott mccrimmon Newbie

            Thanks for the quick feedback!

            The problem turned out to be something a bit simpler. I had a copy of the j2ee.jar in the web-inf\lib directory of the web application. As soon as I removed the jar and redeployed the war, the InitialContext lookup succeeded. As an FYI to anyone reading this thread, I removed the properties object from the InitialContext constructor and the lookup still worked, so it would seem that the issue jbossuser raised is specific to the 3.0 bundle and not 244/401.

            thanks again,

            Scott