I have a bunch of spring framework6 java/kotlin web applications that I maintain. They are currently on a payara5 server getting ready to move to payara6. For this move we are moving to JDK17/EE10. I’ve ran into an error when deploying any of the spring apps into payara6.
java.lang.IllegalStateException: CDI is not available
We are only using springs dependency injection. CDI has never been configured, but Payara6 seems to want to require this. If I add a blank beans.xml file to the project, it deploys without any issues. After a bit of googling, I found a post on StackOverFlow where someone indicated they talked to a Spring developer where he indicated this was a Payara issue. So I guess I’m just hoping this is on the radar, or if there’s already something I can do to prevent from having to add a blank file to all the projects?
edit
Nevermind, I see this is an option to change after deploying the app in the application settings. It looks like you can add the option to a glassfish-application.xml file. Is there a way to disable this server wide?
I have also added the glassfish-application.xml with the xml option to disable implicit cdi. Although, this looks like it may be for EAR applications only? We are running WAR files for our apps.
Hi, Brad. That was me who got an email from Juergen. I just tried Payara 6.2023 and am still getting “CDI is not available” deploying my Spring Web MVC application. Also, sent a contact us message.
Looks like I’ll be trying Tomcat next.
I’m seeing posts from Google about GF should never be used in production. SInce Payara is built on GF, I wonder about Payara’s ability to stay in the WebServer game, especially with problems like this.
Hi StageIsSet,
The current work around that I’m aware of is to add a beans.xml file in the same directory as your web.xml/glassfish-web.xml. This file can be blank too. That should solve the CDI error on deployment.