Replies: 2 comments
-
Play 3.0 behaves exactly the same like Play 2.9 - the only difference is it switched to Pekko.
So for now in Play 3.0 you have to stay on But for injection you should be able to switch from |
Beta Was this translation helpful? Give feedback.
-
Answering a comment from you other thread:
javax is not javax for everything, same for jakarta. There is injection, there is validation, etc. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
0
Title:
Migration Issue to Play Framework 3.0.0: NoClassDefFoundError: javax/validation/ConstraintValidatorFactory
Body:
I'm migrating a Play Framework application from 2.9.4 to 3.0.0 to adopt Jakarta Bean Validation (jakarta.validation.constraints.*) since Play 2.9 still relies on the old javax.validation package and does not support annotations like @NotNull, @notblank, etc. from Jakarta.
After updating the necessary configurations and dependencies, I'm encountering the following error at startup:
play.api.UnexpectedException: Unexpected exception[NoClassDefFoundError: javax/validation/ConstraintValidatorFactory]
Caused by: java.lang.NoClassDefFoundError: javax/validation/ConstraintValidatorFactory
...
It seems like the application is still expecting javax.validation instead of jakarta.validation, even though I've added the following dependencies in build.sbt:
"jakarta.validation" % "jakarta.validation-api" % "3.1.1",
"org.hibernate" % "hibernate-validator" % "9.0.0.Beta3",
"org.hibernate" % "hibernate-validator-annotation-processor" % "9.0.0.Beta3",
"org.glassfish" % "jakarta.el" % "4.0.2",
"com.sun.el" % "el-ri" % "3.0.4"
My build.properties:
sbt.version=1.10.6
Play version in plugins.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.4") // legacy
I updated build.sbt to use Play 3.0.0:
"org.playframework" %% "play-pekko-http-server" % "3.0.0",
"org.playframework" %% "play-pekko-http2-support" % "3.0.0"
I suspect the issue is due to the Play framework still internally relying on javax.validation instead of jakarta.validation.
Question:
How can I ensure my Play 3.0.0 application uses Jakarta Bean Validation (jakarta.validation) properly and completely avoids references to javax.validation?
Beta Was this translation helpful? Give feedback.
All reactions