[
https://issues.apache.org/jira/browse/TOMEE-1993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15795833#comment-15795833
]
Romain Manni-Bucau commented on TOMEE-1993:
-------------------------------------------
Hi Violeta,
I tested two common and important cases:
- webapps folder is a link
- the webapp folder itself (first level under webapps/) is a link
Both cases work.
As you reported the issue starts when in the webapp itself you have links.
There are multiple issues there:
- if tomcat is not configured to accept linking (allowLinking) then
org.apache.catalina.webresources.AbstractFileResourceSet#file will likely
return null and not let tomee check the file.
- if you use link which breaks the test "is this file in this folder" then
tomee will skip the @WebX class
At the moment I'm not sure it is that common and would likely prefer to not
browse the folder hierarchy to check for potential link for each @WebXXX.
Here an example:
{code}
/tmp/apache-tomee-webprofile-7.0.2/test/WEB-INF/classes/com/Boot.class
# linked to
/tmp/apache-tomee-webprofile-7.0.2/webapps/test/WEB-INF/classes/com/Boot.class
# but this folder exists
/tmp/apache-tomee-webprofile-7.0.2/webapps/test/WEB-INF/classes/com/
{code}
In the scanning we'll identify Boot.class in the folder
file:/tmp/apache-tomee-webprofile-7.0.2/webapps/test/WEB-INF/classes/. When
we'll test the class
/tmp/apache-tomee-webprofile-7.0.2/test/WEB-INF/classes/com/Boot.class to be in
the previous folder it will fail as expected and therefore the class will be
skipped. Issue is deeper than the referenced classes but clearly in the way
tomee scans (check org.apache.openejb.config.FinderFactory#urlByClass for
instance) which assume that root folder for packages are not split by sym link
(concretely WEB-INF/classes and WEB-INF/classes/* are not spli by symb links).
Ehanced it a bit to support previous case, hopefully it will match yours as
well.
> When using symbolic links the @WebServlet is not processed
> ----------------------------------------------------------
>
> Key: TOMEE-1993
> URL: https://issues.apache.org/jira/browse/TOMEE-1993
> Project: TomEE
> Issue Type: Bug
> Components: TomEE Core Server
> Affects Versions: 7.0.2
> Reporter: Violeta Georgieva
>
> Hi,
> @WebServlet is not processed when the web app files are symbolic links, but
> the root web app directory is not.
> The use case is the following:
> TomEE structure:
> {code}
> - TomEE root
> ...
> - webapps
> - myapp
> content -> /some/other/location/...
> {code}
> When the root of the app (in my case my app dir is not a symbolic link) then
> the war path will point to the location under TomEE directory.
> https://github.com/apache/tomee/blob/master/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java#L62
> Later when processing the @WebServlet the actual file path will point to
> "/some/other/location/..." but the "info.name" will point to the location
> under TomEE directory.
> https://github.com/apache/tomee/blob/master/tomee/tomee-catalina/src/main/java/org/apache/catalina/startup/OpenEJBContextConfig.java#L569
> If I change the symbolic link to the following:
> {code}
> - TomEE root
> ...
> - webapps
> - myapp -> /some/other/location
> content -> /some/other/location/...
> {code}
> Then everything is OK and the servlets are found.
> I'm reproducing this with TomEE 7.0.2 and I do not reproduce this behavior
> with TomEE 1.7.2
> Best Regards,
> Violeta Georgieva
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)