7 Replies Latest reply on Sep 1, 2006 10:00 AM by Bernd Ruecker

    Seam Bean not instantiated

    Bernd Ruecker Master

      Hi!

      I have a little, but confusing problem. I use JBoss 4.0.4 and the seam 1.0.1 GA. I have copied the TODO-Example and build my own Ant-Build and integrated the stuff in our own ear (with jbpm as sar and some other things).

      Everything is deploying after a few hours of work :-)

      But if I now call the login site, write in a name and klick Login i redirect to the login site. The I added a constructor to the unchanged Login class:

      @Name("login")
      public class Login {
      
       public Login() {
       new Exception("Login created").printStackTrace();
       }
      
      


      But the Exception is never thrown. In the original Todo-Example it is thrown.

      I searched every configuration file and artefact but can not find a important difference. Also I have no idea why seam dos not create the bean.
      And why it doesn't throw any other exception than.

      ANY hint for where to start looking would be helpful!

      Thanks a lot
      Bernd

        • 1. Re: Seam Bean not instantiated
          Bernd Ruecker Master

          Has nobody a idea to this? I investigated anothe few hours but don't get any hint. I have no real idea how this is not working...

          Thanks a lot for any hint!

          • 2. Re: Seam Bean not instantiated
            Pete Muir Master

            As you say, it's likely the component isn't being instantiated. Does your log show the component being added when the application starts?

            • 3. Re: Seam Bean not instantiated
              Stefan Frank Newbie

              Hi Bernd, how is business?! (you may remember me from Karlsruhe...),

              seam can really drive you nuts: Checking the web.xml and the components.xml for the jndi-pattern may help. web.xml has a context-param for the jndi-pattern, while components.xml has a property for the org.jboss.seam.core.init-Component.

              And the jndi-pattern is sensitive to run inside jboss or only in the embedded container - inside jboss you need the <ear-name>/${ejbName}/local, while inside the embedded container you have to omit the ear-name. (that's why the jndi-pattern is usually replaced by ant for testing/deployment).

              Especially the fact, that seam fails silently if it can't resolve names can drive you crazy - a typical symptom for this is a "Conversion Error" on the webpage (and nothing in the logs), if you use entities that can't be found...

              hope this helps
              stf

              • 4. Re: Seam Bean not instantiated
                Bernd Ruecker Master

                Hi Stefan (right?),

                of course I remember you, I thought you are catching rabbits :-) But Seam is cool stuff I think.

                I only need a short example for my upcoming book, but that short example takes a lot of time :-(

                My problem does not have to do with EJB-References or JNDI, I have only the LoginBean (a simple POJO for logging in) for the Login.jsp. But this Backing Bean does not get instantiated, and I have no idea why....

                • 5. Re: Seam Bean not instantiated
                  Bernd Ruecker Master

                  Hi petemuir,

                  yes, you are right. it is missing in the log of components.

                  In the log of the Todo-Example I find this lines

                  [Scanner] scanning: /C:/java/jboss-4.0.4/server/default/tmp/deploy/tmp27153jboss-seam-todo.ear-contents/jboss-seam-todo.jar
                  [Component] Component: login, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.example.todo.Login
                  [Component] Component: todoList, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.example.todo.TodoList
                  


                  Î investigated further and found the little difference: the seam.properties is missing in my seam-ticket.jar. I added the (empty !!) seam.properties file and then it worked...

                  Amazing... And a little bit frustrating ;-)

                  But thanks for the help!!

                  • 7. Re: Seam Bean not instantiated
                    Bernd Ruecker Master

                    good idea and thanks!