You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Pilkington, Simon" <si...@amazon.com> on 2015/03/17 17:45:14 UTC

[Tomcat8] What happened to WebappLoader.addRepository()?

Hey tomcat users,

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());
                   }
               }
               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?

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Mark Thomas <ma...@apache.org>.
On 17/03/2015 16:45, Pilkington, Simon wrote:
> Hey tomcat users,
> 
> 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:

<snip/>

>  addRepository(file.toURI().toString());

<snip/>

> Can the community help me figure out how to upgrade this for tomcat 8?

Look at the new resources implementation [1].

You probably want to use
org.apache.catalina.webresources.FileResourceSet with an webappMount of
"/WEB-INF/lib/name-of-jar.jar"

Mark


[1] http://tomcat.apache.org/tomcat-8.0-doc/config/resources.html



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Thusitha Thilina Dayaratne <th...@gmail.com>.
Hi,

On 21/04/2015 05:59, Thusitha Thilina Dayaratne wrote:
> Hi,
>
>> Try addURL().
>> Sorry for the inconvenience.
>> As I understand addURL() method is defined in WebAppClassLoaderBase. So
>> should I obtain the WebAppClassLoaderBase using getClassLoader() method
> and
>> use reflections to call the addURL() method?
>
>>> No need for reflection. Cast to URLClassloader.
>
>>> Note the cast *should* always work but if someone is using a strange
>>> custom class loader it will fail. Note that Tomcat 7 required the class
>>> loader to be an instance of WebappClassLoader.
>> Thanks for quick explanation Mark.
>> But still addURL() method is defined as protected. So it is not possible
> to call that method by casting right?
> This is my implementation with Tomcat 7
>
> public class CarbonWebappLoader extends WebappLoader {
>
> @Override
> protected void startInternal() throws LifecycleException {
> WebappClassloadingContext webappClassloadingContext;
> try {
> webappClassloadingContext =
> ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
> } catch (Exception e) {
> throw new LifecycleException(e.getMessage(), e);
> }
>
> for (String repository :
> webappClassloadingContext.getProvidedRepositories()) {
> addRepository(repository);
> }
>  super.startInternal();
>
> //Adding the WebappClassloadingContext to the WebappClassloader
> ((CarbonWebappClassLoader)
> getClassLoader()).setWebappCC(webappClassloadingContext);
> }
>
> In Tomcat 8 don't have addRepository() in the WebAppLoader. Suggestion was
> to use addURL() method.
> But that can be access through WebAppClassLoader. So I must get the
> classloader using getClassLoader() and use reflections to call addURL
> method.
> That would be really costly operation since it will get call for each and
> every application.
>
> Is there a better approach than that? Or Should I move this logic to
> somewhere else?

Thanks for the response.
>>It is worth considering other options. E.g.
>>a) Use the WebResources to map the JARs into WEB-INF/lib
I've tried to do so as follows.

File dir = new File(webappClassloadingContext.getProvidedRepositories()[0]);
WebResourceRoot resources = getContext().getResources();
resources.addJarResources(new DirResourceSet(resources, "/WEB-INF/lib",
dir.getAbsolutePath(), getContext().getPath()));
getContext().setResources(resources);

But then I get IllegalStateException

org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/jaxrs_basic]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
Mail Thread ->
http://mail-archives.apache.org/mod_mbox/tomcat-users/201504.mbox/%3CCANVncXDD7h49OztF=6a3u=+MR7=_WkdsSJyVqh98kioS8ZQsGA@mail.gmail.com%3E

What did I do wrong here?

>>b) Cache the method object so reflection calls are faster.
>>c) Ignore the performance issue since it only occurs on application start

I was able to fix that by overriding the addURL method and use that to add
repositories.

Thanks
Best Regards


2015-04-21 16:43 GMT+05:30 Mark Thomas <ma...@apache.org>:

> On 21/04/2015 05:59, Thusitha Thilina Dayaratne wrote:
> > Hi,
> >
> >> Try addURL().
> >> Sorry for the inconvenience.
> >> As I understand addURL() method is defined in WebAppClassLoaderBase. So
> >> should I obtain the WebAppClassLoaderBase using getClassLoader() method
> > and
> >> use reflections to call the addURL() method?
> >
> >>> No need for reflection. Cast to URLClassloader.
> >
> >>> Note the cast *should* always work but if someone is using a strange
> >>> custom class loader it will fail. Note that Tomcat 7 required the class
> >>> loader to be an instance of WebappClassLoader.
> >> Thanks for quick explanation Mark.
> >> But still addURL() method is defined as protected. So it is not possible
> > to call that method by casting right?
> > This is my implementation with Tomcat 7
> >
> > public class CarbonWebappLoader extends WebappLoader {
> >
> > @Override
> > protected void startInternal() throws LifecycleException {
> > WebappClassloadingContext webappClassloadingContext;
> > try {
> > webappClassloadingContext =
> > ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
> > } catch (Exception e) {
> > throw new LifecycleException(e.getMessage(), e);
> > }
> >
> > for (String repository :
> > webappClassloadingContext.getProvidedRepositories()) {
> > addRepository(repository);
> > }
> >  super.startInternal();
> >
> > //Adding the WebappClassloadingContext to the WebappClassloader
> > ((CarbonWebappClassLoader)
> > getClassLoader()).setWebappCC(webappClassloadingContext);
> > }
> >
> > In Tomcat 8 don't have addRepository() in the WebAppLoader. Suggestion
> was
> > to use addURL() method.
> > But that can be access through WebAppClassLoader. So I must get the
> > classloader using getClassLoader() and use reflections to call addURL
> > method.
> > That would be really costly operation since it will get call for each and
> > every application.
> >
> > Is there a better approach than that? Or Should I move this logic to
> > somewhere else?
>
> It is worth considering other options. E.g.
>
> a) Use the WebResources to map the JARs into WEB-INF/lib
> b) Cache the method object so reflection calls are faster.
> c) Ignore the performance issue since it only occurs on application start
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


--

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Mark Thomas <ma...@apache.org>.
On 21/04/2015 05:59, Thusitha Thilina Dayaratne wrote:
> Hi,
> 
>> Try addURL().
>> Sorry for the inconvenience.
>> As I understand addURL() method is defined in WebAppClassLoaderBase. So
>> should I obtain the WebAppClassLoaderBase using getClassLoader() method
> and
>> use reflections to call the addURL() method?
> 
>>> No need for reflection. Cast to URLClassloader.
> 
>>> Note the cast *should* always work but if someone is using a strange
>>> custom class loader it will fail. Note that Tomcat 7 required the class
>>> loader to be an instance of WebappClassLoader.
>> Thanks for quick explanation Mark.
>> But still addURL() method is defined as protected. So it is not possible
> to call that method by casting right?
> This is my implementation with Tomcat 7
> 
> public class CarbonWebappLoader extends WebappLoader {
> 
> @Override
> protected void startInternal() throws LifecycleException {
> WebappClassloadingContext webappClassloadingContext;
> try {
> webappClassloadingContext =
> ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
> } catch (Exception e) {
> throw new LifecycleException(e.getMessage(), e);
> }
> 
> for (String repository :
> webappClassloadingContext.getProvidedRepositories()) {
> addRepository(repository);
> }
>  super.startInternal();
> 
> //Adding the WebappClassloadingContext to the WebappClassloader
> ((CarbonWebappClassLoader)
> getClassLoader()).setWebappCC(webappClassloadingContext);
> }
> 
> In Tomcat 8 don't have addRepository() in the WebAppLoader. Suggestion was
> to use addURL() method.
> But that can be access through WebAppClassLoader. So I must get the
> classloader using getClassLoader() and use reflections to call addURL
> method.
> That would be really costly operation since it will get call for each and
> every application.
> 
> Is there a better approach than that? Or Should I move this logic to
> somewhere else?

It is worth considering other options. E.g.

a) Use the WebResources to map the JARs into WEB-INF/lib
b) Cache the method object so reflection calls are faster.
c) Ignore the performance issue since it only occurs on application start

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Thusitha Thilina Dayaratne <th...@gmail.com>.
Hi,

> Try addURL().
> Sorry for the inconvenience.
> As I understand addURL() method is defined in WebAppClassLoaderBase. So
> should I obtain the WebAppClassLoaderBase using getClassLoader() method
and
> use reflections to call the addURL() method?

>>No need for reflection. Cast to URLClassloader.

>>Note the cast *should* always work but if someone is using a strange
>>custom class loader it will fail. Note that Tomcat 7 required the class
>>loader to be an instance of WebappClassLoader.
>Thanks for quick explanation Mark.
>But still addURL() method is defined as protected. So it is not possible
to call that method by casting right?
This is my implementation with Tomcat 7

