title: Problem with using @Default class in modules, only @Specializes works
body: <p>There is maven project with multiple modules.
  There is one class that should have the same behavior
  for all of the modules except one:</p>
  
  <pre><code>@Default
  public class DefaultClassLoader {
      ...
  
      public String whoAmI(){
          return "Default";
      }
  
      @Retry(maxRetries = Integer.MAX_VALUE, delayUnit = ChronoUnit.SECONDS, delay = 5, retryOn = WebApplicationException.class)
      @Asynchronous
      @AccessTimeout(value = Long.MAX_VALUE)
      public void load(String moduleName, AboveIt aboveIt) {
      ....    
      }
  
  }
  </code></pre>
  
  <p>The one <strong><em>@Specializes</em></strong> overridden default class:  </p>
  
  <pre><code>@Specializes
  public class SpecificClassLoader extends DefaultClassLoader {
  
      @Override
      public String whoAmI(){
          return "Specific";
      }
  
      @Retry(maxRetries = Integer.MAX_VALUE, delayUnit = ChronoUnit.SECONDS, delay = 5, retryOn = WebApplicationException.class)
      @Asynchronous
      @AccessTimeout(value = Long.MAX_VALUE)
      public void load(String moduleName, AboveIt aboveIt) {
      #This is working well
      #Using somethingToSet instance
      ...
  
      }
  }
  </code></pre>
  
  <p>And lastly, class that is using <strong><em>DefaultClassLoader</em></strong>:</p>
  
  <pre><code>@Singleton
  @Startup
  public class AboveIt {
  
      ...
  
      @Inject
      private DefaultClassLoader defaultClassLoader;
  
      @PostConstruct
      public void load() {
          System.out.println(defaultClassLoader.whoAmI());
          System.out.println(defaultClassLoader);
          defaultClassLoader.load(moduleName, this);
      }
  
      ...
  }
  </code></pre>
  
  <p>Classes <strong><em>DefaultClassLoader</em></strong> and <strong><em>AboveIt</em></strong> are stored in module building to .jar which is used by many other modules that are builded to .war, that are deployed by payara server.
  Class <em>SpecificClassLoader</em> is stored in directory structure of that one specific module.</p>
  
  <p>Calling <strong><em>System.out.println(defaultClassLoader)</em></strong> in <strong><em>AboveIt</em></strong> class works everytime, but calling
  <strong><em>defaultClassLoader.load(moduleName, this)</em></strong> works only with SpecificClassLoader.</p>
  
  <p>Result of <strong><em>System.out.println(defaultClassLoader)</em></strong> in payara's ServerLog
  when deploying the one specific module:</p>
  
  <pre><code>[path].SpecificClassLoader@3d6bf268
  </code></pre>
  
  <p>Result of <strong><em>System.out.println(defaultClassLoader)</em></strong> with deploying any other module:</p>
  
  <pre><code>[path].DefaultClassLoader$Proxy$_$$_WeldSubclass@2054826f
  </code></pre>
  
  <p>And consequently exception on the next line (<strong><em>defaultClassLoader.load(moduleName, this)</em></strong>):</p>
  
  <pre><code>Exception while loading the app : javax.ejb.CreateException: Initialization failed for Singleton AboveIt
  javax.ejb.CreateException: Initialization failed for Singleton AboveIt
    at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:564)
    at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:78)
    at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:734)
    at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:438)
    at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
    at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
    at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
    at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:169)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:123)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:294)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:357)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.java:535)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:542)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:557)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:553)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:552)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:583)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:574)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1483)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:119)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1865)
    at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:149)
    at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:532)
    at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:437)
    at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:371)
    at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:362)
    at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:231)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
  Caused by: org.eclipse.microprofile.faulttolerance.exceptions.FaultToleranceException: Retry failed
    at fish.payara.microprofile.faulttolerance.policy.FaultTolerancePolicy.processRetryStage(FaultTolerancePolicy.java:386)
    at fish.payara.microprofile.faulttolerance.policy.FaultTolerancePolicy.processFallbackStage(FaultTolerancePolicy.java:326)
    at fish.payara.microprofile.faulttolerance.policy.FaultTolerancePolicy.processAsynchronousStage(FaultTolerancePolicy.java:281)
    at fish.payara.microprofile.faulttolerance.policy.FaultTolerancePolicy.proceed(FaultTolerancePolicy.java:268)
    at fish.payara.microprofile.faulttolerance.cdi.FaultToleranceInterceptor.intercept(FaultToleranceInterceptor.java:79)
    at sun.reflect.GeneratedMethodAccessor814.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73)
    at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84)
    at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72)
    at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56)
    at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79)
    at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68)
    at eu.inloop.mcore.common.DefaultClassLoader$Proxy$_$$_WeldSubclass.load(Unknown Source)
    at eu.inloop.mcore.common.AboveIt.load(AboveIt.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1047)
    at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
    at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:206)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
    at sun.reflect.GeneratedMethodAccessor623.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:998)
    at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
    at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:206)
    at org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:81)
    at org.jboss.weld.module.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
    at sun.reflect.GeneratedMethodAccessor621.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:998)
    at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:417)
    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:380)
    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2087)
    at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:555)
    ... 39 more
  ]]
  </code></pre>
  
  <p>Adding <strong><em>@Alternative</em></strong>, together with <strong><em>@Specializes</em></strong> notation, and listing in beans.xml doesn't help.
  I am aware of bad injected <strong><em>defaultClassLoader</em></strong>. Why is there something with <em>Proxy</em> ? and what <em>Proxy</em> in Java EE means ? How to fix that to be fully working ?</p>