Skip to content

Conversation

@mattrpav
Copy link
Contributor

@mattrpav mattrpav commented Nov 4, 2024

TODO:

  • Compile fixes
  • Fix web-demo compile issue with InputStreamContentProvider
  • Fix/Refactor JspConfigurer to use Handler.Sequence
  • Unit test compile fixes
  • [STARTED] activemq-http MQTT WebSocket client tests failing
  • [STARTED] Add jetty-spring bean handler to load stock jetty.xml configs vs Spring bean wiring
  • Review and verify security constraints as a jetty xml configuration file
  • [STARTED] Fix web console error
  • Review if jsp's should use "#" vs "$" to defer resolution to runtime per Jakarta EL spec

@mattrpav mattrpav self-assigned this Nov 4, 2024
@mattrpav mattrpav changed the title WIP [AMQ-9359] Jetty-12 conversion WIP: [AMQ-9359] Jetty-12 conversion Nov 4, 2024
@jbonofre
Copy link
Member

jbonofre commented Nov 5, 2024

I'm already working on this for 6.2./6.3.x.

@mattrpav mattrpav force-pushed the AMQ-9359 branch 2 times, most recently from 93cd60b to 1c0c19c Compare December 2, 2024 17:49
@cshannon
Copy link
Contributor

cshannon commented Dec 5, 2024

Is there any reason not to bump to Java EE 10? Jetty 12.x can run multiple EE versions simultaneously so there's not really a reason to not just go to Servlet 6.0 and Jakarta EE 10 that I can think of. A user that depends on embedded Jetty and AMQ wants to use EE9 for other servlets could still include those jars and be compatible.

@mattrpav
Copy link
Contributor Author

mattrpav commented Dec 5, 2024

I think EE10 makes more sense. However, if we jump straight to EE10, I think we’d need to rev to 7.x.

Staying with EE9 would allow us to get to Jetty 12 in 6.x minor release

@cshannon
Copy link
Contributor

cshannon commented Dec 5, 2024

I think EE10 makes more sense. However, if we jump straight to EE10, I think we’d need to rev to 7.x.

Staying with EE9 would allow us to get to Jetty 12 in 6.x minor release

Looking at it in more detail and reading https://jetty.org/docs/jetty/12/operations-guide/deploy/index.html , I don't think it's compatible after all for EE9 and EE10 when embedded.

EE10 removes some stuff from the API and i took a look at the Jetty 12 download and they actually package all 3 versions of both the API and modules separately (EE8, EE9, EE10) and each war file is isolated for deployment so you can run independently. This of course does not work for something embedded.

So we can probably stick with EE9 until 7.x. I guess if someone wants to use EE10 and with an embedded version of AMQ they could probably still do so as long as they were not using anything that relied on the EE9 stuff (any of the AMQ websockets or servlets, etc) and they would have to exclude the EE9 transitive dependencies from AMQ

@mattrpav mattrpav force-pushed the AMQ-9359 branch 2 times, most recently from 57d7ad0 to bd063b1 Compare December 29, 2024 14:45
@mattrpav
Copy link
Contributor Author

So we can probably stick with EE9 until 7.x. I guess if someone wants to use EE10 and with an embedded version of AMQ they could probably still do so as long as they were not using anything that relied on the EE9 stuff (any of the AMQ websockets or servlets, etc) and they would have to exclude the EE9 transitive dependencies from AMQ

If users embed, they should be able to do EE10 runtime by excluding activemq-http and activemq-web-* modules. I believe the other EE specs in use are forward compatible b/w EE9 and EE10.

@mattrpav
Copy link
Contributor Author

Heads up-- I'm leaning towards writing a simple Spring bean wrapper that loads pure jetty.xml files from a conf/jetty folder. This will simplify consuming jetty.xml configuration and allow users/admins to reuse config and config samples directly from jetty vs having to map jetty beans to spring beans.

@mattrpav
Copy link
Contributor Author

mattrpav commented Sep 5, 2025

@coheigea I'm working on converting the Jetty from Spring to use Jetty-native xml. This will reduce the security risk, by being able to leverage stock Jetty configurations and allow users to leverage more Jetty features without having to translate from Jetty bean to Spring bean for configuration.