public class CarbonWebappLoader extends WebappLoader {

@Override
protected void startInternal() throws LifecycleException {
WebappClassloadingContext webappClassloadingContext;
try {
webappClassloadingContext =
ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
} catch (Exception e) {
throw new LifecycleException(e.getMessage(), e);
}

for (String repository :
webappClassloadingContext.getProvidedRepositories()) {
addRepository(repository);
}
 super.startInternal();

//Adding the WebappClassloadingContext to the WebappClassloader
((CarbonWebappClassLoader)
getClassLoader()).setWebappCC(webappClassloadingContext);
}

In Tomcat 8 don't have addRepository() in the WebAppLoader. Suggestion was
to use addURL() method.
But that can be access through WebAppClassLoader. So I must get the
classloader using getClassLoader() and use reflections to call addURL
method.
That would be really costly operation since it will get call for each and
every application.

Is there a better approach than that? Or Should I move this logic to
somewhere else?

Thanks
Best Regards

2015-04-07 16:19 GMT+05:30 Thusitha Thilina Dayaratne <
thusithathilina@gmail.com>:

> Hi,
>
> > Hi Mark,
> >
> > <snipe/>
>
> :)
> I think you meant snip rather than snipe.
>
> > Try addURL().
> > Sorry for the inconvenience.
> > As I understand addURL() method is defined in WebAppClassLoaderBase. So
> > should I obtain the WebAppClassLoaderBase using getClassLoader() method
> and
> > use reflections to call the addURL() method?
>
> >>No need for reflection. Cast to URLClassloader.
>
> >>Note the cast *should* always work but if someone is using a strange
> >>custom class loader it will fail. Note that Tomcat 7 required the class
> >>loader to be an instance of WebappClassLoader.
> Thanks for quick explanation Mark.
> But still addURL() method is defined as protected. So it is not possible
> to call that method by casting right?
>
>
>
> >
> >
> > Thanks
> > Best Regards
> >
> > On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas <ma...@apache.org> wrote:
> >
> >> On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
> >>> Hi All,
> >>>
> >>> I'm having the same issue. We have extend the WebAppLoader as follows
> in
> >>> the Tomcat 7
> >>>
> >>> public class CarbonWebappLoader extends WebappLoader {
> >>>     @Override
> >>>     protected void startInternal() throws LifecycleException {
> >>>         WebappClassloadingContext webappClassloadingContext;
> >>>         try {
> >>>             webappClassloadingContext =
> >>> ClassloadingContextBuilder.buildClassloadingContext(
> getWebappFilePath());
> >>>         } catch (Exception e) {
> >>>             throw new LifecycleException(e.getMessage(), e);
> >>>         }
> >>>
> >>>         //Adding provided classpath entries, if any
> >>>         for (String repository :
> >>> webappClassloadingContext.getProvidedRepositories()) {
> >>>             addRepository(repository);
> >>>         }
> >>>
> >>>         super.startInternal();
> >>>
> >>>         //Adding the WebappClassloadingContext to the WebappClassloader
> >>>         ((CarbonWebappClassLoader)
> >>> getClassLoader()).setWebappCC(webappClassloadingContext);
> >>>     }
> >>> }
> >>>
> >>> Since addRepository method have been removed, what could I do?
> >>
> >> Don't top-post.
> >>
> >> Read the thread history. The answer has already been provided by Chris.
> >>
> >> Mark
> >>
> >>
> >>>
> >>>
> >>> Thanks
> >>> Best Regards
> >>> /Thusitha
> >>>
> >>> On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org>
> wrote:
> >>>
> >>>> On 17/03/2015 18:30, Ed Rouse wrote:
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
> >>>>>> Sent: Tuesday, March 17, 2015 12:45 PM
> >>>>>> To: users@tomcat.apache.org
> >>>>>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
> >>>>>>
> >>>>>> Hey tomcat users,
> >>>>>>
> >>>>>> 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:
> >>>>>>
> >>>>>>
> >> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
> >>>>>>
> >> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
> >>>>>>
> >> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
> >>>>>>
> >> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
> >>>>>> _6HtfelAv3UYK2FRlJI-
> >>>>>>
> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >>>>>> IiNEEd598S-UrI1Lf5-sL
> >>>>>>
> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
> >>>>>> YqenASjqdQPhO-
> >>>>>>
> >> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
> >>>>>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
> >>>>>>
> >> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
> >>>>>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
> >>>>>>
> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >>>>>> IiNEEd598S-UrHrI5
> >>>>>>
> >>>>>>    @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());
> >>>>>>                    }
> >>>>>>                }
> >>>>>>                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?
> >>>>>
> >>>>> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
> >>>> file.getAbsolutePath(), "/");
> >>>>> Context.getResources().addPostResources(jrs);
> >>>>
> >>>> Bad idea. That will mount the contents of the JAR at the root of the
> web
> >>>> application.
> >>>>
> >>>> Mark
>
> Thanks
> Best regards
>
>
> 2015-04-07 15:46 GMT+05:30 Mark Thomas <ma...@apache.org>:
>
>> On 07/04/2015 09:27, Thusitha Thilina Dayaratne wrote:
>> > Hi Mark,
>> >
>> > <snipe/>
>>
>> :)
>> I think you meant snip rather than snipe.
>>
>> > Try addURL().
>> > Sorry for the inconvenience.
>> > As I understand addURL() method is defined in WebAppClassLoaderBase. So
>> > should I obtain the WebAppClassLoaderBase using getClassLoader() method
>> and
>> > use reflections to call the addURL() method?
>>
>> No need for reflection. Cast to URLClassloader.
>>
>> Note the cast *should* always work but if someone is using a strange
>> custom class loader it will fail. Note that Tomcat 7 required the class
>> loader to be an instance of WebappClassLoader.
>>
>> Mark
>>
>>
>> >
>> >
>> > Thanks
>> > Best Regards
>> >
>> > On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas <ma...@apache.org> wrote:
>> >
>> >> On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
>> >>> Hi All,
>> >>>
>> >>> I'm having the same issue. We have extend the WebAppLoader as follows
>> in
>> >>> the Tomcat 7
>> >>>
>> >>> public class CarbonWebappLoader extends WebappLoader {
>> >>>     @Override
>> >>>     protected void startInternal() throws LifecycleException {
>> >>>         WebappClassloadingContext webappClassloadingContext;
>> >>>         try {
>> >>>             webappClassloadingContext =
>> >>>
>> ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
>> >>>         } catch (Exception e) {
>> >>>             throw new LifecycleException(e.getMessage(), e);
>> >>>         }
>> >>>
>> >>>         //Adding provided classpath entries, if any
>> >>>         for (String repository :
>> >>> webappClassloadingContext.getProvidedRepositories()) {
>> >>>             addRepository(repository);
>> >>>         }
>> >>>
>> >>>         super.startInternal();
>> >>>
>> >>>         //Adding the WebappClassloadingContext to the
>> WebappClassloader
>> >>>         ((CarbonWebappClassLoader)
>> >>> getClassLoader()).setWebappCC(webappClassloadingContext);
>> >>>     }
>> >>> }
>> >>>
>> >>> Since addRepository method have been removed, what could I do?
>> >>
>> >> Don't top-post.
>> >>
>> >> Read the thread history. The answer has already been provided by Chris.
>> >>
>> >> Mark
>> >>
>> >>
>> >>>
>> >>>
>> >>> Thanks
>> >>> Best Regards
>> >>> /Thusitha
>> >>>
>> >>> On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org>
>> wrote:
>> >>>
>> >>>> On 17/03/2015 18:30, Ed Rouse wrote:
>> >>>>>
>> >>>>>
>> >>>>>> -----Original Message-----
>> >>>>>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
>> >>>>>> Sent: Tuesday, March 17, 2015 12:45 PM
>> >>>>>> To: users@tomcat.apache.org
>> >>>>>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
>> >>>>>>
>> >>>>>> Hey tomcat users,
>> >>>>>>
>> >>>>>> 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:
>> >>>>>>
>> >>>>>>
>> >>
>> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
>> >>>>>>
>> >> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
>> >>>>>>
>> >> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
>> >>>>>>
>> >> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
>> >>>>>> _6HtfelAv3UYK2FRlJI-
>> >>>>>>
>> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>> >>>>>> IiNEEd598S-UrI1Lf5-sL
>> >>>>>>
>> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
>> >>>>>> YqenASjqdQPhO-
>> >>>>>>
>> >> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
>> >>>>>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
>> >>>>>>
>> >> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
>> >>>>>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
>> >>>>>>
>> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>> >>>>>> IiNEEd598S-UrHrI5
>> >>>>>>
>> >>>>>>    @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());
>> >>>>>>                    }
>> >>>>>>                }
>> >>>>>>                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?
>> >>>>>
>> >>>>> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
>> >>>> file.getAbsolutePath(), "/");
>> >>>>> Context.getResources().addPostResources(jrs);
>> >>>>
>> >>>> Bad idea. That will mount the contents of the JAR at the root of the
>> web
>> >>>> application.
>> >>>>
>> >>>> Mark
>> >>>>
>> >>>>
>> >>>> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >>>> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> --
>
>



