-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
IllegalAccessError invoking non-public @Scheduled method #17492
Comments
/cc @mkouba |
Hello @jimbogithub, could you describe your application structure in more detail? We use the package-private It seems that the invoker class and the service class are loaded by a different class loader. Isn't the |
- until now all invokers were considered application classes, i.e. they were always loaded by the Runtime Class Loader in the dev mode and so a package-private scheduled method defined in a dependency resulted in an IllegalAccessError - resolves quarkusio#17492
Yes, you're correct, the Looks like you have the fix, thanks. |
Confirmed fixed for me in 2.0.0.CR2. |
Describe the bug
An IllegalAccessError is thrown when invoking a non-public @scheduled method, e.g:
@scheduled(every = "PT10S", concurrentExecution = ConcurrentExecution.SKIP)
void myMethod() {...}
All is fine if the method is public.
Call stack looks like so:
2021-05-27 15:58:27,006 ERROR (executor-thread-2) [SimpleScheduler] Error occured while executing task for trigger IntervalTrigger [id=1_my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4, interval=10000]
java.lang.IllegalAccessError: class my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4 tried to access method my.redacted.Service.myMethod()V (my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @451b1c01; my.redacted.Service is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @6f45da6b)
at my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4.invokeBean(Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4.zig:46)
at io.quarkus.arc.runtime.BeanInvoker.invoke(BeanInvoker.java:20)
at io.quarkus.scheduler.runtime.SkipConcurrentExecutionInvoker.invoke(SkipConcurrentExecutionInvoker.java:37)
at io.quarkus.scheduler.runtime.SkipConcurrentExecutionInvoker.invoke(SkipConcurrentExecutionInvoker.java:19)
at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$1.run(SimpleScheduler.java:251)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:486)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1450)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:834)
Expected behavior
Expect it to work ok with default access per other Quarkus/CDI methods.
Actual behavior
Fails with IllegalAccessError.
Quarkus version or git rev
2.0.0.CR1
The text was updated successfully, but these errors were encountered: