0 Replies Latest reply on Mar 24, 2010 10:58 PM by IVAN BATISTA MORENO

    Starting with JUnit framework for testing

    IVAN BATISTA MORENO Newbie

      How do I start the JBoss Seam context without being in a contaner web, I have unit tests for components of business and I do not sample, so tests meeting held in JSF. I'm trying to use something like this:


      startSeam();
      session = (Session) getInitialContext().lookup("hibernateSession");
      getInitialContext().lookup("usuarioBO");
      stopSeam();




      and of the following error:


      javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.JBossRemotingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.JBossRemotingContextFactory]
              at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
              at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
              at javax.naming.InitialContext.init(Unknown Source)
              at javax.naming.InitialContext.<init>(Unknown Source)
              at org.jboss.seam.util.Naming.getInitialContext(Naming.java:37)
              at org.jboss.seam.util.Naming.initInitialContext(Naming.java:59)
              at org.jboss.seam.util.Naming.getInitialContext(Naming.java:50)
              at org.jboss.seam.mock.AbstractSeamTest.getInitialContext(AbstractSeamTest.java:988)
              at br.gov.sas.core.test.UsuarioBOTest.testSaveUsuario(UsuarioBOTest.java:21)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
              at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
              at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
              at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
              at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
              at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
              at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
              at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
              at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
              at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
              at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
              at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.lang.ClassNotFoundException: org.jboss.naming.JBossRemotingContextFactory
              at java.net.URLClassLoader$1.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
              at java.lang.ClassLoader.loadClass(Unknown Source)
              at java.lang.ClassLoader.loadClassInternal(Unknown Source)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Unknown Source)
              at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
              ... 29 more