コード例 #1
0
  // embeddeding implementation of sthg (JPA, JSF) can lead to classloading issues if we don't
  // enrich the webapp
  // with our integration jars
  // typically the class will try to be loaded by the common classloader
  // but the interface implemented or the parent class
  // will be in the webapp
  @Override
  public void start() throws LifecycleException {
    super.start(); // do it first otherwise we can't use this as classloader

    // mainly for tomee-maven-plugin
    initAdditionalRepos();
    if (additionalRepos != null && !additionalRepos.isEmpty()) {
      for (final File f : additionalRepos) {
        final DirResourceSet webResourceSet =
            new PremptiveDirResourceSet(resources, "/", f.getAbsolutePath(), "/");
        resources.addPreResources(webResourceSet);
      }
      resources.setCachingAllowed(false);
    }

    // add configurer enrichments
    if (configurer != null) {
      // add now we removed all we wanted
      final URL[] enrichment = configurer.additionalURLs();
      for (final URL url : enrichment) {
        super.addURL(url);
      }
    }

    // add internal enrichments
    for (final URL url : SystemInstance.get().getComponent(WebAppEnricher.class).enrichment(this)) {
      super.addURL(url);
    }

    // WEB-INF/jars.xml
    final File war = Contexts.warPath(CONTEXT.get());
    final File jarsXml = new File(war, "WEB-INF/" + QuickJarsTxtParser.FILE_NAME);
    final ClassLoaderConfigurer configurerTxt = QuickJarsTxtParser.parse(jarsXml);
    if (configurerTxt != null) {
      configurer = new CompositeClassLoaderConfigurer(configurer, configurerTxt);
    }

    stopped = false;
  }
コード例 #2
0
 public Collection<File> getAdditionalRepos() {
   initAdditionalRepos();
   return additionalRepos;
 }