is this a defect for processing org.jboss.ejb3.annotation.SecurityDomain ?
wutongjoe Feb 29, 2012 9:55 PMHi all,
I have the following simple code which is not working
@Stateless(name = "wutong_test_hello")
@Clustered
@Remote(HellowWorldRemote.class)
@Local(HellowWorldLocal.class)
@SecurityDomain(value = "my-security-domain")
public class HellowWorldImpl implements HellowWorldRemote, HellowWorldLocal {
@RolesAllowed(value = { "testuserrole" })
public String hello(String name) {
String ret = "hello: " + name ;
log.info(ret + ",hashcode:" + hashCode());
return ret;
}
every time I invoke hello method from remote standalone app, server print the following stacks
10:14:33,204 INFO [org.jboss.ejb.client.ClusterContext] Added a new EJB receiver in cluster context ejb for node joe-pc. Total nodes in cluster context = 1
10:14:33,480 INFO [org.jboss.ejb.client.remoting.ChannelAssociation] Discarding result for invocation id 0 since no waiting context found
javax.ejb.EJBAccessException: JBAS014502: Invocation on method: public abstract java.lang.String com.biz.ejb.face.HellowWorldRemote.hello(java.lang.String) of bean: wutong_test_hello is not allowed
at org.jboss.as.ejb3.security.AuthorizationInterceptor.processInvocation(AuthorizationInterceptor.java:101)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:76)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:300)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$200(MethodInvocationMessageHandler.java:64)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:194)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
I then place the @SecurityDomain on both HellowWorldLocal and HellowWorldRemote like
@SecurityDomain(value = "my-security-domain")
public interface HellowWorldRemote {
String hello(String name);
}
and remove the annotation from HellowWorldImpl, the server never print any exception and method returned successfully but AuthorizationInterceptor is not in the stack
API doc of org.jboss.ejb3.annotation.SecurityDomain does not indicate that it should be placed on interfaces and some demos on internet also put @SecurityDomain on concrete class but not interface.Did I make any mistake on api ? or misunderstand some concepts?
EJBs are running on JBAS 7.1 final with standalone-ha-full conf
Thank you very much