--

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Thusitha Thilina Dayaratne <th...@gmail.com>.
Hi,

> Hi Mark,
>
> <snipe/>

:)
I think you meant snip rather than snipe.

> Try addURL().
> Sorry for the inconvenience.
> As I understand addURL() method is defined in WebAppClassLoaderBase. So
> should I obtain the WebAppClassLoaderBase using getClassLoader() method
and
> use reflections to call the addURL() method?

>>No need for reflection. Cast to URLClassloader.

>>Note the cast *should* always work but if someone is using a strange
>>custom class loader it will fail. Note that Tomcat 7 required the class
>>loader to be an instance of WebappClassLoader.
Thanks for quick explanation Mark.
But still addURL() method is defined as protected. So it is not possible to
call that method by casting right?


>
>
> Thanks
> Best Regards
>
> On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
>>> Hi All,
>>>
>>> I'm having the same issue. We have extend the WebAppLoader as follows in
>>> the Tomcat 7
>>>
>>> public class CarbonWebappLoader extends WebappLoader {
>>>     @Override
>>>     protected void startInternal() throws LifecycleException {
>>>         WebappClassloadingContext webappClassloadingContext;
>>>         try {
>>>             webappClassloadingContext =
>>> ClassloadingContextBuilder.buildClassloadingContext(
getWebappFilePath());
>>>         } catch (Exception e) {
>>>             throw new LifecycleException(e.getMessage(), e);
>>>         }
>>>
>>>         //Adding provided classpath entries, if any
>>>         for (String repository :
>>> webappClassloadingContext.getProvidedRepositories()) {
>>>             addRepository(repository);
>>>         }
>>>
>>>         super.startInternal();
>>>
>>>         //Adding the WebappClassloadingContext to the WebappClassloader
>>>         ((CarbonWebappClassLoader)
>>> getClassLoader()).setWebappCC(webappClassloadingContext);
>>>     }
>>> }
>>>
>>> Since addRepository method have been removed, what could I do?
>>
>> Don't top-post.
>>
>> Read the thread history. The answer has already been provided by Chris.
>>
>> Mark
>>
>>
>>>
>>>
>>> Thanks
>>> Best Regards
>>> /Thusitha
>>>
>>> On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org> wrote:
>>>
>>>> On 17/03/2015 18:30, Ed Rouse wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
>>>>>> Sent: Tuesday, March 17, 2015 12:45 PM
>>>>>> To: users@tomcat.apache.org
>>>>>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
>>>>>>
>>>>>> Hey tomcat users,
>>>>>>
>>>>>> 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:
>>>>>>
>>>>>>
>> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
>>>>>>
>> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
>>>>>>
>> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
>>>>>>
>> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
>>>>>> _6HtfelAv3UYK2FRlJI-
>>>>>>
>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>>>>>> IiNEEd598S-UrI1Lf5-sL
>>>>>> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
>>>>>> YqenASjqdQPhO-
>>>>>>
>> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
>>>>>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
>>>>>>
>> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
>>>>>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
>>>>>>
>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>>>>>> IiNEEd598S-UrHrI5
>>>>>>
>>>>>>    @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());
>>>>>>                    }
>>>>>>                }
>>>>>>                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?
>>>>>
>>>>> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
>>>> file.getAbsolutePath(), "/");
>>>>> Context.getResources().addPostResources(jrs);
>>>>
>>>> Bad idea. That will mount the contents of the JAR at the root of the
web
>>>> application.
>>>>
>>>> Mark

