activemq
activemq copied to clipboard
WIP: [AMQ-9359] Jetty-12 conversion
TODO:
- [x] Compile fixes
- [x] Fix web-demo compile issue with InputStreamContentProvider
- [x] Fix/Refactor JspConfigurer to use Handler.Sequence
- [x] Unit test compile fixes
- [ ] activemq-http WebSocket client tests failing
- [ ] Refactor all jetty.xml's to support updated class package locations
I'm already working on this for 6.2./6.3.x.
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.
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
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
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.
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.
@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 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.
@coheigea I updated the list at the top of this PR.
-
@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
-
I have some productization left to do on the jetty-spring starter bean and should have that done in the next week or so.
-
Refactor the existing conf/jetty.xml security constraints as a jetty xml configuration file
-
Fix web admin console error(s) where page does not currently render
Help with tasks 1, 3, and 4 is most welcome!
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]
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?
@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
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]
Hey @mattrpav I started looking into this today and I encountered this error when I tried to start the broker built from source. I am looking into it while trying to tackle task 1, 3 and 4 in https://github.com/apache/activemq/pull/1344#issuecomment-3275569166
ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'jettyServer' defined in class path resource [jetty-spring.xml]: Base Resource is not valid: file:///Users/qrl/.m2/repository/org/apache/activemq/apache-activemq/6.2.0-SNAPSHOT/webapps/admin
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jettyServer' defined in class path resource [jetty-spring.xml]: Base Resource is not valid: file:///Users/qrl/.m2/repository/org/apache/activemq/apache-activemq/6.2.0-SNAPSHOT/webapps/admin
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1826) ~[spring-beans-6.2.8.jar:6.2.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:607) ~[spring-beans-6.2.8.jar:6.2.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:529) ~[spring-beans-6.2.8.jar:6.2.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:339) ~[spring-beans-6.2.8.jar:6.2.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:373) ~[spring-beans-6.2.8.jar:6.2.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:337) ~[spring-beans-6.2.8.jar:6.2.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-6.2.8.jar:6.2.8]