-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem running invoker tests that expect a failure inside WildFly #558
Comments
* Remove the web tck tests * Restore ability to run the core tck tests inside of wildfly * Fix a problem with invoker tests that expected failures when running inside of wildfly, fixes #558 * Update to 4.1.0.Beta2 CDI API --------- Signed-off-by: Scott M Stark <[email protected]>
I see that most of the invokers test don't add the BCExtension into the test archive, which is probably a mistake. The test class should be in the archive, so even though I'm not sure why Weld would try to load it, it should work 🤷 |
Seems like Weld will try to make sure each declaring class is loadable in this code. |
Ok, so when I look at the resulting (WAR) archive Arq. generates, the test class is not part of it, despite being explicitly added in the test. And looking into how we build test archive, I found that this bit will exclude the class if it is running in client mode and the class name equals to the test name. And while I don't recall what the client mode really was (but apparently we are running in it), this seems very deliberate :) |
We apparently treat tests that are expected to fail as "run as client" due to https://github.com/jakartaee/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/shrinkwrap/ArchiveBuilder.java#L1344 Frankly, that's rather weird... |
So in the process of trying to create a reproducer for a WELD issue, I
updated to the 31.0.1.Final version and now I do see an exception, but it
is a org.jboss.weld.exceptions.DefinitionExceptio rather than the expected.
It looks like all invoker tests are failing under that version of wildfly.
```
[ERROR] ConstructorInvokerTest>Arquillian.arquillianBeforeClass:99 »
Deployment Cannot deploy
ConstructorInvokerTest35162967636eea6857b4c0ace3be8bce6ffebd.war:
{"WFLYCTL0062: Composite operation failed and was rolled back. Steps that
failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" =>
{"jboss.deployment.unit.\"ConstructorInvokerTest35162967636eea6857b4c0ace3be8bce6ffebd.war\".WeldStartService"
=> "Failed to start service
Caused by: org.jboss.weld.exceptions.DefinitionException: Exception
List with 1 exceptions:
Exception 0 :
jakarta.enterprise.event.ObserverException
at
java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at
java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at
java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:304)
at java.base/java.lang.Class.newInstance(Class.java:725)
at ***@***.***
//org.jboss.weld.security.NewInstanceAction.run(NewInstanceAction.java:33)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
at ***@***.***
//org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40)
at ***@***.***
//org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:78)
at ***@***.***
//org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:107)
at ***@***.***
//org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:199)
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.api//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.as.weld.WeldStartService.start(WeldStartService.java:79)
at ***@***.***
//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1617)
at ***@***.***
//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1580)
at ***@***.***
//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1438)
at ***@***.***
//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at ***@***.***
//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at ***@***.***
//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at ***@***.***
//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NoClassDefFoundError:
jakarta/enterprise/inject/build/compatible/spi/InvokerFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at
java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2676)
at ***@***.***
//org.jboss.weld.lite.extension.translator.ExtensionInvoker.lambda$findExtensionMethods$0(ExtensionInvoker.java:50)
at
java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
at
java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1787)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at ***@***.***
//org.jboss.weld.lite.extension.translator.ExtensionInvoker.findExtensionMethods(ExtensionInvoker.java:64)
at ***@***.***
//org.jboss.weld.lite.extension.translator.ExtensionPhaseBase.run(ExtensionPhaseBase.java:29)
at ***@***.***
//org.jboss.weld.lite.extension.translator.LiteExtensionTranslator.discovery(LiteExtensionTranslator.java:63)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at ***@***.***
//org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:99)
... 25 more
Caused by: java.lang.ClassNotFoundException:
jakarta.enterprise.inject.build.compatible.spi.InvokerFactory from [Module
\"deployment.ConstructorInvokerTest35162967636eea6857b4c0ace3be8bce6ffebd.war\"
from Service Module Loader]
at
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 42 more
"}}}}
```
See https://issues.redhat.com/browse/WELD-2782 for how to reproduce.
…On Thu, Feb 29, 2024 at 3:40 AM Ladislav Thon ***@***.***> wrote:
We apparently treat tests that are expected to fail as "run as client" due
to
https://github.com/jakartaee/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/shrinkwrap/ArchiveBuilder.java#L1344
Frankly, that's rather weird...
—
Reply to this email directly, view it on GitHub
<#558 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACRDMXECR56TTDQFROAGCLYV33PTAVCNFSM6AAAAABD7KOPD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG42TQMJRHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@starksm64 does your WFLY have latest CDI API in it? |
Basically all of the invoker tests appear to be failing with a CNFE on
jakarta.enterprise.inject.build.compatible.spi.InvokerFactory, so the
wildfly modules must not be updated correctly or something is missing.
```
[ERROR] VoidMethodInvokerTest>Arquillian.arquillianBeforeClass:99 »
Deployment Cannot deploy
VoidMethodInvokerTestfee3f7268256c72de774ea3e923d56c6497eac9.war:
{"WFLYCTL0062: Composite operation failed and was rolled back. Steps that
failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" =>
{"jboss.deployment.unit.\"VoidMethodInvokerTestfee3f7268256c72de774ea3e923d56c6497eac9.war\".WeldStartService"
=> "Failed to start service
Caused by: org.jboss.weld.exceptions.DefinitionException: Exception
List with 1 exceptions:
Exception 0 :
jakarta.enterprise.event.ObserverException
at
java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at
java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at
java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:304)
at java.base/java.lang.Class.newInstance(Class.java:725)
at ***@***.***
//org.jboss.weld.security.NewInstanceAction.run(NewInstanceAction.java:33)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
at ***@***.***
//org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40)
at ***@***.***
//org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:78)
at ***@***.***
//org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:107)
at ***@***.***
//org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:199)
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.api//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.as.weld.WeldStartService.start(WeldStartService.java:79)
at ***@***.***
//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1617)
at ***@***.***
//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1580)
at ***@***.***
//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1438)
at ***@***.***
//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at ***@***.***
//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at ***@***.***
//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at ***@***.***
//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NoClassDefFoundError:
jakarta/enterprise/inject/build/compatible/spi/InvokerFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at
java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2676)
at ***@***.***
//org.jboss.weld.lite.extension.translator.ExtensionInvoker.lambda$findExtensionMethods$0(ExtensionInvoker.java:50)
at
java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
at
java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1787)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at ***@***.***
//org.jboss.weld.lite.extension.translator.ExtensionInvoker.findExtensionMethods(ExtensionInvoker.java:64)
at ***@***.***
//org.jboss.weld.lite.extension.translator.ExtensionPhaseBase.run(ExtensionPhaseBase.java:29)
at ***@***.***
//org.jboss.weld.lite.extension.translator.LiteExtensionTranslator.discovery(LiteExtensionTranslator.java:63)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at ***@***.***
//org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:99)
... 25 more
Caused by: java.lang.ClassNotFoundException:
jakarta.enterprise.inject.build.compatible.spi.InvokerFactory from [Module
\"deployment.VoidMethodInvokerTestfee3f7268256c72de774ea3e923d56c6497eac9.war\"
from Service Module Loader]
at
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 42 more
"}}}}
```
…On Thu, Feb 29, 2024 at 3:46 AM Matej Novotny ***@***.***> wrote:
Ok, so when I look at the resulting (WAR) archive Arq. generates, the test
class is *not* part of it, despite being explicitly added in the test.
And looking into how we build test archive, I found that this bit
<https://github.com/jakartaee/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/shrinkwrap/ArchiveBuilder.java#L1281-L1284>
will exclude the class if it is running in client mode and the class name
equals to the test name. And while I don't recall what the client mode
really was (but apparently we are running in it), this seems very
deliberate :)
Maybe this rings a bell @Ladicek <https://github.com/Ladicek> or
@starksm64 <https://github.com/starksm64>?
—
Reply to this email directly, view it on GitHub
<#558 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACRDMQ4FVPLP24XUE2P7OTYV34IFAVCNFSM6AAAAABD7KOPD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG42DSNZRGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes, see my previous comment :) |
Yes it does, but there were some mistakes in it. I now have the 4.1.x
branch of https://github.com/jakartaredhat/cdi-tck passing all tests but
the
updated org.jboss.cdi.tck.tests.invokers.invalid.ctor.ConstructorInvokerTest
which is using a inner class. You should be able to follow the steps on the
https://issues.redhat.com/browse/WELD-2782 issue to reproduce this.
2024-02-29 04:40:11,377 INFO [org.jboss.weld.Bootstrap] (Weld Thread Pool
-- 1) WELD-000119: Not generating any bean definitions from
org.jboss.cdi.tck.tests.invokers.invalid.ctor.ConstructorInvokerTest$MyService
because of underlying class loading error: Type
org.jboss.cdi.tck.tests.invokers.invalid.ctor.ConstructorInvokerTest from
[Module
"deployment.ConstructorInvokerTest35162967636eea6857b4c0ace3be8bce6ffebd.war"
from Service Module Loader] not found. If this is unexpected, enable DEBUG
logging to see the full error.
…On Thu, Feb 29, 2024 at 4:12 AM Matej Novotny ***@***.***> wrote:
Caused by: java.lang.NoClassDefFoundError:
jakarta/enterprise/inject/build/compatible/spi/InvokerFactory
@starksm64 <https://github.com/starksm64> does your WFLY have latest CDI
API in it?
I had a patching profile in core repo for this (that CI uses as well), see
https://github.com/weld/core/blob/master/jboss-as/pom.xml#L214-L217
—
Reply to this email directly, view it on GitHub
<#558 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACRDMRT6JB3H7DG773BCPDYV37J3AVCNFSM6AAAAABD7KOPD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG44DGNZRG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@starksm64 Yes, I was able to reproduce immediately even without the TCK I do not think this is something we can fix on Weld side - it seems that tests expecting a failure should be running as |
As captured in the related Weld issue, I don't think this really is a Weld issue. And that's a problem when analyzing some of the nested static classes as Weld (or any other impl really) will at some point need to verify that they are valid beans - i.e. that they are top level classes or nested static classes. This eventually leads to |
Ok, I'll move that test back to not using nested classes. |
I added the ability to run the core tests inside wildfly with the updated weld jars, and I'm seeing the new invoker tests that expect a failure not generating a failure when run inside of wildfly. The log was showing:
So looking at the tests, they were not adding the BuildCompatibleExtension to the test archive, so I fixed that, but then the deployments failed to generate an error due to:
All of the inner classes used by the InterceptorInvokerTest are static, so I'm not clear on why there is an attempt to load the InterceptorInvokerTest class. Maybe something I'm not familiar with regarding inner classes. It does seem as though weld should be generating an exception here rather than log logging an error. I'll create a separate issue for that.
I have just refactored the tests to not use inner classes and I have all core tck tests passing with embedded weld as well as when run from within wildfly.
The text was updated successfully, but these errors were encountered: