1 2 Previous Next 15 Replies Latest reply on May 1, 2013 9:41 AM by hukkahukka

    Resolving: web.xml not found in classloader

    hukkahukka

      I'm attempting to work around a non-existent Seam conversation context when attempting to utilize builder components in my setup for a Selenium (WebDriver) UI test.

       

      I'm working with this as a solution: https://docs.jboss.org/author/display/ARQ/Seam+2, but am getting the following as the root cause in my stack:

       

      Caused by: java.lang.IllegalArgumentException: WEB-INF/web.xml not found in classloader sun.misc.Launcher$AppClassLoader@3182f0db

          at org.jboss.shrinkwrap.api.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:70)

          at org.jboss.shrinkwrap.api.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:45)

          at org.jboss.shrinkwrap.impl.base.container.WebContainerBase.setWebXML(WebContainerBase.java:94)

          ... 55 more

       

      The only web.xml location is in another project outside of the qa, but is referenced as a dependency in the pom.

       

      This tech stack is new to me and I realise this is vague.  What other information would I need to provide in order to get some useful feedback on this? 

       

      Thanks!

        • 1. Re: Resolving: web.xml not found in classloader
          bmajsak

          How does your deployment method look like? You need to include web.xml in order to have seam2 bootstrapped. Here's running example

          • 2. Re: Resolving: web.xml not found in classloader
            hukkahukka

            Appreciate the response.

             

            It looks like the example I linked to in my original post and yours, less the class I am using to inject.  I noticed in your example the additional package addition for Jboss.  I gave it a whirl, but no different.

             

            It is important to note that the Jboss version I am stuck with is 5.1.0.GA

             

            Edit:

             

            Possibly because things were out of sync, but I now recieve this:

             

            java.lang.IllegalAccessError: tried to access method org.junit.runners.ParentRunner.getTestClass()Lorg/junit/runners/model/TestClass; from class org.jboss.arquillian.junit.Arquillian$3$1

                at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:204)

                at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

                at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

                at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:220)

                at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)

                at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

            • 3. Re: Resolving: web.xml not found in classloader
              hukkahukka

              Disregard the edit in the above reply.  It was mostly unrelated and had an obvious fix.

               

              The original issue still remains, however.

              • 4. Re: Resolving: web.xml not found in classloader
                bmajsak

                Christopher Hukka wrote:

                 

                It is important to note that the Jboss version I am stuck with is 5.1.0.GA

                I will try to investigate 5.1.0.GA adapter with the latest Arquillian Core. Will keep you posted.

                 

                Christopher Hukka wrote:

                 

                The only web.xml location is in another project outside of the qa, but is referenced as a dependency in the pom.

                What do you mean by that? You include the whole WAR pre-build? Can you share your test class?

                • 5. Re: Resolving: web.xml not found in classloader
                  bmajsak

                  Moved from Arquillian Development to Arquillian, as it's the place for such threads.

                  • 6. Re: Resolving: web.xml not found in classloader
                    hukkahukka

                    Bartosz Majsak wrote:

                     

                    What do you mean by that? You include the whole WAR pre-build?

                    All of this is in a dedicated QA project and Maven installs the WAR when doing a clean build.  If it is of any importance, I run this as a junit test in eclipse.

                     

                    Bartosz Majsak wrote:

                     

                    Can you share your test class?

                     

                    import static org.junit.Assert.assertNotNull;

                     

                    import org.jboss.arquillian.container.test.api.Deployment;

                    import org.jboss.arquillian.junit.Arquillian;

                    import org.jboss.seam.annotations.In;

                    import org.jboss.shrinkwrap.api.Archive;

                    import org.jboss.shrinkwrap.api.ShrinkWrap;

                    import org.jboss.shrinkwrap.api.asset.EmptyAsset;

                    import org.jboss.shrinkwrap.api.spec.WebArchive;

                    import org.junit.Test;

                    import org.junit.runner.RunWith;

                     

                    import com.name.product.SomeDriver;

                     

                    @RunWith(Arquillian.class)

                    public class someTest {

                     

                        @Deployment

                        public static Archive<?> createDeployment() {

                            return ShrinkWrap.create(WebArchive.class, "test.war")

                                    .addClass(SomeDriver.class)

                                    .addPackages(true, "org.fest")

                                    .addPackages(true, "org.dom4j")

                                    .addAsResource(EmptyAsset.INSTANCE, "seam.properties")

                                    .setWebXML("web.xml");

                        }

                     

                        @In

                        SomeDriver defaultDriver;

                     

                        @Test

                        public void shouldInjectSeamComponent() throws Exception {

                            assertNotNull(defaultDriver);

                        }

                    }

                    Bartosz Majsak wrote:

                     

                    Moved from Arquillian Development to Arquillian, as it's the place for such threads.

                    Thanks, wasn't paying attention.

                    • 7. Re: Resolving: web.xml not found in classloader
                      bmajsak

                      I believe you can't do .setWebXML("web.xml"); without having the file on the classpath with seam-related configuration in it. Pleasy try to extract it from your WAR and put under src/test/resources for instance, so that Shrinkwrap can pick it up from the classpath and include in your test deployment.

                      • 8. Re: Resolving: web.xml not found in classloader
                        hukkahukka

                        Great, that got me through.  Will have to do for now.  Really appreciate the help.

                         

                        New issue, however.  Any thoughts on this?:

                         

                        org.jboss.arquillian.container.test.impl.client.deployment.ValidationException: DeploymentScenario contains a target (_DEFAULT_) not matching any defined Container in the registry.

                        Please include at least 1 Deployable Container on your Classpath.

                            at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.throwNoContainerFound(DeploymentGenerator.java:247)

                            at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.throwTargetNotFoundValidationException(DeploymentGenerator.java:240)

                            at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.validate(DeploymentGenerator.java:102)

                            at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:84)

                            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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                            at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                            at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                            at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                            at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                            at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                            at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)

                            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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                            at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                            at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                            at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)

                            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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                            at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                            at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

                            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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                            at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                            at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                            at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                            at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)

                            at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)

                            at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

                            at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

                            at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

                            at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

                            at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)

                            at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                            at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

                        • 9. Re: Resolving: web.xml not found in classloader
                          bmajsak

                          Could you please attach your pom.xml and arquillian.xml ?

                          You can also have a look at this thread, maybe it will help.

                          • 10. Re: Resolving: web.xml not found in classloader
                            hukkahukka

                            I do not use an arquillian.xml (should I?) and this qa pom is HUGE (many dependencies, profiles, etc).

                             

                            I will try to see what I can provide from the pom.  What exactly is of interest?

                             

                            Sorry to be difficult.

                            • 11. Re: Resolving: web.xml not found in classloader
                              bmajsak

                              Christopher Hukka wrote:

                               

                              Sorry to be difficult.

                              Hey no worries! That's exactly the reason why we have the community and the forum - to help each other.

                               

                              The main concern is how the arquillian profile (and container adapter) is configured. This is the sample one for 5.1 (look also at the pom.xml for the profile configuration).

                              Also if you run it from Eclipse please make sure the profile is activated. It is most likely the reason why you are now facing such exception.

                              • 12. Re: Resolving: web.xml not found in classloader
                                hukkahukka

                                Thanks for the links.  Seeing that our WebDriver tests have been successfully running with Arquillian for a while, I thought this was a simple addition.  Looks like there are a few things that need to be reworked to mimic the arquillian.xml and pom in order to pull this off.  It's probably pretty clear that I'm hit or miss on understanding how all of this comes together.

                                 

                                PM'd the pom btw.  Probably overkill, but didn't want anything sensative to leak.

                                • 13. Re: Resolving: web.xml not found in classloader
                                  bmajsak

                                  Thanks, I will have a look.

                                   

                                  But this got me thinking.

                                  @In

                                      SomeDriver defaultDriver;

                                   

                                  Is it WebDriver implementation you want to inject and excercise your application from the client side?

                                   

                                  If so that is not the right approach. You should use Drone extension for that.

                                  • 14. Re: Resolving: web.xml not found in classloader
                                    hukkahukka

                                    The 'drivers' I want to use set-up data in our application utilizing Entity Managers, the same ones used in our unit tests.

                                     

                                    I am attempting to also utilize them here to place the application in a particular 'state' so UI testing can commence (this is an effort to avoid having WebDriver being responsible for using the UI to set things up from scratch).

                                     

                                    Perhaps this is the wrong approach?

                                    1 2 Previous Next