2 Replies Latest reply on Dec 24, 2002 3:11 AM by Ray Winestone

    Object from context

    Ray Winestone Newbie

      I am trying to get my own data access pool class from the ebj context.

      I have inserted the jar containing the required classes in
      %JBOSS_HOME%\server\default\lib


      In the ejb-jar.xml

      <resource-env-ref>
      <description />
      <resource-env-ref-name>
      dataSource
      </resource-env-ref-name>
      <resource-env-ref-type>
      com.access.AccessDataSource
      </resource-env-ref-type>
      </resource-env-ref>


      In the jboss.xml


      <resource-env-ref>
      <resource-env-ref-name>
      dataSource
      </resource-env-ref-name>
      <jndi-name>
      mysource
      </jndi-name>
      </resource-env-ref>


      and in the bean I have used the code

      try
      {
      java.util.Hashtable JNDIParm =
      new java.util.Hashtable();
      JNDIParm.put(Context.PROVIDER_URL, "localhost");
      JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      Context c = new InitialContext(JNDIParm);

      Object d = c.lookup("java:comp/env/mysource");
      }
      catch (NamingException e)
      {
      e.printStackTrace();
      }


      but this only gives a NameNotFoundException.

      Can anyone show me what I have done wrong?

      Thanks

      Ray