5 Replies Latest reply on Dec 23, 2002 2:19 PM by Steven Haines

    Error locating EJB from Servlet / non-RMI

    Steven Haines Newbie

      When I try to look up my EJB from my Servlet with the default jndi.properties file, I get an error: Failed to connect to ormi:1099; if I uncomment the provider URL it works, but JBoss warns not to do that:

      jndi.properties:
      # Do NOT uncomment this line as it causes in VM calls to
      # go over RMI!
      #java.naming.provider.url=localhost

      I think I have all of my links connected, here's my scenario:

      web.xml:
      <web-app>
      ...
      <ejb-ref>
      <ejb-ref-name>ejb/Controller</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      mypackage.ControllerHome
      mypackage.Controller
      <ejb-link>ControllerBean</ejb-link>
      </ejb-ref>
      </web-app>

      jboss-web.xml:
      <jboss-web>
      <ejb-ref>
      <ejb-ref-name>ejb/Controller</ejb-ref-name>
      <jndi-name>ControllerBean</jndi-name>
      </ejb-ref>
      </jboss-web>

      ejb-jar.xml:
      ...

      Controller
      <display-name>Controller</display-name>
      <ejb-name>ControllerBean</ejb-name>
      mypackage.ControllerHome
      mypackage.Controller
      <ejb-class>mypackage.ControllerEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      ...
      </session
      ...

      jboss.xml:
      ...doesn't override the JNDI name, tried that and it didn't have any affect..

      Any ideas?

      Thanks,
      Steve



        • 1. Re: Error locating EJB from Servlet / non-RMI
          Joel Vogt Master

          what os are you doing this on?

          • 2. Re: Error locating EJB from Servlet / non-RMI
            Adrian Brock Master

            Please show the stack trace when reporting
            exceptions.

            Your config looks ok.

            Regards,
            Adrian

            • 3. Re: Error locating EJB from Servlet / non-RMI
              Steven Haines Newbie

              I am running on Windows 2000, JBoss version 3.04 and 3.2 beta 2. Here is the stack trace:

              10:55:42,459 WARN [NamingContext] Failed to connect to ormi:1099
              javax.naming.CommunicationException: Failed to connect to server ormi:1099. Ro
              t exception is
              javax.naming.ServiceUnavailableException: Failed to connect to server ormi:1099
              Root exception is
              java.net.UnknownHostException: ormi
              at java.net.InetAddress.getAllByName0(InetAddress.java:571)
              at java.net.InetAddress.getAllByName0(InetAddress.java:540)
              at java.net.InetAddress.getByName(InetAddress.java:449)
              at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactor
              .java:61)
              at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:164)
              at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1055)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:455)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:448)
              at javax.naming.InitialContext.lookup(InitialContext.java:350)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:563)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:599)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:448)
              at javax.naming.InitialContext.lookup(InitialContext.java:350)
              at com.quest.web.control.MainServlet.getEJBController(MainServlet.java:
              93)
              at com.quest.web.control.MainServlet.init(MainServlet.java:128)
              at javax.servlet.GenericServlet.init(GenericServlet.java:256)
              at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.jav
              :286)
              at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:33
              )
              at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicat
              onHandler.java:293)
              at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
              72)
              at org.mortbay.http.HttpContext.handle(HttpContext.java:1700)
              at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicatio
              Context.java:554)
              at org.mortbay.http.HttpContext.handle(HttpContext.java:1650)
              at org.mortbay.http.HttpServer.service(HttpServer.java:894)
              at org.jboss.jetty.Jetty.service(Jetty.java:497)
              at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
              at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:966)
              at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
              at org.mortbay.http.SocketListener.handleConnection(SocketListener.java
              204)
              at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
              at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:504)

              Thanks for the prompt reply!
              Steve

              • 4. Re: Error locating EJB from Servlet / non-RMI
                Adrian Brock Master

                It looks like there is a problem with
                your host configuration.

                Is ormi your local machine.

                In XP (don't know about 2000) you can configure
                hosts in

                c:\WINDOWS\system32\drivers\etc\hosts

                Maybe there is a problem with your dns or dhcp server?

                Regards,
                Adrian

                • 5. Re: Error locating EJB from Servlet / non-RMI
                  Steven Haines Newbie

                  That's the thing that I can't understand.. My host name is not "ormi" and when I searched my JBoss directories for config files with "ormi" in them all I found was all of the infORMIx configurations.. "ormi" looks suspiciously close to "rmi" and thus I thought it was related.. Furthermore I installed JBoss on a different machine and it had the same problem..

                  Have you seen "ormi" anywhere in the JBoss configuration? Any other ideas?

                  Thanks!
                  Steve