1 2 Previous Next 16 Replies Latest reply on Nov 27, 2002 8:41 AM by hstanciu

    Home interface not bound error

    megaskins

      I have written my Home and Remote interfaces, implemented a session bean and set up my ejb-jar.xml file. I put them in a jar file and put the jar file in the deploy directory.

      I have written a client that tries to lookup the Home interface, but all I ever get is an error saying the Home interface is not bound.

      I have tried everything. I have gotten the JBoss template example to work, but I can't get this simple exercise to work.

      Please help.

        • 1. Re: Home interface not bound error
          joelvogt

          well okay there could be a number of problems. Does everything deploy correctly? Can you go to the jmx console and see the jndi name mapped to your bean? How are you doing the lookup? (ie which name)

          • 2. Re: Home interface not bound error
            megaskins

            Thanks for the reply.

            The log file says the jar file deploys but when I look at the jmx console, the jndi name doesn't show up.

            I lookup the home by using an InitialContext which has the properties set in the constructor.

            • 3. Re: Home interface not bound error
              joelvogt

              When it starts up you should see in the log your bean being bound to the jndi name. If this doesn't happen, make sure your xml config docs are all matching up and you use the same lookup as it defined in jboss.xml

              • 4. Re: Home interface not bound error
                megaskins

                make sure your xml config docs are all matching up and you use the same lookup as it defined in jboss.xml

                XML config docs? What are they?

                I have a jboss.xml file, but I can't tell if it is right. Where can I find that out?

                • 5. Re: Home interface not bound error
                  joelvogt

                  Sorry I meant your ejb-jar.xml and jboss.xml . The ejb-names should match and your jboss.xml should specify your jndi. If it is not depoying properly then most likely this is going to be your problem. I ma not sure where examples can be found

                  • 6. Re: Home interface not bound error
                    megaskins

                    Thanks again for your response.

                    I checked my jboss.xml and ejb-jar.xml files and the ejb-name match.
                    I named my jndi and use it in my lookup in the client, but it still doesn't show up on the jmx-console.

                    I don't know if other app servers are any harder to use, but I'm seriously thinking about downloading WebSphere or WebLogic to see if they are this troublesome. This is all too frustrating - deploying a simple bean shouldn't be this much of a pain.

                    Thanks anyway.

                    • 7. Re: Home interface not bound error
                      joelvogt

                      well no, this most likely isn't anything to do with the app server. If you try to deploy a valid ear file it will deploy. if your app doesn't deploy on jboss you'll have problems on any other app server as well. How about you post the section of the log where it tries to deploy your session bean?

                      • 8. Re: Home interface not bound error
                        megaskins

                        That's just it - it doesn't try to deploy any of my beans - it just says that it deploys my jar file - there are no other log statements about my jar file after that. Zilch. Nada. Nothing.

                        BTW, does my file need to be a .ear file?

                        I thought you could use a jar file for your beans and manifest files? I noticed the jBoss Template example exercise uses a file called ejb-test.jar and it seems to deploy just fine.

                        • 9. Re: Home interface not bound error
                          joelvogt

                          yes you can just deploy an ear file.

                          • 10. Re: Home interface not bound error
                            joelvogt

                            sorry meant to say jar file. There seems to be a problem. Maybe you can post some details so we can help with that?

                            • 11. Re: Home interface not bound error
                              megaskins

                              <?xml version="1.0"?>
                              <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
                              <ejb-jar>
                              <enterprise-beans>

                              <ejb-name>Hello</ejb-name>
                              examples.HelloHome
                              examples.Hello
                              <ejb-class>examples.HelloBean</ejb-class>
                              <session-type>Stateless</session-type>
                              <transaction-type>Container</transaction-type>

                              </enterprise-beans>

                              </ejb-jar>

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




                              <enterprise-beans>


                              <ejb-name>Hello<ejb-name/>
                              <jndi-name>examples/Hello<jndi-name/>

                              <enterprise-beans/>



                              package examples;

                              import javax.ejb.EJBObject;
                              import java.rmi.RemoteException;

                              /**
                              * @author default
                              *
                              * To change this generated comment edit the template variable "typecomment":
                              * Window>Preferences>Java>Templates.
                              * To enable and disable the creation of type comments go to
                              * Window>Preferences>Java>Code Generation.
                              */
                              public interface Hello extends EJBObject {

                              public String hello() throws RemoteException;

                              }

                              package examples;

                              import java.rmi.RemoteException;

                              import javax.ejb.EJBException;
                              import javax.ejb.SessionBean;
                              import javax.ejb.SessionContext;

                              /**
                              * @author default
                              *
                              * To change this generated comment edit the template variable "typecomment":
                              * Window>Preferences>Java>Templates.
                              * To enable and disable the creation of type comments go to
                              * Window>Preferences>Java>Code Generation.
                              */
                              public class HelloBean implements SessionBean {

                              private SessionContext ctx;

                              /**
                              * @see javax.ejb.SessionBean#setSessionContext(SessionContext)
                              */
                              public void setSessionContext(SessionContext arg0)
                              throws EJBException, RemoteException {
                              ctx = arg0;
                              }

                              /**
                              * @see javax.ejb.SessionBean#ejbRemove()
                              */
                              public void ejbRemove() throws EJBException, RemoteException {
                              }

                              /**
                              * @see javax.ejb.SessionBean#ejbActivate()
                              */
                              public void ejbActivate() throws EJBException, RemoteException {
                              }

                              /**
                              * @see javax.ejb.SessionBean#ejbPassivate()
                              */
                              public void ejbPassivate() throws EJBException, RemoteException {
                              }

                              /**
                              * @see examples.Hello
                              *
                              */
                              public String hello(){
                              System.out.println("hello()");
                              return "Hello World";
                              }
                              }

                              package examples;

                              import javax.ejb.EJBHome;
                              import javax.ejb.CreateException;
                              import java.rmi.RemoteException;
                              /**
                              * @author default
                              *
                              * To change this generated comment edit the template variable "typecomment":
                              * Window>Preferences>Java>Templates.
                              * To enable and disable the creation of type comments go to
                              * Window>Preferences>Java>Code Generation.
                              */
                              public interface HelloHome extends EJBHome {

                              public Hello create() throws RemoteException,
                              CreateException;

                              }


                              Everything compiles. I jar the project and deploy to default/deploy. The console reports the jar file deployed, but no mention of the bean. THe server log does the same.

                              JMX-Console does not show the bean.

                              This is getting really frustrating, since I did the same exact example in WebSphere and WebLogic with no problem.

                              • 12. Re: Home interface not bound error
                                is2612

                                I was following this thread because I was having the same problems.

                                I then found another similar thread where someone found that one of their DD's had a capital letter in the file name.

                                This led me to check my cases. I found that I had not capitalized my META-INF directory. Once I did this deployment happened.

                                Something else to check - from one beginner to another.

                                • 13. Re: Home interface not bound error
                                  dmx007

                                  plz post ur logs

                                  • 14. Re: Home interface not bound error
                                    megaskins

                                    dmx007 -

                                    There's nothing in the log to post. It simply says it is deploying my jar file. It never mentions my jar file or my session bean again.

                                    1 2 Previous Next