Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wicket 9 & Tomcat 10 Can't Cast jakarta.servlet.Filter

Tags:

wicket

i'm trying to use the Wicket Project 'QuickStart' with Netbeans 11 , Java 11, Tomcat 10 , Wicket 9 and Ubuntu 18.04 .

When i install the war package and start it, it throws : 20-May-2020 09:23:37.067 GRAVE [] org.apache.catalina.core.StandardContext.filterStart Exception at start [wicket.quickstart] java.lang.ClassCastException: class org.apache.wicket.protocol.http.WicketFilter cannot be cast to class jakarta.servlet.Filter (org.apache.wicket.protocol.http.WicketFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappCl*assLoader")

Has anyone seen this issue before and if it so what can i do to resolve this ?

Thanks a lot for answer(s).

like image 676
MADARASSOU David Avatar asked May 20 '20 06:05

MADARASSOU David


2 Answers

The issue is that Tomcat 10 uses jakarta.** packages (Jakarta EE 9) while Wicket 9.x is still based on javax.** packages (Java EE 8).

The solutions are:

  1. Use Tomcat 9.x
  2. Use https://github.com/apache/tomcat-jakartaee-migration to migrate the Wicket application (the .war file) from javax to jakarta
  3. Deploy the javax.** based application into $TOMCAT10_HOME/webapps-javaee/ folder. It will be automatically migrated to jakarta.** by Tomcat.
like image 123
martin-g Avatar answered Nov 14 '22 15:11

martin-g


Don't use Tomcat 10 yet, it works with the new jakarta packages.

Switch to version 9 instead.

like image 37
svenmeier Avatar answered Nov 14 '22 15:11

svenmeier