Issue Type: Bug Bug
Assignee: Unassigned
Created: 05/Nov/13 6:48 AM
Description:

When I use @Secure annotation on my DAO classes, I am unable to use it as @Stateful bean since Weld is unable to deploy it.

11:15:41,085 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016008: Starting weld service for deployment shortener-all.war
11:15:41,330 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."shortener-all.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."shortener-all.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001402 The bean Session bean [class org.jboss.aerogear.shortener.jpa.dao.impl.LinkDaoImpl with qualifiers [@Any @Default]; local interfaces are [LinkDao] declared a passivating scope but has a non-serializable interceptor Interceptor [class org.jboss.aerogear.security.interceptor.SecurityInterceptor intercepts @Secure]
	at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
	at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001402 The bean Session bean [class org.jboss.aerogear.shortener.jpa.dao.impl.LinkDaoImpl with qualifiers [@Any @Default]; local interfaces are [LinkDao] declared a passivating scope but has a non-serializable interceptor Interceptor [class org.jboss.aerogear.security.interceptor.SecurityInterceptor intercepts @Secure]
	at org.jboss.weld.bootstrap.Validator.validateInterceptors(Validator.java:171)
	at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:143)
	at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346)
	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331)
	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
	at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
	at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
	... 5 more

However, when SecurityInterceptor implements Serializable, I am able to use it afterwards like

@Stateful
@ApplicationScoped
public class LinkDaoImpl {

    @Override
    @Secure({ "admin" })
    public int someOnlyForAdminMethod(Long id) {
        return (Integer) createNamedQuery("xyz", Integer.class).setParameter("id", id).getSingleResult();
    }
...
}
Project: AeroGear Security
Priority: Major Major
Reporter: Stefan Miklosovic
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira