0 Replies Latest reply on Jul 8, 2002 8:17 AM by Mark Ayad

    Resin Jboss (External) NameNotFoundException

    Mark Ayad Newbie

      I'm trying to connect to a EJB running in a jboss server from a jsp running
      on resin, but a javax.naming.NameNotFoundException: ejb/Interest is thrown.
      I guess I'm missing some mapping in a file somewhere. Connecting from a
      standalone client without Resin worked, so I have established that the EJB
      has been deployed ok.

      On Jboss the jboss.xml is:

      <?xml version="1.0" encoding="UTF-8"?>

      <enterprise-beans>

      <ejb-name>Interest</ejb-name>
      <jndi-name>ejb/Interest</jndi-name>

      </enterprise-beans>


      Once packaged and deployed a standalone client test was preformed

      using these properties:

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

      and this main:

      public static void main(String[] args)
      {
      try
      {
      InitialContext jndiContext = new InitialContext);

      Object ref = jndiContext.lookup("ejb/Interest");

      InterestHome home = (InterestHome) PortableRemoteObject.narrow(ref,
      InterestHome.class);
      Interest interest = home.create();
      System.out.println(interest.calculateCompoundInterest(1000, 0.10, 2));
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
      }

      Works fine.

      Now From Using Resin 2.1.2

      In resin.conf:

      <jndi-link>
      <jndi-name>java:comp/env/ejb</jndi-name>
      <jndi-factory>org.jnp.interfaces.NamingContextFactory</jndi-factory>
      <init-param java.naming.provider.url="localhost:1099"/>
      </jndi-link>

      now the jsp:

      <%@ page import='javax.naming.InitialContext' %>
      <%@ page import='javax.rmi.PortableRemoteObject' %>
      <%@ page import='org.jboss.docs.interest.Interest' %>
      <%@ page import='org.jboss.docs.interest.InterestHome' %>

      <%
      // Get a naming context
      InitialContext jndiContext = new InitialContext();
      if(jndiContext != null)out.print("got context");

      // Get a reference to the Interest Bean
      Object ref = jndiContext.lookup("ejb/Interest");

      if(ref != null)out.print("got reference");
      %>