Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1490

Arquillian Test and Local context.xml file not loading correctly

    XMLWordPrintableJSON

Details

    Description

      When using a custom "webapp/META-INF/context.xml
      <Context>
      <Realm className="org.apache.catalina.realm.LockOutRealm">
      <Realm
      cdi="true"
      className="org.apache.tomee.catalina.realm.LazyRealm"
      realmClass="example.service.SecurityRealm" />
      </Realm>
      </Context>

      Then build the shrink wrap to include it in deployment:
      @Deployment(testable = true)
      public static WebArchive createDeployment() {
      WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
      .version("3.0");
      File[] files = new File("src/main/resources/META-INF").listFiles();
      WebArchive war = ShrinkWrap.create(WebArchive.class, "example.war")
      .setWebXML(new StringAsset(descriptor.exportAsString()))
      .addPackages(true, "example")
      .addAsManifestResource(new File("src/main/webapp/META-INF/context.xml"))
      .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
      for (File f : files)

      { war.addAsManifestResource(f); }

      System.out.println(war.toString(true));
      return war;
      }

      The following error is thrown (regardless the realm definition):
      Caused by: org.apache.catalina.LifecycleException: Failed to start component [Realm[LockOutRealm]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5373)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 99 more

      Attachments

        Activity

          People

            romain.manni-bucau Romain Manni-Bucau
            rmcguinness Ryan McGuinness
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: