RE: Migrating from Tomcat 9.0.x to 10.1.x

2024-04-05 Thread Amit Pande
Thank you, Chris, for the feedback.

The changes are needed in the Spring WebSocket library to ensure Tomcat 10.1 
compatibility.
https://github.com/spring-projects/spring-framework/pull/29434

As I understand, this means I should be updating the Spring libraries used in 
the applications to be deployed with Tomcat 10.1.

I was exploring the possibility of performing Tomcat 10 upgrade independent of 
the upgrades of TPIPs used the application (mainly Spring 5 to 6). And using 
migration tool seemed a very promising approach.
Now looking at issue like this, seems like it's ideal to have both Tomcat 
upgrade and the application TPIPs upgrade go together.

Thanks,
Amit


-Original Message-
From: Christopher Schultz 
Sent: Thursday, April 4, 2024 9:37 PM
To: users@tomcat.apache.org
Subject: Re: Migrating from Tomcat 9.0.x to 10.1.x


CAUTION: This email originated from outside the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe. If you believe this is a phishing email, use the Report to 
Cybersecurity icon in Outlook.



Amit,

On 4/4/24 22:21, Amit Pande wrote:
> I am in the process of migrating from Tomcat 9 (9.0.87) to Tomcat 10.1 
> (10.1.20).
>
> https://tomcat.apache.org/migration-10.1.html Using the migration tool, I 
> have migrated the applications (which use Spring libraries 5.x).
>
> While testing the migrated apps( which use web socket), ran into:
>
>
> org.springframework.web.util.NestedServletException: Handler dispatch
> failed; nested exception is java.lang.NoSuchMethodError: 'void
> org.apache.tomcat.websocket.server.WsServerContainer.doUpgrade(jakarta
> .servlet.http.HttpServletRequest,
> jakarta.servlet.http.HttpServletResponse,
> jakarta.websocket.server.ServerEndpointConfig, java.util.Map)
>
>
> https://gith/
> ub.com%2Fapache%2Ftomcat%2Fblob%2F9.0.x%2Fjava%2Forg%2Fapache%2Ftomcat
> %2Fwebsocket%2Fserver%2FWsServerContainer.java=05%7C02%7CAmit.Pan
> de%40veritas.com%7C2650bfb140d94911624408dc55195c23%7Cfc8e13c0422c4c55
> b3eaca318e6cac32%7C0%7C0%7C638478814607427868%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0
> %7C%7C%7C=w69RggozFPZcifxDJOHnII9jtZJJ29qZQSkDNNFYTzE%3D
> d=0
>
> * @deprecated This method will be removed in Apache Tomcat 10.1 onwards. 
> It has been replaced by
>   * {@link #upgradeHttpToWebSocket(Object, Object, 
> ServerEndpointConfig, Map)}
>   */
>  @Deprecated
>  public void doUpgrade(HttpServletRequest request, HttpServletResponse 
> response, ServerEndpointConfig sec,
>  Map pathParams) throws ServletException, 
> IOException {
>  UpgradeUtil.doUpgrade(this, request, response, sec, pathParams);
>  }
>
> Is this an issue with the migration tool to appropriately replace the removed 
> methods?
>
> Or the applications using web sockets with Tomcat 9.x are required to be 
> updated before moving to Tomcat 10.1, instead of using the migration tool as 
> an intermediate step to upgrade to Tomcat 10.1 without having to update the 
> applications at the same time?
> FWIW, Spring 5 to Spring 6 is a major upgrade and Tomcat 10 is a requirement.

The Migration Tool doesn't rewrite your code, it only rewrites the class names 
referenced by your class files. (Okay, it also re-writes strings in your files 
which match those class names as well.) But it will not change method calls. It 
is not a Deprecation Cleanup Tool.

You should change your Java EE-compatible application to use 
upgradeHttpToWebSocket(Object, Object, ServerEndpointConfig, Map) first, then 
run the Migration Tool on your application.

-chris

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


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



Re: Migrating from Tomcat 9.0.x to 10.1.x

2024-04-04 Thread Christopher Schultz

Amit,

On 4/4/24 22:21, Amit Pande wrote:

I am in the process of migrating from Tomcat 9 (9.0.87) to Tomcat 10.1 
(10.1.20).

https://tomcat.apache.org/migration-10.1.html Using the migration tool, I have 
migrated the applications (which use Spring libraries 5.x).

While testing the migrated apps( which use web socket), ran into:


org.springframework.web.util.NestedServletException: Handler dispatch failed; 
nested exception is java.lang.NoSuchMethodError: 'void 
org.apache.tomcat.websocket.server.WsServerContainer.doUpgrade(jakarta.servlet.http.HttpServletRequest,
 jakarta.servlet.http.HttpServletResponse, 
jakarta.websocket.server.ServerEndpointConfig, java.util.Map)


https://github.com/apache/tomcat/blob/9.0.x/java/org/apache/tomcat/websocket/server/WsServerContainer.java

* @deprecated This method will be removed in Apache Tomcat 10.1 onwards. It 
has been replaced by
  * {@link #upgradeHttpToWebSocket(Object, Object, 
ServerEndpointConfig, Map)}
  */
 @Deprecated
 public void doUpgrade(HttpServletRequest request, HttpServletResponse 
response, ServerEndpointConfig sec,
 Map pathParams) throws ServletException, 
IOException {
 UpgradeUtil.doUpgrade(this, request, response, sec, pathParams);
 }

Is this an issue with the migration tool to appropriately replace the removed 
methods?

Or the applications using web sockets with Tomcat 9.x are required to be 
updated before moving to Tomcat 10.1, instead of using the migration tool as an 
intermediate step to upgrade to Tomcat 10.1 without having to update the 
applications at the same time?
FWIW, Spring 5 to Spring 6 is a major upgrade and Tomcat 10 is a requirement.


The Migration Tool doesn't rewrite your code, it only rewrites the class 
names referenced by your class files. (Okay, it also re-writes strings 
in your files which match those class names as well.) But it will not 
change method calls. It is not a Deprecation Cleanup Tool.


You should change your Java EE-compatible application to use 
upgradeHttpToWebSocket(Object, Object, ServerEndpointConfig, Map) first, 
then run the Migration Tool on your application.


-chris

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