Thanks
Best regards


2015-04-07 15:46 GMT+05:30 Mark Thomas <ma...@apache.org>:

> On 07/04/2015 09:27, Thusitha Thilina Dayaratne wrote:
> > Hi Mark,
> >
> > <snipe/>
>
> :)
> I think you meant snip rather than snipe.
>
> > Try addURL().
> > Sorry for the inconvenience.
> > As I understand addURL() method is defined in WebAppClassLoaderBase. So
> > should I obtain the WebAppClassLoaderBase using getClassLoader() method
> and
> > use reflections to call the addURL() method?
>
> No need for reflection. Cast to URLClassloader.
>
> Note the cast *should* always work but if someone is using a strange
> custom class loader it will fail. Note that Tomcat 7 required the class
> loader to be an instance of WebappClassLoader.
>
> Mark
>
>
> >
> >
> > Thanks
> > Best Regards
> >
> > On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas <ma...@apache.org> wrote:
> >
> >> On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
> >>> Hi All,
> >>>
> >>> I'm having the same issue. We have extend the WebAppLoader as follows
> in
> >>> the Tomcat 7
> >>>
> >>> public class CarbonWebappLoader extends WebappLoader {
> >>>     @Override
> >>>     protected void startInternal() throws LifecycleException {
> >>>         WebappClassloadingContext webappClassloadingContext;
> >>>         try {
> >>>             webappClassloadingContext =
> >>>
> ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
> >>>         } catch (Exception e) {
> >>>             throw new LifecycleException(e.getMessage(), e);
> >>>         }
> >>>
> >>>         //Adding provided classpath entries, if any
> >>>         for (String repository :
> >>> webappClassloadingContext.getProvidedRepositories()) {
> >>>             addRepository(repository);
> >>>         }
> >>>
> >>>         super.startInternal();
> >>>
> >>>         //Adding the WebappClassloadingContext to the WebappClassloader
> >>>         ((CarbonWebappClassLoader)
> >>> getClassLoader()).setWebappCC(webappClassloadingContext);
> >>>     }
> >>> }
> >>>
> >>> Since addRepository method have been removed, what could I do?
> >>
> >> Don't top-post.
> >>
> >> Read the thread history. The answer has already been provided by Chris.
> >>
> >> Mark
> >>
> >>
> >>>
> >>>
> >>> Thanks
> >>> Best Regards
> >>> /Thusitha
> >>>
> >>> On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org>
> wrote:
> >>>
> >>>> On 17/03/2015 18:30, Ed Rouse wrote:
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
> >>>>>> Sent: Tuesday, March 17, 2015 12:45 PM
> >>>>>> To: users@tomcat.apache.org
> >>>>>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
> >>>>>>
> >>>>>> Hey tomcat users,
> >>>>>>
> >>>>>> 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:
> >>>>>>
> >>>>>>
> >> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
> >>>>>>
> >> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
> >>>>>>
> >> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
> >>>>>>
> >> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
> >>>>>> _6HtfelAv3UYK2FRlJI-
> >>>>>>
> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >>>>>> IiNEEd598S-UrI1Lf5-sL
> >>>>>>
> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
> >>>>>> YqenASjqdQPhO-
> >>>>>>
> >> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
> >>>>>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
> >>>>>>
> >> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
> >>>>>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
> >>>>>>
> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >>>>>> IiNEEd598S-UrHrI5
> >>>>>>
> >>>>>>    @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());
> >>>>>>                    }
> >>>>>>                }
> >>>>>>                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?
> >>>>>
> >>>>> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
> >>>> file.getAbsolutePath(), "/");
> >>>>> Context.getResources().addPostResources(jrs);
> >>>>
> >>>> Bad idea. That will mount the contents of the JAR at the root of the
> web
> >>>> application.
> >>>>
> >>>> Mark
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


