1 Reply Latest reply on Feb 11, 2011 11:08 AM by jseanjensen

    Required component not being created

    jseanjensen

      I'm trying to get a project that my predecessor started developing so that I can continue to work on it.  My challenge is greater because while I'm using Eclipse the creator of the project was using Netbeans.  I've downloaded the 8 projects involved and recreated the dependencies so Eclipse doesn't complain about them.  However when I deploy the application it fails on login giving me a null pointer exception.  I've added some logging and discovered that I'm failing in my authorization process because my authenticator class is initialing with a null component.  The original creator of the application didn't put any null tests in the code and the .ear file that was originally created from the source code works correctly so there is something in my configuration that is wrong.  I've spent quite a bit of time on this and could use some help.


      The component seems to be defined in the components.xml properly and the component that should be passed to it is defined immediately after and they seem to be well formed. 



      <component auto-create="false"
        class="gov.usbr.corp.ui.jsf.controller.seam.DefaultAuthenticator"
        name="authenticator" scope="session">
        <property name="authTypeName">@authTypeName@</property>
       </component>
       <component auto-create="true"
        class="gov.usbr.corp.ui.jsf.controller.seam.DefaultAuthInfo"
        name="authInfo" scope="application">
        <property name="roleMandatory">@roleMandatory@</property>
        <property name="roleMutuallyExclusive">@roleMutuallyExclusive@</property>
        <property name="adminRole">@adminRole@</property>
        <property name="adminPassword">@adminPassword@</property>
        <property name="adminUsernames">
         <value>admin1</value>
         <value>admin2</value>
         <value>admin3</value>
        </property>
        <property name="powerUserRole">@powerUserRole@</property>
        <property name="powerUserPassword">@powerUserPassword@</property>
        <property name="powerUsernames">
         <value>puser1</value>
         <value>puser2</value>
         <value>puser3</value>
        </property>
        <property name="userRole">@userRole@</property>
        <property name="userPassword">@userPassword@</property>
        <property name="usernames">
         <value>user1</value>
         <value>user2</value>
         <value>user3</value>
        </property>
        <property name="observerRole">@observerRole@</property>
        <property name="observerPassword">@observerPassword@</property>
        <property name="observerUsernames">
         <value>observe1</value>
         <value>observe2</value>
         <value>observe3</value>
        </property>
       </component>
      



      My DefaultAuthenticator class has a private field for AuthInfo but it is always a null and causes failures of course.  Is there a way for me to see why this component did not get created?  I doubt the code has bugs because I can run the finished .ear file I just can't make the copy I need to work on function and I don't know why.


      Any advice would be appreciated.  Anyone commenting on my lack of skills is welcome to trade places with me and show me how it's done.  :)

        • 1. Re: Required component not being created
          jseanjensen

          Is there any way to see a failure on the component creation when the component is declared in the components.xml?  What I would like to check on is whether the class file for the component is out of sync with the components.xml.  If I understand this correctly I will need to have my components.xml definition of the component exactly matching the fields in my class definition right?