3 Replies Latest reply on Aug 13, 2007 4:27 PM by Charles Crouch

    Problems running SeamTest's from mvn with Seam 2.0.0.Beta

    Charles Crouch Expert

      When I try running my tests that extend SeamTest from mvn I get the exception below. I've got \jboss-seam-2.0.0.BETA1\bootstrap\conf folder on the classpath as described in \jboss-seam-2.0.0.BETA1\seam2migration.txt. I don't have all the jars from \jboss-seam-2.0.0.BETA1\lib in the classpath because there is a boatload of them which can't be necessary [My app works great when I deploy it, the problem is just in getting the tests to run]. I do include jboss-embedded-all.jar and thirdparty-all.jar on the test classpath.

      Having googled around I found:

      http://jira.codehaus.org/browse/SUREFIRE-104

      and

      http://www.jboss.org/?module=bb&op=viewtopic&t=102426

      Anyone else seen this error? Know a workaround/fix?

      Thanks
      Charles


      DEBUG 27-07 07:06:20,969 (KernelFactory.java:assembleNewKernel:86) -Starting JBoss Kernel construction...
      DEBUG 27-07 07:06:22,441 (KernelFactory.java:assembleNewKernel:112) -Completed JBoss Kernel construction. Duration: 1452 milliseconds
      DEBUG 27-07 07:06:24,875 (BeanXMLDeployer.java:deploy:92) -Parsing file:/C:/code/target/test-classes/conf/bootstrap-beans.xml took 1583 milliseconds
      WARN 27-07 07:06:25,676 (UnifiedLoaderRepository3.java:addClassLoader:675) -Tried to add non-URLClassLoader. Ignored
      DEBUG 27-07 07:06:25,726 (ServiceController.java:preRegister:592) -Controller MBean online
      DEBUG 27-07 07:06:26,627 (MainDeployerImpl.java:addDeployer:206) -Added deployer: org.jboss.system.deployers.ServiceDeployer@bbaa16
      DEBUG 27-07 07:06:26,627 (MainDeployerImpl.java:addDeployer:206) -Added deployer: org.jboss.deployers.plugins.deployers.kernel.BeanDeployer@fe087b
      DEBUG 27-07 07:06:26,637 (MainDeployerImpl.java:addDeployer:206) -Added deployer: org.jboss.system.deployers.ServiceDeploymentDeployer@1def3f5
      DEBUG 27-07 07:06:26,637 (MainDeployerImpl.java:addDeployer:206) -Added deployer: org.jboss.system.deployers.SARDeployer@17aa55b
      DEBUG 27-07 07:06:26,637 (MainDeployerImpl.java:addDeployer:206) -Added deployer: org.jboss.deployers.plugins.deployers.kernel.BeanMetaDataDeployer@9ba045
      DEBUG 27-07 07:06:26,637 (MainDeployerImpl.java:addDeployer:206) -Added deployer: org.jboss.deployers.plugins.deployers.kernel.KernelDeploymentDeployer@62974e
      DEBUG 27-07 07:06:26,637 (MainDeployerImpl.java:addDeployer:206) -Added deployer: org.jboss.embedded.ClassLoaderDeployer@152f43b
      ERROR 27-07 07:06:27,188 (DeploymentScanner.java:start:113) -Failed to deploy
      org.jboss.deployers.spi.DeploymentException: Unable to get VirtualFile for url: file:/C:/code/target/test-classes/conf/jboss-service.xml
       at org.jboss.embedded.DeploymentGroup.getVirtualFile(DeploymentGroup.java:190)
       at org.jboss.embedded.DeploymentGroup.add(DeploymentGroup.java:176)
       at org.jboss.embedded.DeploymentGroup.addResource(DeploymentGroup.java:329)
       at org.jboss.embedded.DeploymentScanner.start(DeploymentScanner.java:85)
       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.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
       at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:108)
       at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:103)
       at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:145)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:197)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:136)
       at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:233)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:724)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:445)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:555)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:489)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:289)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:192)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:302)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:272)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:119)
       at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96)
       at org.jboss.embedded.Bootstrap.deployBaseBootstrapUrl(Bootstrap.java:150)
       at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:162)
       at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:201)
       at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:214)
       at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:919)
       at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:856)
       at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
       at org.jboss.demo.embedded.util.EmbeddedSeamHelper.init(EmbeddedSeamHelper.java:48)
       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:322)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:156)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:97)
       at org.testng.TestRunner.privateRun(TestRunner.java:693)
       at org.testng.TestRunner.run(TestRunner.java:574)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:241)
       at org.testng.SuiteRunner.run(SuiteRunner.java:145)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
       at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeTestNG(TestNGDirectoryTestSuite.java:195)
       at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:133)
       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:290)
       at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
      Caused by: java.net.MalformedURLException: unknown protocol: vfsfile
       at java.net.URL.<init>(URL.java:574)
       at java.net.URL.<init>(URL.java:464)
       at java.net.URL.<init>(URL.java:413)
       at org.jboss.virtual.plugins.context.file.FileHandler.<init>(FileHandler.java:75)
       at org.jboss.virtual.plugins.context.file.FileHandler.<init>(FileHandler.java:89)
       at org.jboss.virtual.plugins.context.file.FileSystemContext.createVirtualFileHandler(FileSystemContext.java:253)
       at org.jboss.virtual.plugins.context.file.FileSystemContext.createVirtualFileHandler(FileSystemContext.java:186)
       at org.jboss.virtual.plugins.context.file.FileSystemContext.<init>(FileSystemContext.java:150)
       at org.jboss.virtual.plugins.context.file.FileSystemContext.<init>(FileSystemContext.java:124)
       at org.jboss.virtual.plugins.context.file.FileSystemContext.<init>(FileSystemContext.java:113)
       at org.jboss.virtual.plugins.context.file.FileSystemContextFactory.getVFS(FileSystemContextFactory.java:54)
       at org.jboss.virtual.VFS.getVFS(VFS.java:132)
       at org.jboss.virtual.VFS.getRoot(VFS.java:146)
       at org.jboss.embedded.DeploymentGroup.getVirtualFile(DeploymentGroup.java:186)
       ... 57 more


        • 1. Re: Problems running SeamTest's from mvn with Seam 2.0.0.Bet
          Alexander Mischur Newbie

          Hi Charles,

          have you found a solution/workaround?

          If yes, can you post it?

          Regards Alex

          • 2. Re: Problems running SeamTest's from mvn with Seam 2.0.0.Bet
            Charles Crouch Expert

             

            "amischur" wrote:
            Hi Charles,

            have you found a solution/workaround?

            If yes, can you post it?

            Regards Alex


            Yeah I got this working. I'll write something up about it today.

            Cheers

            • 3. Re: Problems running SeamTest's from mvn with Seam 2.0.0.Bet
              Charles Crouch Expert

              Sorry its taken me so long to reply to this.

              So basically the steps that I needed to do were the following:

              public class SeamHelper extends SeamTest
              {
              ...
               @Override
               @BeforeClass
               public void init() throws Exception
               {
               // this is required to get vfs URLs (used by JBoss Embeddded) recognized
               // while executing the test
               org.jboss.net.protocol.URLStreamHandlerFactory factory
               = new org.jboss.net.protocol.URLStreamHandlerFactory();
               URL.setURLStreamHandlerFactory(factory);
              
               // set up anything else which is needed before Seam starts loading
              
               // do all the SeamTest set up
               super.init();
               }
              ...
              }


              Then I have my tests extend SeamHelper rather than SeamTest

              Then in src\test\resources I put a subset of files from the \bootstrap folder in jboss-seam-2.0.0.BETA1 distro (dont need all of them because not using EJB3 for example). The subset I needed were

              jndi.properties
              \conf\bootstrap-beans.xml
              \conf\jboss-service.xml
              \conf\jbossjta-properties.xml
              \conf\login-config.xml

              [Had to make changes to some of these files so as to remove the need for a deployers and deploy folder for example]

              Then in my pom.xml I have the following as test dependencies, again from the Seam distro:

              jboss-embedded-all.jar
              thirdparty-all.jar


              That should be it. Let me know how you get on.
              Cheers