--

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Mark Thomas <ma...@apache.org>.
On 07/04/2015 09:27, Thusitha Thilina Dayaratne wrote:
> Hi Mark,
> 
> <snipe/>

:)
I think you meant snip rather than snipe.

> Try addURL().
> Sorry for the inconvenience.
> As I understand addURL() method is defined in WebAppClassLoaderBase. So
> should I obtain the WebAppClassLoaderBase using getClassLoader() method and
> use reflections to call the addURL() method?

No need for reflection. Cast to URLClassloader.

Note the cast *should* always work but if someone is using a strange
custom class loader it will fail. Note that Tomcat 7 required the class
loader to be an instance of WebappClassLoader.

Mark


> 
> 
> Thanks
> Best Regards
> 
> On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
>>> Hi All,
>>>
>>> I'm having the same issue. We have extend the WebAppLoader as follows in
>>> the Tomcat 7
>>>
>>> public class CarbonWebappLoader extends WebappLoader {
>>>     @Override
>>>     protected void startInternal() throws LifecycleException {
>>>         WebappClassloadingContext webappClassloadingContext;
>>>         try {
>>>             webappClassloadingContext =
>>> ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
>>>         } catch (Exception e) {
>>>             throw new LifecycleException(e.getMessage(), e);
>>>         }
>>>
>>>         //Adding provided classpath entries, if any
>>>         for (String repository :
>>> webappClassloadingContext.getProvidedRepositories()) {
>>>             addRepository(repository);
>>>         }
>>>
>>>         super.startInternal();
>>>
>>>         //Adding the WebappClassloadingContext to the WebappClassloader
>>>         ((CarbonWebappClassLoader)
>>> getClassLoader()).setWebappCC(webappClassloadingContext);
>>>     }
>>> }
>>>
>>> Since addRepository method have been removed, what could I do?
>>
>> Don't top-post.
>>
>> Read the thread history. The answer has already been provided by Chris.
>>
>> Mark
>>
>>
>>>
>>>
>>> Thanks
>>> Best Regards
>>> /Thusitha
>>>
>>> On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org> wrote:
>>>
>>>> On 17/03/2015 18:30, Ed Rouse wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
>>>>>> Sent: Tuesday, March 17, 2015 12:45 PM
>>>>>> To: users@tomcat.apache.org
>>>>>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
>>>>>>
>>>>>> Hey tomcat users,
>>>>>>
>>>>>> 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:
>>>>>>
>>>>>>
>> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
>>>>>>
>> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
>>>>>>
>> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
>>>>>>
>> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
>>>>>> _6HtfelAv3UYK2FRlJI-
>>>>>>
>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>>>>>> IiNEEd598S-UrI1Lf5-sL
>>>>>> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
>>>>>> YqenASjqdQPhO-
>>>>>>
>> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
>>>>>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
>>>>>>
>> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
>>>>>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
>>>>>>
>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>>>>>> IiNEEd598S-UrHrI5
>>>>>>
>>>>>>    @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());
>>>>>>                    }
>>>>>>                }
>>>>>>                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?
>>>>>
>>>>> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
>>>> file.getAbsolutePath(), "/");
>>>>> Context.getResources().addPostResources(jrs);
>>>>
>>>> Bad idea. That will mount the contents of the JAR at the root of the web
>>>> application.
>>>>
>>>> Mark
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Thusitha Thilina Dayaratne <th...@wso2.com>.
Hi Mark,

