[ 
https://issues.apache.org/jira/browse/TOMEE-2503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Polina Georgieva updated TOMEE-2503:
------------------------------------
    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|http://%3Chost%3Eport/]

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:
{code:java}
              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);

                }
{code}
 

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|mailto:org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder@109d20f2]
 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

 

  was:
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|http://%3Chost%3Eport/]

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|mailto:org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder@109d20f2]
 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

 


> Implementation classes of javax.websocket.server.ServerApplicationConfig are 
> not found due to enabled metadata-complete flag
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TOMEE-2503
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2503
>             Project: TomEE
>          Issue Type: Bug
>            Reporter: Polina Georgieva
>            Priority: Major
>         Attachments: examples.zip
>
>
> 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|http://%3Chost%3Eport/]
> 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:
> {code:java}
>               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);
>                 }
> {code}
>  
> 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|mailto:org.apache.openejb.config.FinderFactory$OpenEJBAnnotationFinder@109d20f2]
>  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
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to