-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Simon,
On 3/17/15 12:45 PM, Pilkington, Simon wrote: > The javadoc for WebappLoader still tells me to use addRepository(), > but that method no longer exists. My team has implemented an > extension of WebappLoader that looked like this: > > https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/loader/WebappLoader.html > > https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/loader/WebappLoader.html > > @Override protected void startInternal() throws LifecycleException > { // validate the context, which is used for debugging messages > Context context; { Container container = getContainer(); if > (container == null) { throw new LifecycleException("Container is > null?!"); } if (!(container instanceof Context)) { throw new > LifecycleException("Container is not an instance of Context?!"); } > context = (Context) container; } > > if (ENVIRONMENT_ROOT != null && ENVIRONMENT_ROOT.length() > 0) { // > validate targetPackage if (null == targetPackage) { throw new > LifecycleException( "Missing required Loader attribute > \"targetPackage\" in Context configuration " + > context.getConfigFile()); } > > try { // Excluded jars are those already pulled in by tomcat. > Set<String> allExcludedJars = getAllExcludedJars(); Set<String> > reallyExcludedJars = new HashSet<String>(); // add JARs from target > package as "repositories" // getPackageClasspath finds the list of > jars I want to include for this webapp. for (String jar : > getPackageClasspath(targetPackage)) { File file = new > File(ENVIRONMENT_ROOT, jar); // skip bad and unwanted JARs if > (allExcludedJars.contains(jar) || isBadJar(file)) { > reallyExcludedJars.add(jar); } else { // TODO: HOW TO FIX ME?? > addRepository(file.toURI().toString()); Try addURL(). > } } log.info("Context path \"" + context.getPath() + "\" excluding > JARs: " + reallyExcludedJars); } catch (IOException e) { throw new > LifecycleException( "Problem setting classpath for context path \"" > + context.getPath() + "\"", e); } > > // getRepositoriesString() has been renamed to > getLoaderRepositoriesString()... log.info("Context path \"" + > context.getPath() + "\" using classpath: " + > getRepositoriesString()); } else { log.warning("MyWebappLoader > seems to be used outside of my environment. Delegating to > parent."); } > > super.startInternal(); } > > Can the community help me figure out how to upgrade this for tomcat > 8? - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJVCGiJAAoJEBzwKT+lPKRYEAMQAKQfIesZ/xJpQNeIZBlNJkLZ TRDfBR0rgwcyPGnEOFklj90iIhh0VDcpe/StVzK7XI1/2MjeRCMfb6DdrAbz/lFh mm5wOuBQ76eY8HqF7/BPX525rvaB89O5bs0dI7kLvtUHNn7trvcnD80YVvSB7g7Y 9tbbNIJGbCPkcqLnD6CLXJtYM0bXo17s8VeyRepqjmXkuKEdWutCDIE1BO1TAPi4 rMA5KesRTrpC289ZCwt8E6uD6DhKc5rGj+V0lrT3X0tLr8nzY70io+4uwoxQjfkQ QBcO9lzDJWAchM1gx71+0KZCmSlmGR5pWHGt5ysfaSh/20dtB86Qtd3zg+Q22pfH bakBde8c120PVez/sD9FlFElwKaC6DnBcNwUpfGa2c5RHJaRzpPh/Lhm1QbF1v7L hmNmlz6C0fBy2N2bXH4p38sz+uP1nH+4TrgoH9gOCRnSe3WhjWyhljsllJQt77Oc gtflvUqsBNtnOVt1OhViSlM6LLzqyKKj7SeagCn3ZuJ4o0MUODznXt+J4m24/gTT VbThvj+IfDpvCupswhiosPq6ZIHy6Uz2Ki7BNwQGlFHsPpaSR/1fm/Bn1Nrghraw jG5Q8yId1B+TeXvnRiZj2IfOkoFK2uY52nH6S8e7Vj2lt3D9PrsTjO6prfEcvSHF 9jX+M5GIgX7DAm5o9ox/ =xMdv -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org