Error deploying Vaadin 23 with SpringBoot to Weblogic

Hi guys, I’ve run into a problem when deploying my application to Weblogic since adding some UIScope annotations and lazy bean initialization. When running locally though the embedded tomcat it works fine.
The error in Weblogic is the following:

<User defined listener com.vaadin.flow.server.startup.ServletContextListeners failed: java.lang.IllegalStateException: The application Lookup instance is not found in VaadinContext. The instance is suppoed to be created by a ServletContainerInitializer. Issues known to cause this problem are:

  • A Spring Boot application deployed as a war-file but the main application class does not extend SpringBootServletInitializer
  • An embedded server that is not set up to execute ServletContainerInitializers
  • Unit tests which do not properly set up the context for the test

Any ideas what is happening here?
I’ve looked through similar reports and the docs for advice but other than making sure the main class follows this pattern

public class MyApplication extends SpringBootServletInitializer implements WebApplicationInitializer
which my app does, I haven’t been able to make progress. The previous version without the scoping and bean initialization changes deploys correctly so is there some kind of known problem when changing this?

Did you follow the official Spring Boot docs on how to create the war file?

Yes. I am creating a war file, when packaging this war I exclude the embedded tomcat dependency so it doesn’t interfere with Weblogic. I didn’t make any changes to build steps of the app in gradle, and the older version deploys correctly.

Older version?

Did you upgrade Spring Boot or Vaadin versions?

Maybe your Weblogic version is not compatible anymore with the latest Spring Boot?

Sorry, I meant the older version of my app without the scoping and lazy initialization changes. No dependency versions changed between the working and not-working wars.

Ah, ok. Didn’t read properly your original question.

Quite hard to say anything then. Have you overridden some Vaadin classes that would be related that Lookup class :man_shrugging: If something like that is now deferred, maybe embedded spring boot works bit differently than war packaged?

No, I don’t have any overrides like that.

lazy initialization
This sounds like a possible culprit

Maybe I am doing something wrong with the beans then. I made them @UIScope so during startup I would get errors saying there is no session/UI and the app would fail. So I added lazy initialization to solve this. Is there a different way to have UIScoped beans?

There are no beans that are called on start up that have to be UIScoped

@quirky-zebra you were completely right, it was a problem with lazy initialization. I had some configuration classes which were referencing UIScope beans. Marking those configuration beans as lazy and removing lazy initialization from spring boot solved the problem! Thanks so much for the help guys!