Skip to content

Feature/1004 update javalin drop tomcat - #1985

Open
MikeNeilson wants to merge 86 commits into
developfrom
feature/1004-update-javalin-drop-tomcat
Open

MikeNeilson wants to merge 86 commits into
developfrom
feature/1004-update-javalin-drop-tomcat

Conversation

@MikeNeilson

@MikeNeilson MikeNeilson commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Move to latest javalin (7.2.3)

Remove Use of Tomcat, no Tomcat 11+ in our local environment so will just use Javalin's default jetty and package it up.

NOTE: Due to Javalin updating the annotation plugin (this happened in javalin 5) this is going to be a large change as it touches every file and will need to alter how the OpenAPI static test works.

TODO:

  • - Make a decision on examples (thinking a follow up given the current size)
  • - Security operations behaving correctly. (I may give up for now and just put a note on the Swagger UI about the lock icons.)
  • - Get the version behaving correctly.
  • - LRTS selection Header Handled.

Related Issue

Validation

Existing integration tests

Checklist

  • AI tools used

@MikeNeilson

Copy link
Copy Markdown
Contributor Author

NOTE: at best I will have the annotations updated today. Getting the API running again in it's standalone mode will likely take until the end of the week if not longer.

@MikeNeilson

Copy link
Copy Markdown
Contributor Author

For the record. I have considered keeping with tomcat and just using like embedded tomcat for the packaging, but Javalin was made for Jetty so since that would be a fair amount of work anyway, better to use a tool that was actually built for this given style of packaging an app.

@MikeNeilson

Copy link
Copy Markdown
Contributor Author

FYI, I am aware this PR is rather huge.

The OpenAPI changes basically have to be all or nothing. I think we can all agree on that.

It also requires the migration to Jakarta EE (javalin update) which would may or may not (java.security.Principal so probably not) affect the CwmsAaaIdentityProvider.

So fair amount of changes to Tomcat anyway.

So is this likely to be a pain... yes, but I'm arguing it's worth it.

I could pivot back and do the move to standalone Javalin (e.g. Jetty whatever version that was) first, but then without updating javalin frankly it wouldn't be in a releasable state (security concerns, that's a really old Jetty)

So. for now I'm going to barrel through. I'm open to addressing concerns and pivoting if they're strong enough.

We do have a lot of plans. and the bulk are passing. What's failing is most likely various validation I've intentionally disabled due to the location of initialization changing.

@MikeNeilson
MikeNeilson force-pushed the feature/1004-update-javalin-drop-tomcat branch 2 times, most recently from e041252 to 0263cc0 Compare October 7, 2026 21:46
@MikeNeilson
MikeNeilson marked this pull request as ready for review October 8, 2026 15:06
@MikeNeilson

Copy link
Copy Markdown
Contributor Author

I'm still working through dealing with the lock icons. the behavior as a whole has change. I may need to be drastic and take the given out put to json, and put it through the Swagger OpenAPI object, but i'm hoping to do it all within the javalin openapi annotations.

I think most of issue is assumptions we previously made that are no longer required that may be getting in the way.

The primary work of the Javalin update and removal of Tomcat are finished and should be reviewed. I think I got all of the paths in correctly, but it's definitely possible that some have been missed that also weren't detected by the various validations, new and old.

NOTE: This does break /CWMSLogin. That is intentional and will be dealt with in a follow up. Once merged CDA is a standalone app like the CWMS Server apps and thus won't be getting randomly deployed to a T7 any time soon.

@MikeNeilson
MikeNeilson force-pushed the feature/1004-update-javalin-drop-tomcat branch from 33e7c77 to c7d3788 Compare October 8, 2026 16:31
Comment thread cwms-data-api/src/main/java/cwms/cda/CwmsDataApi.java
Comment thread cwms-data-api/src/main/java/cwms/cda/CwmsDataApi.java
Comment thread cwms-data-api/src/main/java/cwms/cda/CwmsDataApi.java Outdated
Comment thread cwms-data-api/src/test/java/fixtures/TestSessionHandler.java
Comment thread cda-gui/src/main/java/cwms/cda/ui/SpaErrorStatusFilter.java
Comment thread cwms-data-api/src/main/java/cwms/cda/CwmsDataApi.java Outdated
Comment thread cwms-data-api/src/main/java/picocli/CommandLine.java Outdated
Comment thread cwms-data-api/src/main/java/picocli/CommandLine.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/ProjectController.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/ProjectController.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/ParametersController.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/StreamLocationController.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/TurbineController.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/MeasurementTimeExtentsGetController.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/CwmsDataApi.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/TimeSeriesController.java Outdated
Comment thread cwms-data-api/build.gradle Outdated
Comment thread cwms-data-api/src/main/webapp/WEB-INF/web.xml Outdated
Comment thread cwms-data-api/build.gradle Outdated
@MikeNeilson
MikeNeilson force-pushed the feature/1004-update-javalin-drop-tomcat branch from d5e5583 to 6d683a7 Compare October 26, 2026 22:01
@MikeNeilson

Copy link
Copy Markdown
Contributor Author

@rma-rripken @rma-psmorris @krowvin @msweier @oskarhurst
I would like to merge this in this week. Not the least reason of which is, well pushing a bit of the update pain on others in regards to the OpenAPI spec and such. The more it lingers the more awkward that gets.

There's also a fair amount of follow up work to be had given the known breaking changes for certain environments.

@MikeNeilson

Copy link
Copy Markdown
Contributor Author

fixes for the audit are over in #2013, may or may not just have to do the same npm audit fix a few times to clear through it.

@MikeNeilson

Copy link
Copy Markdown
Contributor Author

fixes for the audit are over in #2013, may or may not just have to do the same npm audit fix a few times to clear through it.

Actually, that was just easier to do.

@oskarhurst oskarhurst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Openapi uses camelCase by default but our current scheme used kebab case for places like location. shoould we give the location dto the annotation @OpenApiNaming(OpenApiNamingStrategy.KEBAB_CASE) to make sure it matches.

logger.atFine().log("Starting queue subscriber for RSS feed.");
QueueManager.ensureRssSubscribers(ds);
logger.atFine().log("Starting CDA.");
app.start("127.0.0.1", port); // Always localhost, we only allow containerization or through proxy.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to hard code to 127.0.0.1 wont this not let it communicate with other containers in our compose like trafik?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case no. when in a container it won't matter, the container system can still route to something running on that containers "localhost".

This is to prevent downstream non-containerized usages from allowing direct connections without a bunch of work.

secReqs.clear();
authenticator.getActiveProviders().forEach(identityProvider -> {
api.getComponents().addSecuritySchemes(identityProvider.getName(),identityProvider.getScheme());
api.withSecurityScheme(identityProvider.getName(), identityProvider.getScheme());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't withSecurityScheme throw for identity providers that are null. I would say we should probably just ignore, catch, or skip them. To my understanding openapi with return null if the configuration is unset or the discovery fails, but we dont want it to throw just because the first request to keycloak fails right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the previous handling did not, this one does, I put a null check in.

Sorry, misunderstood what you were saying to me directly.

@MikeNeilson

MikeNeilson commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

NOTE, we apparently need to add @OpenApiNaming(...KEBAB) to all our DTOs.

Annoying, yes, but the OpenAPI spec is now generated at compile time and doesn't use the mapper we've configured.... why it doesn't used the FasterXML annotation we already have... no idea.

Will deal with it tomorrow.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants