2 Replies Latest reply on Jul 23, 2002 6:05 PM by glenc

    NamingException accessing connector from servlet

    glenc

      My servlet encounters a NamingException (trace below) when
      trying to access my connector's connection factory,
      as in
      InitialContext ctx = new InitialContext();
      javax.resource.cci.ConnectionFactory cxf =
      ( javax.resource.cci.ConnectionFactory )
      ctx.lookup( "java:comp/env/eis/myConnector" );
      I've verified that the ctx is not null, and
      eis/myConnector is registered in the JNDI tree.

      Might this be a classloading problem? Since the dereference presumably
      requires instantiation of the actual (custom) factory
      impl, where is the correct place to place that impl?
      I am deploying separate .war and .rar files (i.e., not as
      an .ear), and the .rar and .war both have a copy of
      the impl (and associated classes). I tried placing a jar
      with the impl and associated classes on JBoss's classpath
      (I modified run.bat to include it), which causes JBoss
      to tell me it can't find the javax.spi et al classes.

      javax.naming.NamingException: Could not dereference object. Root exception is
      java.lang.NullPointerException
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:519)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:558)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
      at javax.naming.InitialContext.lookup(InitialContext.java:345)
      at com.convera.servlet.JCAServlet.process(Unknown Source)
      at com.convera.servlet.JCAServlet.access$200(Unknown Source)
      at com.convera.servlet.JCAServlet$Worker.run(Unknown Source)

        • 1. Re: NamingException accessing connector from servlet
          davidjencks

          Using comp/env only works when the packages are in the same .ear (if then;-), and when you have explicitly mapped the comp/env location your program uses to the actual jndi location. Try looking up the cf under what you see it bound under in jndiview (probably java:/eis/myConnector). You are running the servlet container in the same vm as jboss, right?

          To use jndiview, go to port 8082 or 8080/jmx-console with your browser and find the jndiview mbean under jboss. On its detail page, press the list button.

          • 2. Re: NamingException accessing connector from servlet
            glenc

            Using comp/env does in fact work. My problem was that
            I hadn't added a <resource-ref> to jboss-web.xml.
            Once I did that the lookup succeeded, and the connector
            is now responding to the servlet.