1 Reply Latest reply on Dec 21, 2012 9:22 AM by nathandennis

    SeamTest javax.naming.NoInitialContextException

    franc.rovett0

      Hi everyone,

       

      this is my first discussion in the JBoss Community!

       

      I have now for longer a problem with Seam tests. I have no Idea what the cause could be. Maybe an information I still have to specify somewhere.

       

      Do somebody have an idea?

       

      Here the error log:

       

      1311 ERROR [main]   org.jboss.seam.exception.Exceptions     - Can't find exception class for exception handler

      java.lang.ClassNotFoundException: org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException

      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

      at java.security.AccessController.doPrivileged(Native Method)

      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

      at java.lang.Class.forName0(Native Method)

      at java.lang.Class.forName(Class.java:169)

      at org.jboss.seam.util.Reflections.classForName(Reflections.java:184)

      at org.jboss.seam.exception.Exceptions.parse(Exceptions.java:197)

      at org.jboss.seam.exception.Exceptions.initialize(Exceptions.java:123)

      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:597)

      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)

      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)

      at org.jboss.seam.Component.callComponentMethod(Component.java:2258)

      at org.jboss.seam.Component.callCreateMethod(Component.java:2181)

      at org.jboss.seam.Component.newInstance(Component.java:2141)

      at org.jboss.seam.Component.getInstance(Component.java:2030)

      at org.jboss.seam.Component.getInstance(Component.java:2009)

      at org.jboss.seam.Component.getInstance(Component.java:2003)

      at org.jboss.seam.Component.getInstance(Component.java:1976)

      at org.jboss.seam.Component.getInstance(Component.java:1971)

      at org.jboss.seam.exception.Exceptions.instance(Exceptions.java:263)

      at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:126)

      at org.jboss.seam.mock.AbstractSeamTest$Request.restoreViewPhase(AbstractSeamTest.java:721)

      at org.jboss.seam.mock.AbstractSeamTest$Request.emulateJsfLifecycle(AbstractSeamTest.java:583)

      at org.jboss.seam.mock.AbstractSeamTest$Request.access$100(AbstractSeamTest.java:177)

      at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:497)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)

      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)

      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)

      at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)

      at org.jboss.seam.mock.AbstractSeamTest$FacesRequest.run(AbstractSeamTest.java:862)

      at com.axa.ch.opk.seam.action.Gui02PolicenwahlActionTest.guiActionButtonPolicenwahlTest(Gui02PolicenwahlActionTest.java:22)

      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:597)

      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)

      at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)

      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)

      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)

      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

      at org.testng.TestRunner.runWorkers(TestRunner.java:1178)

      at org.testng.TestRunner.privateRun(TestRunner.java:757)

      at org.testng.TestRunner.run(TestRunner.java:608)

      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

      at org.testng.SuiteRunner.run(SuiteRunner.java:240)

      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)

      at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)

      at org.testng.TestNG.run(TestNG.java:999)

      at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:60)

      at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:153)

      at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)

      at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)

      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:597)

      at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)

      at $Proxy0.invoke(Unknown Source)

      at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)

      at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)

      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

      1343 DEBUG [main]        org.jboss.seam.faces.Navigator     - redirecting to: /error/opk_error_page.xhtml

      1343 ERROR [main]  org.jboss.seam.jsf.SeamPhaseListener     - swallowing exception

      java.lang.RuntimeException: exception invoking: getTransaction

      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)

      at org.jboss.seam.Component.callComponentMethod(Component.java:2258)

      at org.jboss.seam.Component.unwrap(Component.java:2284)

      at org.jboss.seam.Component.getInstance(Component.java:2050)

      at org.jboss.seam.Component.getInstance(Component.java:2009)

      at org.jboss.seam.Component.getInstance(Component.java:2003)

      at org.jboss.seam.Component.getInstance(Component.java:1976)

      at org.jboss.seam.Component.getInstance(Component.java:1971)

      at org.jboss.seam.transaction.Transaction.instance(Transaction.java:39)

      at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:321)

      at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:144)

      at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)

      at org.jboss.seam.mock.AbstractSeamTest$Request.restoreViewPhase(AbstractSeamTest.java:721)

      at org.jboss.seam.mock.AbstractSeamTest$Request.emulateJsfLifecycle(AbstractSeamTest.java:583)

      at org.jboss.seam.mock.AbstractSeamTest$Request.access$100(AbstractSeamTest.java:177)

      at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:497)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)

      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)

      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)

      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)

      at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)

      at org.jboss.seam.mock.AbstractSeamTest$FacesRequest.run(AbstractSeamTest.java:862)

      at com.axa.ch.opk.seam.action.Gui02PolicenwahlActionTest.guiActionButtonPolicenwahlTest(Gui02PolicenwahlActionTest.java:22)

      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:597)

      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)

      at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)

      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)

      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)

      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

      at org.testng.TestRunner.runWorkers(TestRunner.java:1178)

      at org.testng.TestRunner.privateRun(TestRunner.java:757)

      at org.testng.TestRunner.run(TestRunner.java:608)

      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

      at org.testng.SuiteRunner.run(SuiteRunner.java:240)

      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)

      at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)

      at org.testng.TestNG.run(TestNG.java:999)

      at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:60)

      at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:153)

      at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)

      at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)

      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:597)

      at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)

      at $Proxy0.invoke(Unknown Source)

      at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)

      at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)

      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

      Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)

      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)

      at javax.naming.InitialContext.lookup(InitialContext.java:392)

      at org.jboss.seam.transaction.Transaction.getUserTransaction(Transaction.java:82)

      at org.jboss.seam.transaction.Transaction.createUTTransaction(Transaction.java:74)

      at org.jboss.seam.transaction.Transaction.getTransaction(Transaction.java:47)

      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:597)

      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)

      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)

      ... 71 more

       

       

      The test class

       

      import static org.testng.AssertJUnit.assertFalse;

      import org.jboss.seam.mock.SeamTest;
      import org.testng.annotations.Test;


      public class GuiGeschaeftActionTest extends SeamTest {
         

         
         @Test
          public void guiActionButtonTest() throws Exception {
            
              new FacesRequest("/auswahl.xhtml") {
                 
                 protected void updateModelValues() throws Exception {
                      // set form input to model attributes
                      setValue("#{GeschaeftDaten.selektierteNummer}", "10601");
                  }

                     // sollte scheitern

                  protected void invokeApplication() {

                       assertFalse("blub".equals(invokeMethod("#{GeschaeftDaten.guiActionButton}")));           
                  }
                 
                  protected void renderResponse()
                  {
                      assertEquals("selektierteNummer", "10601", getValue("#{GeschaeftDaten.selektierteNummer}"));
                  }

              }.run();
          }

      }

       

        • 1. Re: SeamTest javax.naming.NoInitialContextException
          nathandennis

          well the relavate information is right here ->java.lang.ClassNotFoundException: org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException

          so add the containing jar to your classpath and you are off to a different error message at least. i think it is jboss-ejb3.jar that contains that but dont quote me on it.