1 Reply Latest reply on Feb 1, 2003 8:49 AM by Peter Doornbosch

    EJB already registered problem

    GadgetMan Newbie

      I am having a problem in deploying my EJB. Everytime I deploy it, I get this error from JBoss:

      I Depend On:
      Depends On Me: javax.management.InstanceAlreadyExistsException: jboss.j2ee:jndi
      Name=DPC1/DPU1-1/Proxy,service=EJB already registered.]

      But I always do a clean and delete the jar file, restart the server and do an ant ejbjar to compile and recreate the jar file. Now, I am told that even when the server shuts down, the EJB is still in the EJB container. So, that means I have to write code to delete it from the EJB container.

      Does this mean I have to write the ejbRemove() method in the EJB's implementation class?

      Another thing is that I don't understand why I get this instance already exists exception. I've deleted and redeployed the same bean after I've modified the code and I've never encountered this error. Perhaps, there may be something wrong with my bean?

      If I have to remove the bean, how do I do so (what code do I need to write)? If it would help to provide the code I have, I can do so.

      Thanks for any help.

        • 1. Re: EJB already registered problem
          Peter Doornbosch Apprentice

          This can occur when you have beans that depend on each other and are deployed in the wrong order. If you have multiple deployment units (bean jars) and some do depend on others, you can easily check this by first cleaning your deployment dir, start jboss and than hot-deploy the jars one by one in the right order (i.e. make sure beans that a ejb jar depends on are deployed before).

          If this is the case, the structural approach is one of:
          - package ejb-jars recursively in one jar, being dependent on each other inside out; (btw, this way of packaging is JBoss specific)
          - prepend the names of the jars with a number, and use a different deployer that deploys jars in the order of their number, see comments in the jboss-service.xml.

          Hth
          Peter.