I am building an application that has a Krazo web application as its UI. The web application lives in its own Maven module of type 'war'; there are a few more Maven modules, but I think this is not relevant.
My desired application architecture would be to package the 'war' modules inside an 'ear' and deploy that to OpenLiberty. Ideally, all libraries that are shared between the 'war' and other modules should not be duplicated, so I have the following configuration for the Maven EAR Plugin:
<configuration>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
<jarModule>
<groupId>it.mulders.openliberty.tests</groupId>
<artifactId>domain</artifactId>
</jarModule>
<webModule>
<groupId>it.mulders.openliberty.tests</groupId>
<artifactId>web</artifactId>
<contextRoot>/</contextRoot>
</webModule>
</modules>
<skinnyModules>true</skinnyModules>
</configuration>
The EAR looks fine, with "skinny" WAR-modules inside and all shared libraries in a 'lib/' directory inside that EAR.
My OpenLiberty 'server.xml' has the following, to prevent OpenLiberty from scanning all libraries that do not contain Jakarta beans:
<cdi enableImplicitBeanArchives="false" />
When I start the application with mvn liberty:dev -pl :<module-that-builds-ear>, I get the following errors:
[INFO] [WARNING ] CWOWB1009W: Implicit bean archives are disabled.
[INFO] [ERROR ] CWWKZ0106E: Could not start web application openliberty-mvc-ear.
[INFO] [ERROR ] CWWKZ0002E: An exception occurred while starting the application openliberty-mvc-ear. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Models with qualifiers @Default
[INFO] at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public it.mulders.openliberty.tests.web.home.HomeController(Models, ServiceInterface)
[INFO] at it.mulders.openliberty.tests.web.home.HomeController.<init>(HomeController.java:0)
I noticed that Krazo does not ship with beans.xml files, so I tried adding them to Krazo 4.0.1 ('core', 'jersey' and 'resteasy' modules) to see if that would resolve the "Unsatisfied dependencies for type Models" - after all, I have disabled implicit bean archives.
After rebuilding Krazo and rebuilding my application, I get a different error when starting the application:
[INFO] [WARNING ] CWOWB1009W: Implicit bean archives are disabled.
[INFO] [ERROR ] CWWKZ0106E: Could not start web application openliberty-mvc-ear.
[INFO] [ERROR ] CWWKZ0002E: An exception occurred while starting the application openliberty-mvc-ear. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001414: Bean name is ambiguous. Name mvc resolves to beans: [Managed Bean [class org.eclipse.krazo.MvcContextImpl] with qualifiers [@Default @Named @Any], Managed Bean [class org.eclipse.krazo.MvcContextImpl] with qualifiers [@Default @Named @Any]]
It seems that instead of no dependency injection of Krazo beans, I now have a duplicate bean.
If necessary, I can share a simplified project setup, but I hope the above makes enough sense already. In case you need any more logging, or OpenLiberty diagnostic logging (ffdc files), I'm happy to help of course!
I am building an application that has a Krazo web application as its UI. The web application lives in its own Maven module of type 'war'; there are a few more Maven modules, but I think this is not relevant.
My desired application architecture would be to package the 'war' modules inside an 'ear' and deploy that to OpenLiberty. Ideally, all libraries that are shared between the 'war' and other modules should not be duplicated, so I have the following configuration for the Maven EAR Plugin:
The EAR looks fine, with "skinny" WAR-modules inside and all shared libraries in a 'lib/' directory inside that EAR.
My OpenLiberty 'server.xml' has the following, to prevent OpenLiberty from scanning all libraries that do not contain Jakarta beans:
When I start the application with
mvn liberty:dev -pl :<module-that-builds-ear>, I get the following errors:I noticed that Krazo does not ship with beans.xml files, so I tried adding them to Krazo 4.0.1 ('core', 'jersey' and 'resteasy' modules) to see if that would resolve the "Unsatisfied dependencies for type Models" - after all, I have disabled implicit bean archives.
After rebuilding Krazo and rebuilding my application, I get a different error when starting the application:
It seems that instead of no dependency injection of Krazo beans, I now have a duplicate bean.
If necessary, I can share a simplified project setup, but I hope the above makes enough sense already. In case you need any more logging, or OpenLiberty diagnostic logging (ffdc files), I'm happy to help of course!