google-api-java-client icon indicating copy to clipboard operation
google-api-java-client copied to clipboard

Support jakarta.servlet naming over javax.servlet

Open Edwardiv1 opened this issue 2 years ago • 6 comments

I'd like to upgrade to newer versions of JakartaEE/JavaEE, but the package names have changed from javax.servlet to jakarta.servlet, so the Google Client SDK won't run (class not found errors).

This request is for the new Jakarta package names to be supported.

Edwardiv1 avatar Feb 13 '23 01:02 Edwardiv1

By the way, Google App Engine Java21 now supports the Jakarta names. See https://twitter.com/ludoch/status/1732519005288796264

ludoch avatar Dec 06 '23 22:12 ludoch

When support of jakarta can be expected? It blocks migration from Spring Boot 2.x to 3.x

ragnor avatar Jan 15 '24 12:01 ragnor

Does anyone know of a workaround for this issue? Doesn't look like it's high on Google's priority list.

Edwardiv1 avatar Jan 23 '24 05:01 Edwardiv1

@Edwardiv1 I ran sample project in Jakarta 10 EE and it just worked fine to use google-api-java-client. Would you share a simple Servlet example that fails due to ClassNotFound error?

suztomo avatar May 02 '24 20:05 suztomo

Every where you see javax.servlet.* in https://github.com/search?q=repo%3Agoogleapis%2Fgoogle-api-java-client%20javax.servlet&type=code this library will not work on Jakarta web servers.

ludoch avatar May 02 '24 20:05 ludoch

For example, try to use google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/WebhookUtils.java with your Jarkata servlet request object and you'll see a ClassNotFound at runtime ( Java EE servers provide at runtime the servlet APIs, they should not be bundled with your app)

ludoch avatar May 02 '24 20:05 ludoch

@Edwardiv1 @ragnor Are you using NotificationServlet or WebhookUtils that appear in the search query ludoch's comment?

https://github.com/googleapis/google-api-java-client/blob/fbbc37446b2a34b03ca5401bbe9ca038ff087972/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/WebhookUtils.java#L31

suztomo avatar May 09 '24 00:05 suztomo

Yes, I'm using WebhookUtils class.

czw., 9 maj 2024, 02:18 użytkownik Tomo Suzuki @.***> napisał:

@Edwardiv1 https://github.com/Edwardiv1 @ragnor https://github.com/ragnor Are you using NotificationServlet or WebhookUtils that appear in the search query ludoch's comment?

— Reply to this email directly, view it on GitHub https://github.com/googleapis/google-api-java-client/issues/2260#issuecomment-2101703005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEALZMN4AGE57A6VL26TRTZBK6HBAVCNFSM6AAAAAAUZV3TAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBRG4YDGMBQGU . You are receiving this because you were mentioned.Message ID: @.***>

ragnor avatar May 09 '24 05:05 ragnor

@ragnor Thank you. Pardon my ignorance, but is there any document that recommends you to use the WebhookUtils class? Understanding usages helps prioritization.

suztomo avatar May 09 '24 13:05 suztomo

I'm using Google Calendar Java SDK. The part the uses servlets is referenced in the following link: https://developers.google.com/api-client-library/java/google-api-java-client/oauth2#web_server_applications

So maybe this: https://github.com/googleapis/google-oauth-java-client/blob/main/google-oauth-client-servlet/src/main/java/com/google/api/client/extensions/servlet/auth/oauth2/AbstractAuthorizationCodeServlet.java

Edwardiv1 avatar May 09 '24 13:05 Edwardiv1

@Edwardiv1 Thank you. Yes, these servlet classes are in a different repository. Follow https://github.com/googleapis/google-oauth-java-client/issues/1112.

suztomo avatar May 09 '24 14:05 suztomo

I see. Thanks. That other link was filed just last week - I suppose that means they might get a response next year sometime.

Edwardiv1 avatar May 09 '24 14:05 Edwardiv1

@Edwardiv1 We released google-oauth-client-servlet 1.36.0. Would you try the new classes in the new "jakarta" package? See https://github.com/googleapis/google-oauth-java-client/releases/tag/v1.36.0 for the class names.

suztomo avatar May 10 '24 20:05 suztomo

@ragnor Do you use WebhookUtils for Google Drive? https://developers.google.com/drive/api/guides/push

suztomo avatar May 13 '24 14:05 suztomo

Yes, I do. It is a legacy code that I've inherited. Is there any other recommended way of consuming google drive notifications in Java?

On Mon, 13 May 2024 at 16:43, Tomo Suzuki @.***> wrote:

@ragnor https://github.com/ragnor Do you use WebhookUtils for Google Drive? https://developers.google.com/drive/api/guides/push

— Reply to this email directly, view it on GitHub https://github.com/googleapis/google-api-java-client/issues/2260#issuecomment-2107810928, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEALZIAXFHTRZH4IB62JB3ZCDGP7AVCNFSM6AAAAAAUZV3TAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXHAYTAOJSHA . You are receiving this because you were mentioned.Message ID: @.***>

ragnor avatar May 13 '24 15:05 ragnor

I just wanted to confirm the use cases. Thank you. I'll get back to you soon.

suztomo avatar May 13 '24 15:05 suztomo

It is the only class from the lib that I use that has javax imports. Simple copy of the class where all javax are replaced by jakarta have unblocked migration to Spring Boot 3.x. Still at some point I hope I will remove this workaround and use only official classes from the lib.

pon., 13 maj 2024, 17:04 użytkownik Tomo Suzuki @.***> napisał:

I just wanted to confirm the use cases. I'll get back to you soon.

— Reply to this email directly, view it on GitHub https://github.com/googleapis/google-api-java-client/issues/2260#issuecomment-2107899498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEALZOAZ6HMLXM5NWLQJBDZCDI6XAVCNFSM6AAAAAAUZV3TAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXHA4TSNBZHA . You are receiving this because you were mentioned.Message ID: @.***>

ragnor avatar May 13 '24 15:05 ragnor