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?
I found this post. Record requires ASM8 - #11 by dtewari
Looks like it’s “fixed”. But maybe not quite working the way it should?
you should remove the “Implicid CDI” flag available when you deploy.
I’m sorry, where is this option?
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?
No you need to set this option during the deployment. Either from command-line or the admin UI.
Looks like we’ll be adding this on our deploy scripts. Thank you Cistox!
So we have tried adding the beans.xml with the option of bean-discovery-mode=“none”. This does not work.
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.
The deploy command with the option is not working either.
./asadmin deploy --property enableImplicitCdi=false
I am not sure what the exact command should be. I’ve also tried the following properties.
The only thing working for me at the moment is to add a blank beans.xml file.
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.
Anyone found a fix for this error? I’m waiting for this to be able to upgrade Spring
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.