On 18/11/2014 16:50, Ed Rouse wrote:
> 
> 
>> -----Original Message-----
>> From: Mark Thomas [mailto:ma...@apache.org]
>> Sent: Tuesday, November 18, 2014 5:59 AM
>> To: Tomcat Users List
>> Subject: Re: DirResourceSet
>>
>> On 17/11/2014 22:52, Ed Rouse wrote:
>>> I have 2 different issues setting up a DirResourceSet. I have an
>>> external war file I am trying to merge into the Root of my
>>> application. I have a custom root that extends StandardRoot.
>>>
>>>
>>> 1.       DirResourceSet drs = new DirResourceSet(wsRoot,
>>> "/WEB-INF/classes/", possible.getAbsolutePath() + "/classes/", "/");
>>>
>>> This only seems to give me the top level directory of the classes
>>> directory as indicated by drs.listWebAppPaths("/WEB-INF/classes/").
>>> Is there a way to get it to be recursive or is it just that the
>>> listWebAppPaths doesn't show it even though it actually does it?
>>
>> A DirResourceSet will include all resources recursively under the
>> directory that is defined as the "top" of the resource set.
>>
>> I'm not sure if it really matters (I'd need to to back and review the
>> code carefully) but I'd remove the trailing slashes from those
>> directories. i.e. the above would be:
>>
>> DirResourceSet(wsRoot,
>>                "/WEB-INF/classes",
>>                possible.getAbsolutePath() + "/classes",
>>                "/");
>>
>>> 2.       The reason I can't check the first is because this one gives
>>> me an exception.
>>>
>>> DirResourceSet drs = new DirResourceSet(wsRoot, "/" +
>>> possible.getName(), possible.getAbsolutePath(), "/" +
>>> possible.getName());
>>
>> That doesn't look right. I'd expect the internalPath for a
>> DirResourceSet to always be "/". internalPath is really intended for
>> JAR files where the resources you want to include might not be located
>> at the root of the JAR.
>>
>> Something to consider is removing that parameter from the
>> DirResourceSet constructor and other constructors where it is unlikely
>> to be needed.
>>
>> Mark
>>
>>
>>  It looks like the one that seems to work but I
>>> get a:
>>>
>>> SEVERE [localhost-startStop-1] null.null Error setting up class path
>>>
>>> java.lang.IllegalStateException:
>>> org.apache.catalina.LifecycleException: Failed to initialize
>> component
>>> [org.apache.catalina.webresources.DirResourceSet@6a38848c]
>>>
>>> at
>>>
>> org.apache.catalina.webresources.DirResourceSet.<init>(DirResourceSet.
>>> java:83)
>>>
>>>  I have tried to follow through the source but keep getting lost.
>>> Line 83 is when it calls Start on StandardRoot. Is it because it was
>>> already started by the first call? But then how would you add in
>>> multiple resources?
>>>
>>>
>>>
>>> I would like to step through it in debug mode, but the test server is
>>> remote and I don't know how to set up remote debugging. And it's
>>> remote due to other required resources that are not able to run
>>> locally.
>>>
>>>
>>>
>>> Thanks for the help.
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> I finally figured it out. Everything I was doing was correct, but during all 
> of the changes I was making I accidentally removed the root.addPostResources 
> for that set. D'oh.
> 
> Sorry about that and thanks for all the help guys.

Glad you got it all working.

No need to apologise. Happy to help. Thanks for prompting the thought
about cleaning up the API for DirResourceSet.

Mark


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

Reply via email to