[weld-issues] [JBoss JIRA] Commented: (WELD-737) Proxy instantiation fails with IllegalAccessError for Beans with package private constructor

Sivakumar Thyagarajan (JIRA) jira-events at lists.jboss.org
Mon Dec 6 05:29:47 EST 2010


    [ https://jira.jboss.org/browse/WELD-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567746#comment-12567746 ] 

Sivakumar Thyagarajan commented on WELD-737:
--------------------------------------------

Hi Stuart: I understand the reasons for not doing this and yes, with the fixing of JASSIST-104 and WELD-570, the partial exports and the corr classloader leaks have been fixed. However I was wondering how implementations that use the weld osgi-bundle could support this package private constructor usecase. They would also need to have a fragment based approach like the one GlassFish uses [1] to make the extra javassist packages used by the proxies available to the application classloader. Is this right and recommended?

[1] https://fisheye4.atlassian.com/changelog/glassfish-svn?cs=42968

> Proxy instantiation fails with IllegalAccessError for Beans with package private constructor
> --------------------------------------------------------------------------------------------
>
>                 Key: WELD-737
>                 URL: https://jira.jboss.org/browse/WELD-737
>             Project: Weld
>          Issue Type: Bug
>          Components: GlassFish Integration, Proxies
>    Affects Versions: 1.1.0.Beta1
>            Reporter: Sivakumar Thyagarajan
>            Assignee: Stuart Douglas
>              Labels: beans, constructor, initializer, proxy, scoped
>             Fix For: 1.1.0.CR1
>
>         Attachments: package-private-constructor-issue.tar.bz2, ProxyServicesImpl.java
>
>
> For Beans with package private constructors, proxy instantiation fails with an Illegal access error as shown below. Since 1.1.0.Beta1 the proxy creation logic in ProxyFactory.addConstructors handles private constructors correctly but doesn't consider package private constructors.
> ----
> Caused by: java.lang.IllegalAccessError: tried to access method org.glassfish.tests.proxies.TestSessionScopedBean.<init>()V from class org.glassfish.tests.proxies.org$jboss$weld$bean-$export$work$workspaces$gfv3$v3$distributions$glassfish$target$glassfish3$glassfish$domains$domain1$applications$jsr88-1370237334428885039$-ManagedBean-class_org$glassfish$tests$proxies$TestSessionScopedBean_$$_WeldProxy
>         at org.glassfish.tests.proxies.org$jboss$weld$bean-$export$work$workspaces$gfv3$v3$distributions$glassfish$target$glassfish3$glassfish$domains$domain1$applications$jsr88-1370237334428885039$-ManagedBean-class_org$glassfish$tests$proxies$TestSessionScopedBean_$$_WeldProxy.<init>(org$jboss$weld$bean-$export$work$workspaces$gfv3$v3$distributions$glassfish$target$glassfish3$glassfish$domains$domain1$applications$jsr88-1370237334428885039$-ManagedBean-class_org$glassfish$tests$proxies$TestSessionScopedBean_$$_WeldProxy.java)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>         at java.lang.Class.newInstance0(Class.java:355)
>         at java.lang.Class.newInstance(Class.java:308)
>         at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:396)
>         at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
>         at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:216)
>         at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:391)
>         at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:218)
>         at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:89)
>         at org.jboss.weld.bean.proxy.ClientProxyProvider.access$000(ClientProxyProvider.java:40)
>         at org.jboss.weld.bean.proxy.ClientProxyProvider$1.apply(ClientProxyProvider.java:53)
>         at org.jboss.weld.bean.proxy.ClientProxyProvider$1.apply(ClientProxyProvider.java:44)
>         at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
> ----

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list