0 Replies Latest reply on May 15, 2003 8:32 AM by sys user

    Tomcat + EJB

    sys user Master

      Hello All!
      I try get Client_PropSectionHome from servlet from Tomcat. Client_PropSectionHome-ejb there is on Jboss server.

      But I get Exception:
      javax.naming.NamingException: Cannot create resource instance
      at org.apache.naming.factory.EjbFactory.getObjectInstance(EjbFactory.jav
      a:184)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3
      01)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
      at servletToJsp.doGet(servletToJsp.java:48)

      Servlet:
      -------------------------------------
      1. InitialContext jndiCntx = new InitialContext( );
      2. Object ref =
      jndiCntx.lookup("java:comp/env/ejb/Client_PropSection");
      3. Client_PropSectionHome home = (Client_PropSectionHome)
      PortableRemoteObject.narrow(ref,Client_PropSectionHome.class);

      web.xml:
      -----------------------------------

      <?xml version="1.0" encoding="ISO-8859-1"?>

      <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
      "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

      <web-app>

      <servlet-name>test</servlet-name>
      <servlet-class>servletToJsp</servlet-class>

      <servlet-mapping>
      <servlet-name>test</servlet-name>
      <url-pattern>test</url-pattern>
      </servlet-mapping>

      <ejb-ref>
      <ejb-ref-name>ejb/Client_PropSection</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      test.bean.entity.Client_PropSectionHome
      test.bean.entity.Client_PropSection
      </ejb-ref>

      </web-app>

      server.xml:
      -----------------------------------






      java.naming.factory.initial
      org.jnp.interfaces.NamingContextFactory


      java.naming.provider.url
      10.3.0.3:1099


      java.naming.factory.url.pkgs
      org.jboss.naming:org.jnp.interfaces




      jndi.properties (this file I use only fo standalone application):
      -----------------------------------
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=10.3.0.3:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces


      Help me, please.