10 Replies Latest reply on Jun 14, 2007 6:26 AM by Wesley Hales

    Seam and maven2 running tests

    Jason Porter Master

      I get the following failure when I try to run the tests for the booking example (which I'm trying to get to work with maven2):

      -------------------------------------------------------------------------------
      Test set: org.jboss.seam.example.booking.test.LoginTest
      -------------------------------------------------------------------------------
      Tests run: 2, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 1.109 sec <<< FAILURE!
      init(org.jboss.seam.example.booking.test.LoginTest) Time elapsed: 0 sec <<< FAILURE!
      java.lang.RuntimeException: Could not create Component: authenticator
       at org.jboss.seam.init.Initialization.addComponent(Initialization.java:865)
       at org.jboss.seam.init.Initialization.installComponents(Initialization.java:796)
       at org.jboss.seam.init.Initialization.init(Initialization.java:503)
       at org.jboss.seam.mock.SeamTest.init(SeamTest.java:701)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:645)
       at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:385)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:141)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
       at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:158)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
       at org.testng.TestRunner.runWorkers(TestRunner.java:673)
       at org.testng.TestRunner.privateRun(TestRunner.java:620)
       at org.testng.TestRunner.run(TestRunner.java:480)
       at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
       at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
       at org.testng.SuiteRunner.run(SuiteRunner.java:168)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
       at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeTestNG(TestNGDirectoryTestSuite.java:286)
       at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:224)
       at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:275)
       at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:832)
      Caused by: java.lang.IllegalArgumentException: You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: authenticator
       at org.jboss.seam.Component.getJndiName(Component.java:372)
       at org.jboss.seam.Component.<init>(Component.java:219)
       at org.jboss.seam.Component.<init>(Component.java:203)
       at org.jboss.seam.init.Initialization.addComponent(Initialization.java:851)
       ... 31 more



      Any ideas on how to fix this? Is there a jar I need to include in my pom?

      Here are my dependencies:
       <dependencies>
       <dependency>
       <groupId>jboss</groupId>
       <artifactId>jboss-seam</artifactId>
       <version>1.2.1.GA</version>
       <scope>provided</scope>
       </dependency>
       <dependency>
       <groupId>javax.ejb</groupId>
       <artifactId>ejb-api</artifactId>
       <version>3.0</version>
       <scope>provided</scope>
       </dependency>
       <dependency>
       <groupId>jboss</groupId>
       <artifactId>javassist</artifactId>
       <version>3.4.ga</version>
       <scope>provided</scope>
       </dependency>
       <dependency>
       <groupId>org.apache.myfaces.core</groupId>
       <artifactId>myfaces-api</artifactId>
       <version>1.1.4</version>
       <scope>provided</scope>
       </dependency>
       <dependency>
       <groupId>org.apache.myfaces.core</groupId>
       <artifactId>myfaces-impl</artifactId>
       <version>1.1.4</version>
       <scope>provided</scope>
       </dependency>
       <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
       <version>2.5</version>
       <scope>provided</scope>
       </dependency>
       <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-annotations</artifactId>
       <version>3.2.0.ga</version>
       <scope>provided</scope>
       </dependency>
       </dependencies>
      


      Also if someone has an idea on how to clean these up (what's really needed, etc.) I would be very grateful. Thanks!

        • 1. Re: Seam and maven2 running tests
          Gavin King Master

          You need to specify the JNDI name pattern for E-EJB3 in components.xml

          • 2. Re: Seam and maven2 running tests
            Jason Porter Master

            Gavin (or anyone else that may know), I have done that, and the embedded ejb container is starting (finally :) ) Now I'm getting this beast:

            java.lang.RuntimeException: java.lang.IllegalArgumentException: Null name
             at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:391)
             at org.jboss.seam.core.Ejb.startup(Ejb.java:42)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
             at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
             at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
             at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
             at org.jboss.seam.Component.newInstance(Component.java:1746)
             at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
             at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
             at org.jboss.seam.init.Initialization.init(Initialization.java:504)
             at org.jboss.seam.mock.SeamTest.init(SeamTest.java:701)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
             at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:318)
             at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:152)
             at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:88)
             at org.testng.TestRunner.privateRun(TestRunner.java:682)
             at org.testng.TestRunner.run(TestRunner.java:566)
             at org.testng.SuiteRunner.privateRun(SuiteRunner.java:220)
             at org.testng.SuiteRunner.run(SuiteRunner.java:146)
             at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:713)
             at org.testng.TestNG.runSuitesLocally(TestNG.java:676)
             at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeTestNG(TestNGDirectoryTestSuite.java:286)
             at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:224)
             at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:275)
             at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:832)
            Caused by: java.lang.IllegalArgumentException: Null name
             at org.jboss.dependency.plugins.AbstractController.getContext(AbstractController.java:101)
             at org.jboss.kernel.plugins.dependency.AbstractKernelController.getContext(AbstractKernelController.java:94)
             at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:229)
             at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:161)
             at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:381)
             ... 37 more
            


            Any ideas on what's going wrong here?

            • 3. Re: Seam and maven2 running tests
              Gavin King Master

              Never seen that one before.

              • 4. Re: Seam and maven2 running tests
                Geoffrey De Smet Newbie

                From which repo are you getting those seam jars?
                It is a public repo?

                • 5. Re: Seam and maven2 running tests
                  Jason Porter Master

                  The seam jars I'm pulling from the JBoss repo

                  ...
                   <dependencies>
                   <dependency>
                   <groupId>jboss</groupId>
                   <artifactId>jboss-seam</artifactId>
                   <version>1.2.1.GA</version>
                   </dependency>
                   </dependencies>
                   <repositories>
                   <repository>
                   <id>jboss.com</id>
                   <url>http://repository.jboss.com/maven2</url>
                   </repository>
                   </repositories>
                  ...
                  


                  You can find the debug and ui portions at the same repo, mail, ioc, etc are not there (or at least weren't a week ago)

                  • 6. Re: Seam and maven2 running tests
                    Jason Porter Master

                    I'm getting closer now :) Here's the error with the booking demo:

                    -------------------------------------------------------------------------------
                     Test set: org.jboss.seam.example.booking.test.BookingTest
                     -------------------------------------------------------------------------------
                     Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.56 sec <<< FAILURE!
                     testBookHotel(org.jboss.seam.example.booking.test.BookingTest) Time elapsed: 0.592 sec <<< FAILURE!
                     org.jboss.seam.InstantiationException: Could not instantiate Seam component: hotelSearch
                     at org.jboss.seam.Component.newInstance(Component.java:1740)
                     at org.jboss.seam.Component.getInstance(Component.java:1643)
                     at org.jboss.seam.Component.getInstance(Component.java:1610)
                     at org.jboss.seam.Component.getInstance(Component.java:1604)
                     at org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
                     at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
                     at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:73)
                     at com.sun.el.parser.AstValue.getTarget(AstValue.java:67)
                     at com.sun.el.parser.AstValue.setValue(AstValue.java:147)
                     at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:258)
                     at org.jboss.seam.util.UnifiedELValueBinding.setValue(UnifiedELValueBinding.java:44)
                     at org.jboss.seam.mock.SeamTest$Request.setValue(SeamTest.java:374)
                     at org.jboss.seam.example.booking.test.BookingTest$2.updateModelValues(BookingTest.java:68)
                     at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:476)
                     at org.jboss.seam.example.booking.test.BookingTest.testBookHotel(BookingTest.java:63)


                    The odd thing is, it's registered earlier...

                    23:25:00,566 INFO [Component] Component: hotelSearch, scope: SESSION, type: STATEFUL_SESSION_BEAN, class: org.jboss.se am.example.booking.HotelSearchingAction, JNDI: HotelSearchingAction/local


                    It seems like someone was having a similar issue, and either it wasn't resolved or I can't find it. Anyone have any ideas? Also when I run my tests, seam is loaded twice, not sure why on that one.

                    • 7. Re: Seam and maven2 running tests
                      Jason Porter Master

                      I figured it out, don't worry about the previous error. I have it figured out.

                      • 8. Re: Seam and maven2 running tests
                        Wesley Hales Master

                        Hey Lightguard - Can you tell me what you did to fix

                        java.lang.RuntimeException: java.lang.IllegalArgumentException: Null name


                        Thanks!

                        • 9. Re: Seam and maven2 running tests
                          Jason Porter Master

                          It's been a while, but let me see if I can remember what we did. I know I had to get the JNDI names correct (set it up in the components.xml, either hardcoded in a test resource, or let maven do the filtering). Then, yeah this step may seem very obvious, make sure you have the datasource XML file along with any of the other Embeddable container configuration files. That should pretty much do it (assuming you have the jars for the EEJB container). If you're having the same problem give a full stack track and exerts from your pom.

                          • 10. Re: Seam and maven2 running tests
                            Wesley Hales Master

                            Thanks Lightguard - I highly recommend everyone who reads this to login to jira and vote on this issue:
                            http://jira.jboss.org/jira/browse/JBSEAM-1405