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

Implementation classes of javax.websocket.server.ServerApplicationConfig are not found due to enabled metadata-complete flag

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Hi,

      When the web deployment descriptor's flag metadata-complete is enabled, any implementation classes of javax.websocket.server.ServerApplicationConfig are not found and hence the programmatic websocket endpoint registration is not working.

       

      Steps to reproduce:

      Use the example application (standard examples application distributed with Tomcat v.8.5.34):

      Request http://<host>:<port>/examples/websocket/echo.xhtml

      Then check the "programmatic API" option and click on "Connect" button.

      The following error is received: Info: WebSocket connection closed, Code: 1006 is returned.

       

      I think the following code is responsible for this (based on Tomee sources v.7.0.4):

      • In org.apache.openejb.config.DeploymentLoader. addWebModule(final WebModule webModule, final AppModule appModule) method (line 872)

      the following check is made:

                    if (isMetadataComplete(webModule, webEjbModule)) {
      
                          final IAnnotationFinder finder = new org.apache.xbean.finder.AnnotationFinder(new ClassesArchive());  -> [case 1]
      
                          webModule.setFinder(finder);
      
                          webEjbModule.setFinder(finder);
      
                      } else {
      
                          final IAnnotationFinder finder = FinderFactory.createFinder(webModule);  -> [case 2]
      
                          webModule.setFinder(finder);
      
                          webEjbModule.setFinder(finder);
      
                      }
      

       

      Case 1  (metadata-complete=true): org.apache.xbean.finder.AnnotationFinder instance is set to the web application - with empty classInfos map.

      Case 2  (metadata-complete= false): org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder instance with non empty classInfos (containing ServerApplicationConfig)

      •  Later in org.apache.catalina.startup.OpenEJBContextConfig.processServletContainerInitializers() method (line 543):

      Case 1  (metadata-complete=true): finder cannot find any implementation classes and the org.apache.tomcat.websocket.server.WsSci intiatilizer has nothing to process

      Case 2  (metadata-complete= false): correct implementation class found and mapped to the WsSci intiatilizer => everything works as expected

       

      In my opinion the metadata-complete flag should not affect the finding of implementation classes and they should always be available regardless of the flag's value.

      Note that the reported problems applies for other standard Java EE interfaces (for example: interface javax.faces.event.PhaseListener, interface javax.faces.convert.Converter, interface javax.faces.validator.Validator etc.) so I expect other scenarios to be broken as well.

      Best Regards,

      Polina

       

        Attachments

        1. examples.zip
          692 kB
          Polina Georgieva

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              poli.georgieva Polina Georgieva
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: