java.lang.ClassNotFoundException: javax.servlet.ServletRegistration when using OmniFaces library on Glassfish v2.1

StackOverflow https://stackoverflow.com/questions/21288147

  •  01-10-2022
  •  | 
  •  

Question

I'm trying to use the excellent OmniFaces library on a Glassfish v2.1 server.

It works well until I try to use the org.omnifaces.util.Faces class. In this case, I encounter a

java.lang.ClassNotFoundException: javax.servlet.ServletRegistration

From what I've gathered, it seems this class appeared with the Servlet 3.0 specification.
Glassfish v2.1 is only Servlet 2.5 compatible but OmniFaces documentation indicates that it only requires Servlet 2.5.

Is there something I'm missing ? Is this a dependency that was accidentally added ?

Full configuration is :

  • Myfaces 2.1.12
  • Glassfish v2.1.1 (9.1_02 Patch12)
  • OmniFaces 1.6

Thank you for your answers.

I've come across this article that explains things a bit more but I'm still confused as to whether or not it should work on Glassfish 2.1.

Was it helpful?

Solution

OmniFaces is indeed supposed to be Servlet 2.5 compatible, but that's not thoroughly tested as the development and showcase environments are Servlet 3.0 based. See also https://github.com/omnifaces/omnifaces/wiki/Java-EE-5-and-6-compatibility, so it may happen that something accidently slipped through. This is one of those things.

As per issue 298, this has been fixed for the current 1.8 snapshot.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top