2 Replies Latest reply on Sep 15, 2004 1:08 PM by Ary Junior

    JNDI in a Servlet inside of the JBoss

    Ary Junior Newbie

      Hi, I have a mbean that creates hibernate sessions. I can create the session from a session bean:

      SessionFactory sf = (SessionFactory)ctx.lookup("java:/hibernate/SessionFactory");

      The probleam: if I try to make in a Servlet in a webapp published in one .WAR inside of one .EAR, I receive the exception:

      javax.naming.NameNotFoundException: hibernate not bound

      Please, why the servlet can't locate the mbean ? It correctly appears in the JMX Console with its name.

      []s

      Ary Junior

        • 1. Re: JNDI in a Servlet inside of the JBoss
          Elias Ross Master


          Usually, you're supposed to put anything you're using from local JNDI into resource-refs in your web.xml file.

          • 2. Re: JNDI in a Servlet inside of the JBoss
            Ary Junior Newbie

            OK, but when I try to do this i receive the exception below:

            'Caused by: javax.naming.NamingException: resource-ref: hibernate/FabricaSessaoSiteJava has no valid JNDI binding. Check the jboss-web/resource-ref.
            at org.jboss.web.AbstractWebDeployer.linkResourceRefs(AbstractWebDeployer.java:506)
            at org.jboss.web.AbstractWebDeployer.parseWebAppDescriptors(AbstractWebDeployer.java:419)
            at org.jboss.web.AbstractWebDeployer$DescriptorParser.parseWebAppDescriptors(AbstractWebDeployer.java:714)
            at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:121)
            at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:70)
            at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:306)

            Thank you!!!