3 Replies Latest reply on Aug 4, 2008 1:19 PM by Ken Clark

    Component not bound exception after refactoring Action base class

    Ken Clark Newbie

      I have a number of Action classes that all extend the same base class.  All of the subclasses were working fine yesterday.  Up until today, the base class did not have much in it.


      I went through a refactoring to reduce a lot of code.  I basically took one of the subclasses A and moved everything reusable in it into the base class.  I even moved some Injections into the base class that will be used by all the subclasses (I wasn't sure that would work.) I have been testing that class as I go and it all works fine.  I have not yet refactored any of the other subclasses except to clear up a couple of minor issues.


      I have noticed though that two of the Action classes are not accessible.  Using them yields the following error:



      Caused by: javax.naming.NameNotFoundException: ProjectAction not bound
              at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
              at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      



      I have no idea why these classes are suddenly not working.  There are no errors in the log during deployment.  In fact I see that the components deployed ok (or so it seems):



      22:59:46,125 INFO  [Component] Component: projectAction, scope: CONVERSATION, type: STATEFUL_SESSION_BEAN, class: com.kankan.action.project.
      ProjectAction, JNDI: kankan/ProjectAction/local
      



      I have also cleaned and redeployed, to no avail.


      Any ideas what can cause this to happen?


      Thanks,
      ken

        • 1. Re: Component not bound exception after refactoring Action base class
          Rob Hills Newbie

          Hi Ken,


          We have a number of Action base classes, which also have Injections in them and they all work without a problem.


          Whenever I've had this kind of problem it's usually been due to one of:



          • a class that wasn't compiling; or

          • a typo in the name (either in the class' definition, or the injection point).



          HTH,



          • 2. Re: Component not bound exception after refactoring Action base class
            Nicklas Karlsson Master

            Did you change anyting in the local interfaces? Are there any other errors in the log?

            • 3. Re: Component not bound exception after refactoring Action base class
              Ken Clark Newbie

              Everything was compiling and it couldn't be a name typo since it worked before and I did not change any naming.


              I had changed the interfaces all to extend the base classes interface -- but I made certain to NOT declare the base class interface as Local (that should be up to the subclass.)


              I have figured out how to fix this though:  it turns out that these two action classes did not have the @Local annotation.


              So before the refactoring, these classes were not local session beans -- and that was just fine I guess.  But AFTER the refactoring, apparently the lookup began looking for them as local but they were not there.  As you can see in the deployment log in my original message, it had attached the project action to a local JNDI -- even though the SB was actually deployed as remote.


              I am not sure why this happened -- it seems like the mechanism which is determining a components JNDI name at deployment time did not work right for some reason.


              Anyway, I have fixed my problem by making the interfaces local, which was actually my intention in the first place.


              Thanks,
              ken