CDI Proxy creation fails when the bean type is final or it contains a final method public in EAP 6

Solution Unverified - Updated -

Issue

  • When I deploy a war, I got UnproxyableResolutionException.
14:00:12,820 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."example.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."example.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 5 exceptions:
Exception 0 :
org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001437 Normal scoped bean class com.example.SampleBean is not proxyable because the type is final or it contains a final method public final java.lang.String com.example.SampleBean.sampleMethod() - Managed Bean [class com.example.SampleBean] with qualifiers [@Any @Default @Named].
    at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:229)
    at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:180)
    at org.jboss.weld.util.Proxies.getUnproxyableTypesExceptionInt(Proxies.java:195)
    at org.jboss.weld.util.Proxies.getUnproxyableTypesException(Proxies.java:169)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:147)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
    at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
    *CDI
  • Red Hat JBoss Portal 6.1.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content