<snipe/>
> @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().
Sorry for the inconvenience.
As I understand addURL() method is defined in WebAppClassLoaderBase. So
should I obtain the WebAppClassLoaderBase using getClassLoader() method and
use reflections to call the addURL() method?


Thanks
Best Regards

On Tue, Apr 7, 2015 at 1:19 PM, Mark Thomas <ma...@apache.org> wrote:

> On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
> > Hi All,
> >
> > I'm having the same issue. We have extend the WebAppLoader as follows in
> > the Tomcat 7
> >
> > public class CarbonWebappLoader extends WebappLoader {
> >     @Override
> >     protected void startInternal() throws LifecycleException {
> >         WebappClassloadingContext webappClassloadingContext;
> >         try {
> >             webappClassloadingContext =
> > ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
> >         } catch (Exception e) {
> >             throw new LifecycleException(e.getMessage(), e);
> >         }
> >
> >         //Adding provided classpath entries, if any
> >         for (String repository :
> > webappClassloadingContext.getProvidedRepositories()) {
> >             addRepository(repository);
> >         }
> >
> >         super.startInternal();
> >
> >         //Adding the WebappClassloadingContext to the WebappClassloader
> >         ((CarbonWebappClassLoader)
> > getClassLoader()).setWebappCC(webappClassloadingContext);
> >     }
> > }
> >
> > Since addRepository method have been removed, what could I do?
>
> Don't top-post.
>
> Read the thread history. The answer has already been provided by Chris.
>
> Mark
>
>
> >
> >
> > Thanks
> > Best Regards
> > /Thusitha
> >
> > On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org> wrote:
> >
> >> On 17/03/2015 18:30, Ed Rouse wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
> >>>> Sent: Tuesday, March 17, 2015 12:45 PM
> >>>> To: users@tomcat.apache.org
> >>>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
> >>>>
> >>>> Hey tomcat users,
> >>>>
> >>>> 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:
> >>>>
> >>>>
> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
> >>>>
> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
> >>>>
> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
> >>>>
> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
> >>>> _6HtfelAv3UYK2FRlJI-
> >>>>
> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >>>> IiNEEd598S-UrI1Lf5-sL
> >>>> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
> >>>> YqenASjqdQPhO-
> >>>>
> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
> >>>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
> >>>>
> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
> >>>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
> >>>>
> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >>>> IiNEEd598S-UrHrI5
> >>>>
> >>>>    @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());
> >>>>                    }
> >>>>                }
> >>>>                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?
> >>>
> >>> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
> >> file.getAbsolutePath(), "/");
> >>> Context.getResources().addPostResources(jrs);
> >>
> >> Bad idea. That will mount the contents of the JAR at the root of the web
> >> application.
> >>
> >> Mark
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog      alokayasoya.blogspot.com
About    http://about.me/thusithathilina

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Mark Thomas <ma...@apache.org>.
On 07/04/2015 07:51, Thusitha Thilina Dayaratne wrote:
> Hi All,
> 
> I'm having the same issue. We have extend the WebAppLoader as follows in
> the Tomcat 7
> 
> public class CarbonWebappLoader extends WebappLoader {
>     @Override
>     protected void startInternal() throws LifecycleException {
>         WebappClassloadingContext webappClassloadingContext;
>         try {
>             webappClassloadingContext =
> ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
>         } catch (Exception e) {
>             throw new LifecycleException(e.getMessage(), e);
>         }
> 
>         //Adding provided classpath entries, if any
>         for (String repository :
> webappClassloadingContext.getProvidedRepositories()) {
>             addRepository(repository);
>         }
> 
>         super.startInternal();
> 
>         //Adding the WebappClassloadingContext to the WebappClassloader
>         ((CarbonWebappClassLoader)
> getClassLoader()).setWebappCC(webappClassloadingContext);
>     }
> }
> 
> Since addRepository method have been removed, what could I do?

Don't top-post.

Read the thread history. The answer has already been provided by Chris.

Mark


