OpenNTF / org.openntf.xsp.jakartaee

XPages Jakarta EE support libraries
Apache License 2.0
20 stars 7 forks source link

Encountered exception trying to load CDI container with 3.0.0-b2 #497

Closed slapraik-intec closed 11 months ago

slapraik-intec commented 11 months ago

Hi.

Trying the PrimeFaces showcase application against v3.0.0-b2 on Domino 14 EA3 and I get the following exception.

Encountered exception trying to load CDI container org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions: Exception 0 : java.util.NoSuchElementException: No value present at java.base/java.util.Optional.get(Optional.java:143) at org.eclipse.jnosql.mapping.metadata.ClassScanner.load(ClassScanner.java) at org.eclipse.jnosql.mapping.spi.EntityMetadataExtension.afterBeanDiscovery(EntityMetadataExtension.java:54) at jdk.internal.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:99) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88) at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:178) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:342) at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:136) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:320) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:298) at jakarta.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:142) at org.jboss.weld.util.Observers.notify(Observers.java:176) at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:303) at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:289) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:184) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:178) at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53) at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:45) at org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:55) at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:410) at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:80) at org.jboss.weld.environment.se.Weld.initialize(Weld.java:854) at org.openntf.xsp.cdi.util.ContainerUtil.lambda$8(ContainerUtil.java:342) at java.base/java.security.AccessController.doPrivileged(AccessController.java:692) at org.openntf.xsp.cdi.util.ContainerUtil.lambda$7(ContainerUtil.java:319) at org.openntf.xsp.cdi.util.ContainerUtil.withLock(ContainerUtil.java:427) at org.openntf.xsp.cdi.util.ContainerUtil.getContainer(ContainerUtil.java:276) at org.openntf.xsp.cdi.impl.ContainerUtilProvider.getContainer(ContainerUtilProvider.java:33) at java.base/java.util.Optional.map(Optional.java:260) at org.openntf.xsp.cdi.provider.ComponentModuleCDIContainerLocator.getContainer(ComponentModuleCDIContainerLocator.java:43) at org.openntf.xsp.cdi.provider.DominoCDIProvider.getCDI(DominoCDIProvider.java:52) at jakarta.enterprise.inject.spi.CDI.getCDIProvider(CDI.java:78) at jakarta.enterprise.inject.spi.CDI.current(CDI.java:65) at org.openntf.xsp.jsf.nsf.NSFJsfServlet.destroyOldContext(NSFJsfServlet.java:292) at org.openntf.xsp.jsf.nsf.NSFJsfServlet.buildJsfClassLoader(NSFJsfServlet.java:242) at org.openntf.xsp.jsf.nsf.NSFJsfServlet.lambda$0(NSFJsfServlet.java:145) at java.base/java.security.AccessController.doPrivileged(AccessController.java:748) at org.openntf.xsp.jsf.nsf.NSFJsfServlet.service(NSFJsfServlet.java:143) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614) at org.openntf.xsp.jakartaee.servlet.NewHttpServletWrapper.service(NewHttpServletWrapper.java:112) at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:600) at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1352) at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:877) at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:820) at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:589) at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1336) at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:725) at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:515) at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:371) at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:327) at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:302)

