3 Replies Latest reply on Mar 30, 2017 11:28 AM by julius278 Branched from an earlier discussion.

    Re: UI Scoped Class can't be tested

    mjobanek

      Hi Julius,

       

      please share also the whole stacktrace. I think that the main problem is with the class "com.vaadin.cdi.UIScoped" that it is not available inside of your container.

      If so, then you need to add also the Vadin dependencies into your deployment. Probably the easiest way is using ShrinkWrap Resolver. Try to change your deployment to:

       

      ShrinkWrap.create(WebArchive.class)
          .addClasses(BeispielKlasse.class, BeispielBean.class)
          .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
          .addAsLibraries(Maven
                             .resolver()
                             .loadPomFromFile("pom.xml")
                             .resolve("com.vaadin:vaadin-cdi")
                             .withTransitivity()
                             .asFile());
      

       

      Everything that you need to have in a container to make the app running you have to put it into the deployment.

      If there is to many stuff that you would need to add into the archive, then maybe the easier way is to build the project and create the archive and then deploy it using: ShrinkWrap.createFromZipFile

        • 1. Re: UI Scoped Class can't be tested
          julius278

          Oh, that was not what I wanted to do sry for "outsourcing" this article...

           

          Try to change your deployment to:

           

           

           

          1. ShrinkWrap.create(WebArchive.class
          2.     .addClasses(BeispielKlasse.class, BeispielBean.class
          3.     .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"
          4.     .addAsLibraries(Maven 
          5.                        .resolver() 
          6.                        .loadPomFromFile("pom.xml"
          7.                        .resolve("com.vaadin:vaadin-cdi"
          8.                        .withTransitivity() 
          9.                        .asFile()); 

           

          There is an error message at "Maven", I'm not sure why...

          • 2. Re: UI Scoped Class can't be tested
            mjobanek

            No problem :-).

             

            To use ShrinkWrap Resolver you need to add maven dependency into your pom.xml file:

             

            <dependency>
                <groupId>org.jboss.shrinkwrap.resolver</groupId>
                <artifactId>shrinkwrap-resolver-depchain</artifactId>
                <version>3.0.0-alpha-4</version>
                <type>pom</type>
            </dependency>
            

             

            Anyway, according to your exception, it doesn't seem to be this problem - there is no ClassNotFoundException.

            I would probably ask on Vaadin forum if they have any experience with it as the exception comes from Vaadin code.

            1 of 1 people found this helpful
            • 3. Re: UI Scoped Class can't be tested
              julius278

              Okay, I'm going to ask in the Vaadin forum, thanks for your help.