|
|
|
h2. Non public interface producer
With the following:
{code} /* package-private */ interface NonPublicInterface { }
@Produces @ApplicationScoped NonPublicInterface producer() { } {code}
With Weld SE, the following exception is thrown: {code} Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Producer Method [NonPublicInterface] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @ApplicationScoped producer()] with class class java.lang.Object using classloader sun.misc.Launcher$AppClassLoader@5ce345c2 Caused by: java.lang.RuntimeException: java.lang.IllegalAccessError: class org.jboss.weld.proxies.NonPublicInterface$1654568476$Proxy$_$$_WeldClientProxy cannot access its superinterface NonPublicInterface Caused by: java.lang.IllegalAccessError: class org.jboss.weld.proxies.NonPublicInterface$1654568476$Proxy$_$$_WeldClientProxy cannot access its superinterface NonPublicInterface {code}
*For injection points within the same package.* Note that works fine with OpenWebBeans.
h2. Private nested class
With the following: {code} import com.codahale.metrics.MetricRegistry;
@Produces @ApplicationScoped MetricRegistry registry = new MetricRegistry(); {code}
With Weld OSGi (in Karaf with PAX CDI), the following exception is thrown: {code} Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.IllegalAccessError: tried to access class com.codahale.metrics.MetricRegistry$MetricBuilder from class com.codahale.metrics.MetricRegistry$Proxy$_$$_WeldClientProxy at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2256) at com.google.common.cache.LocalCache.get(LocalCache.java:3990) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3994) at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4878) at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49) at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74) at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:222) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:755) at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:861) at org.jboss.weld.injection.ParameterInjectionPointImpl.getValueToInject(ParameterInjectionPointImpl.java:76) at org.jboss.weld.injection.ConstructorInjectionPoint.getParameterValues(ConstructorInjectionPoint.java:150) at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:75) at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28) at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:116) at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:179) at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158) at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101) at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141) at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:761) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:784) at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61) at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:85) at io.astefanutti.metrics.cdi.MetricsExtension.getBeanInstance(MetricsExtension.java:123) at io.astefanutti.metrics.cdi.MetricsExtension.configuration(MetricsExtension.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88) ... 44 more Caused by: java.lang.IllegalAccessError: tried to access class com.codahale.metrics.MetricRegistry$MetricBuilder from class com.codahale.metrics.MetricRegistry$Proxy$_$$_WeldClientProxy at com.codahale.metrics.MetricRegistry$Proxy$_$$_WeldClientProxy.<clinit>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:383) at org.jboss.weld.bean.proxy.DefaultProxyInstantiator.newInstance(DefaultProxyInstantiator.java:43) at org.jboss.weld.bean.proxy.ProxyFactory.run(ProxyFactory.java:307) at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:299) at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:83) at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:198) at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:188) at org.jboss.weld.bean.proxy.ClientProxyProvider.access$100(ClientProxyProvider.java:46) at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:57) at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:53) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3589) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2374) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2337) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2252) ... 74 more {code} Because {{MetricRegistry}} contains a private nested class.
h2. Package private class
With the following: {code} /* package-private */ class MyBean { } {code}
With Weld OSGi (in Karaf with PAX CDI), the following exception is thrown: {code} Caused by: java.lang.IllegalAccessError: class MyBean$Proxy$_$$_WeldClientProxy cannot access its superclass MyBean at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:108) at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:97) ... 75 more {code} For injection point within the same package and same bundle.
|
|
|
|