at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:51)
at org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:55)
at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:410)
at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:80)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:854)
at org.openntf.xsp.cdi.util.ContainerUtil.lambda$8(ContainerUtil.java:342)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:692)
at org.openntf.xsp.cdi.util.ContainerUtil.lambda$7(ContainerUtil.java:319)
at org.openntf.xsp.cdi.util.ContainerUtil.withLock(ContainerUtil.java:427)
at org.openntf.xsp.cdi.util.ContainerUtil.getContainer(ContainerUtil.java:276)
at org.openntf.xsp.cdi.impl.ContainerUtilProvider.getContainer(ContainerUtilProvider.java:33)
at java.base/java.util.Optional.map(Optional.java:260)
at org.openntf.xsp.cdi.provider.ComponentModuleCDIContainerLocator.getContainer(ComponentModuleCDIContainerLocator.java:43)
at org.openntf.xsp.cdi.provider.DominoCDIProvider.getCDI(DominoCDIProvider.java:52)
at jakarta.enterprise.inject.spi.CDI.getCDIProvider(CDI.java:78)
at jakarta.enterprise.inject.spi.CDI.current(CDI.java:65)
at org.openntf.xsp.jsf.nsf.NSFJsfServlet.destroyOldContext(NSFJsfServlet.java:292)
at org.openntf.xsp.jsf.nsf.NSFJsfServlet.buildJsfClassLoader(NSFJsfServlet.java:242)
at org.openntf.xsp.jsf.nsf.NSFJsfServlet.lambda$0(NSFJsfServlet.java:145)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:748)
at org.openntf.xsp.jsf.nsf.NSFJsfServlet.service(NSFJsfServlet.java:143)
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)
at org.openntf.xsp.jakartaee.servlet.NewHttpServletWrapper.service(NewHttpServletWrapper.java:112)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:600)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1352)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:877)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:820)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:589)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1336)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:725)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:515)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:371)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:327)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:302)
Suppressed: java.util.NoSuchElementException: No value present
    at java.base/java.util.Optional.get(Optional.java:143)
    at org.eclipse.jnosql.mapping.metadata.ClassScanner.load(ClassScanner.java)
    at org.eclipse.jnosql.mapping.spi.EntityMetadataExtension.afterBeanDiscovery(EntityMetadataExtension.java:54)
    at jdk.internal.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:99)
    at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
    at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:178)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:342)
    at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:136)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:320)
    at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:298)
    at jakarta.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:142)
    at org.jboss.weld.util.Observers.notify(Observers.java:176)
    at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:303)
    at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:289)
    at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:184)
    at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:178)
    at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
    at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:45)
    ... 33 more

Before the exception, the error/trace log reports the following (not sure if its relevant):

CWPJP0011I: Unable to remove comp/UserTransaction from the JNDI registry because it does not exist. WELD-ENV-000040: Jandex discovery strategy was disabled. WELD-ENV-000014: Falling back to Java Reflection for bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the classpath to speed-up startup. WELD-001904: Unsupported configuration key found and ignored: org.jboss.weld.discovery.disableJandexDiscovery WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.config.annotation.CdiAnnotationProviderExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.

In XspProperties, the following xsp.library.depends are included:

org.openntf.xsp.beanvalidation org.openntf.xsp.cdi org.openntf.xsp.el org.openntf.xsp.jakarta.persistence org.openntf.xsp.jakarta.servlet org.openntf.xsp.jaxrs org.openntf.xsp.jsonapi org.openntf.xsp.jsf org.openntf.xsp.jsp org.openntf.xsp.mvc org.openntf.xsp.nosql

And the project builds without any errors.

Not sure if relevant, but I tried adding:

org.openntf.xsp.cdi.extlib org.openntf.xsp.jakarta.concurrency org.openntf.xsp.jakarta.transaction

But when I build the app, Designer complains that the libraries are not installed (even though they are listed by Domino Designer in the list of installed plug-ins). The server also lists these 3 bundles as installed.

jesse-gallagher commented 11 months ago

This is a bit odd: I see it in a normal Domino server, but NOT in the IT suite (which uses a Domino server in a Docker container). The specific root problem I see is:

osgi> org.openntf.xsp.nosql.scanner [20]
  Unresolved requirement: Fragment-Host: org.openntf.org.eclipse.jnosql.mapping.api.core

This would do it: that fragment provides an implementation of ClassScanner that suits Domino, but for some reason the bundle isn't being loaded here.

I'm not sure what the trouble is, since, nor only does that api.core bundle exist, it ALSO has another, working fragment attached. The main differences offhand I see are that the container version runs in Linux and has its OSGi bundles deployed to the filesystem. I've seen odd differences between filesystem and NSF Update Site deployment before, and maybe this is one.

jesse-gallagher commented 11 months ago

I ended up removing this fragment bundle in favor of a weird hack to explicitly use the customized ClassScanner done via OSGi weaving.