11 Replies Latest reply on Jun 15, 2003 9:00 AM by springy

    EJB entity not BOUND

    pescouille

      Hello,

      I have got a big problem,

      when I launch my application Test, he said that my Engine is not bound.

      What is the problem ?

      my file TEST.java:

      import java.util.Properties;
      import javax.transaction.UserTransaction;
      import javax.naming.InitialContext;
      import javax.naming.Context;
      import javax.rmi.PortableRemoteObject;
      import engine.*;
      import java.util.Hashtable;
      import java.util.Properties;
      import java.util.Collection;
      import java.util.Iterator;
      import java.sql.*;
      import javax.servlet.*;
      import javax.servlet.http.*;
      import java.io.*;

      public class Test extends HttpServlet{
      /*public static void main(String args[]){*/
      public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
      {
      res.setContentType("text/html");
      PrintWriter out=res.getWriter();
      try{
      /*Properties prop=new Properties();
      prop.setProperty("java.naming.factory.initial", "");
      prop.setProperty("java.naming.provider.url", "localhost:1099");*/
      /* Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );*/

      Context initialContext=new InitialContext();

      out.println("");
      out.println("");
      out.println("Bonjour");
      out.println("");
      out.println("");


      Object objref = initialContext.lookup("java:comp/env/Engine");

        • 1. Re: EJB entity not BOUND
          pescouille

          I have an Engine.jar in the deploy of Jboss

          This file Engine is composed by three class: Engine, EngineHome and EngineEJB ( there are in a package engine)

          The two files : ejb-jar.xml and jbosscmp-jdbc.xml seems to be good.

          I really don't know my problem

          Thank you for your help

          • 2. Re: EJB entity not BOUND
            pescouille

            If someone has a zip file with an EJB which runs, would he be possible to send me this zip to see what I'll have to do. ( with all the files to run this ejb )

            thank you very much

            • 3. Re: EJB entity not BOUND
              pescouille

              You can send me the zip at : sc_est_bien@caramail.com

              Thank you

              • 4. Re: EJB entity not BOUND
                raja05

                Do you have a <ejb-ref> in your web.xml linking to the Engine EJB? Something like

                <ejb-ref>
                <ejb-ref-name>ejb/Engine>/ejb-ref-name>
                ....
                ....
                <ejb-link>Link to Engine</ejb-link>
                </ejb-ref>

                Check the syntax, i mite be totally wrong on the descriptor tags.

                -Raj

                • 5. Re: EJB entity not BOUND
                  jacques_buitendag

                  Hi

                  you should try and use the JMX-Console and the JNDIView service to see where your bean is bound.

                  it should be somewhere under the global namespace if you are going to use it from a JSP page.

                  Use the name from JNDIView or change your deployment descriptors to place it in the correct place in the tree.

                  also it sould not be a local bean and you can set the JNDI name with a jboss.xml file.

                  Kind Regards
                  Jacques Buitendag

                  • 6. Re: EJB entity not BOUND
                    pescouille

                    Thank you for your response but I don't have the lines that you cite in the jmx-console, I put engine.jar in the directory deploy of Jboss but He doesn't find Engine

                    • 7. Re: EJB entity not BOUND
                      pescouille

                      My file web.xml( extract) :

                      <ejb-ref>
                      <ejb-ref-name>local/engine</ejb-ref-name>
                      <ejb-ref-type>Entity</ejb-ref-type>
                      engine.EngineHome
                      engine.Engine
                      <ejb-link>Engine</ejb-link>
                      </ejb-ref>

                      My file is Engine.jar and it is situated in the directory deploy of Jboss

                      • 8. Re: EJB entity not BOUND
                        pescouille

                        My jboss.xml :

                        <?xml version="1.0" encoding="UTF-8"?>
                        <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">

                        <enterprise-beans>

                        <ejb-name>Engine</ejb-name>
                        <jndi-name>Engine</jndi-name>

                        </enterprise-beans>




                        My jboss-web.xml:

                        <?xml version="1.0" encoding="UTF-8"?>
                        <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtds/jboss-web_3_0.dtd">
                        <jboss-web>
                        <ejb-ref>
                        <ejb-ref-name>local/engine</ejb-ref-name>
                        <jndi-name>local/engine</jndi-name>
                        </ejb-ref>
                        </jboss-web>

                        • 9. Re: EJB entity not BOUND
                          raja05

                          Try
                          <ejb-link>Engine.jar#Engine</ejb-link>

                          instead of
                          <ejb-link>Engine</ejb-link>

                          • 10. Re: EJB entity not BOUND
                            szii

                            Unpack your .jar file and make sure that your ejb-jar.xml and such are truly inside of the META-INF directory.


                            -Szii

                            • 11. Re: EJB entity not BOUND
                              springy

                              Hi,

                              Why do you have to repeat the ejb-name or jndi stuff in about 3 different places for webapps within the same .ear file?

                              I've studied the JBossNukes code and they don't have anything in the web.xml and neither does the JBossForum code. I doubt that they would use remote call to their ejbs.

                              Sorry for tagging this on the end of this chat but I started my investigation with exactly the same error and I'm frustrated to find you have to repeat configuration all over the place. (And xDoclet can't do it for me!)