> 
> 
> Thanks
> Best Regards
> /Thusitha
> 
> On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 17/03/2015 18:30, Ed Rouse wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
>>>> Sent: Tuesday, March 17, 2015 12:45 PM
>>>> To: users@tomcat.apache.org
>>>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
>>>>
>>>> Hey tomcat users,
>>>>
>>>> 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:
>>>>
>>>> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
>>>> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
>>>> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
>>>> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
>>>> _6HtfelAv3UYK2FRlJI-
>>>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>>>> IiNEEd598S-UrI1Lf5-sL
>>>> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
>>>> YqenASjqdQPhO-
>>>> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
>>>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
>>>> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
>>>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
>>>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>>>> IiNEEd598S-UrHrI5
>>>>
>>>>    @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());
>>>>                    }
>>>>                }
>>>>                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?
>>>
>>> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
>> file.getAbsolutePath(), "/");
>>> Context.getResources().addPostResources(jrs);
>>
>> Bad idea. That will mount the contents of the JAR at the root of the web
>> application.
>>
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Thusitha Thilina Dayaratne <th...@wso2.com>.
Hi All,

I'm having the same issue. We have extend the WebAppLoader as follows in
the Tomcat 7

public class CarbonWebappLoader extends WebappLoader {
    @Override
    protected void startInternal() throws LifecycleException {
        WebappClassloadingContext webappClassloadingContext;
        try {
            webappClassloadingContext =
ClassloadingContextBuilder.buildClassloadingContext(getWebappFilePath());
        } catch (Exception e) {
            throw new LifecycleException(e.getMessage(), e);
        }

        //Adding provided classpath entries, if any
        for (String repository :
webappClassloadingContext.getProvidedRepositories()) {
            addRepository(repository);
        }

        super.startInternal();

        //Adding the WebappClassloadingContext to the WebappClassloader
        ((CarbonWebappClassLoader)
getClassLoader()).setWebappCC(webappClassloadingContext);
    }
}

Since addRepository method have been removed, what could I do?


Thanks
Best Regards
/Thusitha

On Wed, Mar 18, 2015 at 12:25 AM, Mark Thomas <ma...@apache.org> wrote:

> On 17/03/2015 18:30, Ed Rouse wrote:
> >
> >
> >> -----Original Message-----
> >> From: Pilkington, Simon [mailto:simonpi@amazon.com]
> >> Sent: Tuesday, March 17, 2015 12:45 PM
> >> To: users@tomcat.apache.org
> >> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
> >>
> >> Hey tomcat users,
> >>
> >> 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:
> >>
> >> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
> >> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
> >> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
> >> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
> >> _6HtfelAv3UYK2FRlJI-
> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >> IiNEEd598S-UrI1Lf5-sL
> >> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
> >> YqenASjqdQPhO-
> >> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
> >> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
> >> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
> >> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
> >> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> >> IiNEEd598S-UrHrI5
> >>
> >>    @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());
> >>                    }
> >>                }
> >>                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?
> >
> > JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/",
> file.getAbsolutePath(), "/");
> > Context.getResources().addPostResources(jrs);
>
> Bad idea. That will mount the contents of the JAR at the root of the web
> application.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog      alokayasoya.blogspot.com
About    http://about.me/thusithathilina

Re: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Mark Thomas <ma...@apache.org>.
On 17/03/2015 18:30, Ed Rouse wrote:
> 
> 
>> -----Original Message-----
>> From: Pilkington, Simon [mailto:simonpi@amazon.com]
>> Sent: Tuesday, March 17, 2015 12:45 PM
>> To: users@tomcat.apache.org
>> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
>>
>> Hey tomcat users,
>>
>> 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:
>>
>> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
>> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
>> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
>> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
>> _6HtfelAv3UYK2FRlJI-
>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>> IiNEEd598S-UrI1Lf5-sL
>> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
>> YqenASjqdQPhO-
>> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
>> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
>> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
>> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
>> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
>> IiNEEd598S-UrHrI5
>>
>>    @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());
>>                    }
>>                }
>>                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?
> 
> JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/", file.getAbsolutePath(), "/");
> Context.getResources().addPostResources(jrs);

Bad idea. That will mount the contents of the JAR at the root of the web
application.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: [Tomcat8] What happened to WebappLoader.addRepository()?

Posted by Ed Rouse <er...@milner.com>.

> -----Original Message-----
> From: Pilkington, Simon [mailto:simonpi@amazon.com]
> Sent: Tuesday, March 17, 2015 12:45 PM
> To: users@tomcat.apache.org
> Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
> 
> Hey tomcat users,
> 
> 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:
> 
> http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
> 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
> LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
> lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
> _6HtfelAv3UYK2FRlJI-
> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> IiNEEd598S-UrI1Lf5-sL
> http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
> YqenASjqdQPhO-
> YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
> qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
> Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
> 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
> Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
> IiNEEd598S-UrHrI5
> 
>    @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());
>                    }
>                }
>                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?

JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/", file.getAbsolutePath(), "/");
Context.getResources().addPostResources(jrs);

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org