edited: Latest commit has ActiveMQ booting with Jetty 12 using jetty-based xml configuration files. The console and api are deploying, but both error out currently.

@coheigea
Copy link
Contributor

@coheigea I'm working on converting the Jetty from Spring to use Jetty-native xml. This will reduce the security risk, by being able to leverage stock Jetty configurations and allow users to leverage more Jetty features without having to translate from Jetty bean to Spring bean for configuration.

edited: Latest commit has ActiveMQ booting with Jetty 12 using jetty-based xml configuration files. The console and api are deploying, but both error out currently.

@mattrpav What's the most fundamental thing to look at? I was looking at the distribution, but then I saw the activemq-web-console tests were failing as well.

@mattrpav
Copy link
Contributor Author

mattrpav commented Sep 10, 2025

@coheigea I updated the list at the top of this PR.

  1. @grgrzybek helped fix web socket STOMP tests, that pattern needs to be applied to the MQTT web socket tests. That will complete the code conversion

  2. I have some productization left to do on the jetty-spring starter bean and should have that done in the next week or so.

  3. Refactor the existing conf/jetty.xml security constraints as a jetty xml configuration file

  4. Fix web admin console error(s) where page does not currently render

Help with tasks 1, 3, and 4 is most welcome!

@mattrpav
Copy link
Contributor Author

Current /admin console error

 WARN | /admin/
org.apache.jasper.JasperException: /index.jsp (line: [1], column: [1]) Cannot invoke "org.apache.jasper.compiler.TldCache.getTldResourcePath(String)" because the return value of "org.apache.jasper.Options.getTldCache()" is null
	at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:292) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:98) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:345) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.Parser.addInclude(Parser.java:394) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.Parser.parse(Parser.java:132) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:245) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:106) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:391) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:367) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328) ~[apache-jsp-10.0.27.jar:10.0.27]
	at org.eclipse.jetty.ee9.jsp.JettyJspServlet.service(JettyJspServlet.java:101) ~[jetty-ee9-apache-jsp-12.0.21.jar:12.0.21]

@grgrzybek
Copy link

grgrzybek commented Sep 11, 2025

I don't see version 12.x here: https://repo1.maven.org/maven2/org/eclipse/jetty/apache-jsp/ but I see version 11... maybe the API has changed?

I checked this one:
https://github.com/jetty/jetty.project/blob/3569a3e83ad136ee44e26b370b74c1c5e9f33e61/jetty-ee9/pom.xml#L934-L935

so I'm not sure what's the problem... I may have a look tomorrow.

Maybe JettyJspServlet was not initialized? are you using embedded Jetty? mvn jetty:run?

@mattrpav
Copy link
Contributor Author

mattrpav commented Sep 11, 2025

@grgrzybek FYI: the org.mortbay.jasper/apache-jsp/10.x dependency (where error is being thrown) is transitive from org.eclipse.jetty.ee9/jetty-ee9-apache-jsp/12.x.

I appear to have the correct dependencies:

activemq-web-console % mvn dependency:tree | grep jsp
[INFO] +- jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:jar:3.0.0:compile
[INFO] +- org.glassfish.web:jakarta.servlet.jsp.jstl:jar:3.0.1:compile
[INFO] +- org.eclipse.jetty.ee9:jetty-ee9-apache-jsp:jar:12.0.21:provided
[INFO] |  \- org.mortbay.jasper:apache-jsp:jar:10.0.27:provided

commons-bin.xml

  <include>org.mortbay.jasper:apache-jsp</include>
  ...
  <include>org.mortbay.jasper:apache-el</include>

Update: I'm googling around seeing notes that the TldCache may need to be initialized differently now. Also noted that pre-compile JSPs at build time may avoid the need for runtime compilation and tld caching.

@jbonofre worked on this same issue on this JIRA https://issues.apache.org/jira/browse/AMQ-9327

@mattrpav
Copy link
Contributor Author

mattrpav commented Sep 11, 2025

UPDATE: TldCache error resolved by adding two jetty-ee9 dependencies to the distribution: jetty-ee9-annotations and jetty-ee9-plus. (h/t @jbonofre's earlier JIRA notes)

New error is missing tag libary

org.apache.jasper.JasperException: /index.jsp (line: [1], column: [1]) Unable to find taglib [c] for URI: [jakarta.tags.core]

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.

5 participants