1 Reply Latest reply on Oct 21, 2009 1:20 AM by Tim Evers

    Seam is desinjecting components injected with @in

    Marcos Sousa Newbie


      I'm facing a really straight problem with seam injection. I just create a project using seam generator 2.2 with Jboss Tools and I create the following components


      public class Test1 {
          public String sayHello() {
             return "hello";


      public class Test2 {
         private Test1 test1;
         public Test1 getTest1() {
           return test1;


      public class TestBean {
         private Test2 test2;
         public void say() {

      When I run the expression {testBean.say} it throws a NullPointExeception because test1 wasn't injected.

      ps: I debugged de Component.getInstance() and it desinject the bean before returning the instance.

      Is there anything to solve this?

        • 1. Re: Seam is desinjecting components injected with @in
          Tim Evers Master

          I believe you will find that this is related to the JIRA I raised recently.

          The issue you are having is fairly fundamental to the system and can cause a lot of frustration and confusion. I would expect that this sort of bug be addressed fairly quickly.

          Unfortunately it appears that most(all) of the Seam guys are so caught up in Weld or whatever it is getting called these days that very little is being done to address the issues that a lot of us are having with the existing library. I've raised 2 JIRAs over the past month or so and neither of them have received any attention. Not even a comment. My guess is that the only way these issues will be fixed is if you prove that they exist in Seam3 or wherever the time is being spent at the moment.

          Anyways, enough of my ranting.... here's how to solve your problem.

          For the time being, to work around your issue don't use Injection. Instead access your Seam bean direcly using the Component.getInstance(class) method. This will avoid the variable being disinjected at the end of the invocation of your method.