3 Replies Latest reply on Dec 5, 2005 3:37 PM by matthew.edwards

    Help with classpath

    udarnick

      I am getting errors when I am running tests that are bundled with seam. I have a strong feeling that the problem is classpath. I have worked trying to figure this out, using different classpath configurations. If you could help me, I would appreciate it.

      I am using Intellij 5.02. My db is mysql 5.0.

      java.lang.NullPointerException
       at org.jboss.seam.example.booking.test.LoginTest$1.invokeApplication(LoginTest.java:33)
       at org.jboss.seam.mock.SeamTest$Script.run(SeamTest.java:100)
       at org.jboss.seam.example.booking.test.LoginTest.testLogin(LoginTest.java:26)
       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:294)
       at org.testng.internal.Invoker.invokeMethod(Invoker.java:343)
       at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:462)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:61)
       at org.testng.TestRunner.privateRun(TestRunner.java:584)
       at org.testng.TestRunner.run(TestRunner.java:479)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:191)
       at org.testng.SuiteRunner.run(SuiteRunner.java:117)
       at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:99)
       at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:138)
       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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
      
      ===============================================
      Hotel Booking
      Total tests run: 6, Failures: 6, Skips: 0
      ===============================================
      
      
      Process finished with exit code 0
      


        • 1. Re: Help with classpath
          matthew.edwards

          Sometimes we get a

          java.lang.NullPointerException
          when we don't provide values for all the required properties.

          Sometimes not. I have had a few problems where the error was an incorrect property configuration and they showed up as NullPointerExceptions.

          I have many problems where the problem was the result of a jar being placed in the wrong classpath. These showed up as Null... sometimes.

          • 2. Re: Help with classpath
            gavin.king

            Yes, note that if

            (1) The component is not in the classpath, or does not sit beside a seam.properties file OR
            (2) You have two different seam jars in your classpath (so that the seam annotations are loaded on different classloaders)

            Seam will NOT detect the existence of the component!

            This means that then if you later refer to the component by name, without having required=true, you will expose yourself to NPEs, since there is no component with the name of the context variable, so Seam will simply take the current value of the context variable (null).

            Always make sure that Seam logs all your components during the startup sequence!

            • 3. Re: Help with classpath
              matthew.edwards

              thankyou for clarifying that.