You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alex O'Ree <al...@apache.org> on 2025/10/22 00:20:17 UTC
Upgrading test code from tomcat 9 to 11
Greetings,
I'm attempting to update some unit test code from JDK11/Tomcat9 to
JDK17/Tomcat11 that I have. It previously programmatically constructs a
Tomcat instance and 3 Connectors, one for http clear, https and https with
client cert, then attaches a servlet.
I was able to get the http instance to fire up but i'm struggling a bit
with getting the https and https with client cert to fire up due to the api
changes with the SSLHostConfig object. I'm also using a JKS key store that
contains the key for tomcat and a separate JKS trust store.
I think I figured out the SSL api change and can get tomcat to run, however
i'm getting the following error and I'm not sure how to interpret this.
Error parsing HTTP request header. IllegalArgumentException: Invalid
character found in method name [ long string of hexadecimal characters here
]. HTTP Method names must be tokens.
I'm pretty sure this happens when i'm trying to trigger the servlet over
https or via the client cert auth but I have no clue as to why I'm getting
this error. Could this be a configuration or classpath issue? I'm 100% on
jakarta with no javax libraries being imported.
Re: Upgrading test code from tomcat 9 to 11
Posted by Alex O'Ree <al...@apache.org>.
Thanks Mark!
The fix was this
Connector.setProperty("SSLEnabled","true");
On Wed, Oct 22, 2025, 4:00 AM Mark Thomas <ma...@apache.org> wrote:
> On 22/10/2025 01:20, Alex O'Ree wrote:
> > Greetings,
> > I'm attempting to update some unit test code from JDK11/Tomcat9 to
> > JDK17/Tomcat11 that I have. It previously programmatically constructs a
> > Tomcat instance and 3 Connectors, one for http clear, https and https
> with
> > client cert, then attaches a servlet.
> >
> > I was able to get the http instance to fire up but i'm struggling a bit
> > with getting the https and https with client cert to fire up due to the
> api
> > changes with the SSLHostConfig object. I'm also using a JKS key store
> that
> > contains the key for tomcat and a separate JKS trust store.
> >
> > I think I figured out the SSL api change and can get tomcat to run,
> however
> > i'm getting the following error and I'm not sure how to interpret this.
> >
> > Error parsing HTTP request header. IllegalArgumentException: Invalid
> > character found in method name [ long string of hexadecimal characters
> here
> > ]. HTTP Method names must be tokens.
>
> That sounds like a TLS request being made to an HTTP connector.
>
> > I'm pretty sure this happens when i'm trying to trigger the servlet over
> > https or via the client cert auth but I have no clue as to why I'm
> getting
> > this error. Could this be a configuration or classpath issue? I'm 100% on
> > jakarta with no javax libraries being imported.
>
> Tomcat has quite a few TLS related unit tests. You might find some
> useful hints in those.
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Upgrading test code from tomcat 9 to 11
Posted by Mark Thomas <ma...@apache.org>.
On 22/10/2025 01:20, Alex O'Ree wrote:
> Greetings,
> I'm attempting to update some unit test code from JDK11/Tomcat9 to
> JDK17/Tomcat11 that I have. It previously programmatically constructs a
> Tomcat instance and 3 Connectors, one for http clear, https and https with
> client cert, then attaches a servlet.
>
> I was able to get the http instance to fire up but i'm struggling a bit
> with getting the https and https with client cert to fire up due to the api
> changes with the SSLHostConfig object. I'm also using a JKS key store that
> contains the key for tomcat and a separate JKS trust store.
>
> I think I figured out the SSL api change and can get tomcat to run, however
> i'm getting the following error and I'm not sure how to interpret this.
>
> Error parsing HTTP request header. IllegalArgumentException: Invalid
> character found in method name [ long string of hexadecimal characters here
> ]. HTTP Method names must be tokens.
That sounds like a TLS request being made to an HTTP connector.
> I'm pretty sure this happens when i'm trying to trigger the servlet over
> https or via the client cert auth but I have no clue as to why I'm getting
> this error. Could this be a configuration or classpath issue? I'm 100% on
> jakarta with no javax libraries being imported.
Tomcat has quite a few TLS related unit tests. You might find some
useful hints in those.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org