Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1475

Annotated WebListener not found if TomEE is started from symlinked directory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.1
    • 1.7.2
    • None
    • None
    • Linux

    Description

      I have a TomEE installation /opt/apache-tomee-plus-1.7.1. There is a symlink /opt/apache-tomee pointing to that directory. TomEE is started using this symlink as CATALINA_HOME and CATALINA_BASE. Then I have a webapp with an annotated WebListener. The class is inside the webapps WEB-INF/classes directory. However, the init listener never gets called in this scenario. If I set CATALINA_HOME/BASE to the "real" directory it works.
      I did a bit of debugging and the cause is the check in org.apache.tomee.catalina.OpenEJBContextConfig.internalProcessAnnotations, line 573. The "webAnnotated.name" contains the symlink in the path whereas "currentUrlAsFile" is the canonical path. The canonical path is not a part of the symlinked path and therefore the listeners does not get added.
      The root cause is probably org.apache.openejb.loader.JarLocation.jarLocation(Class). It should also return canonical paths to be consistent.
      This bug is pretty nasty because without hours of debugging you won't find the problem.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sithmein Thorsten Meinl
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: