我正在将一个Jboss5
应用程序转换为JBoss7
,并且使用EJBs.
遇到了问题
每当从本地bean调用方法时,似乎都会出现授权异常。 EJB
应用的Java 8
结构如何从EAP 5更改为EAP 7?
错误
ERROR [org.jboss.as.ejb3.invocation] WFLYEJB0034: EJB Invocation failed on component ManagerLocal for method public abstract java.util.List com.data.manager.local.ManagerLocal.searchRequests(...): javax.ejb.EJBAccessException: WFLYEJB0364: Invocation on method: public abstract java.util.List com.data.manager.local.ManagerLocal.searchRequests(...) of bean: ManagerLocal is not allowed
at org.jboss.as.ejb3.security.AuthorizationInterceptor.processInvocation(AuthorizationInterceptor.java:134)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:632)
at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
at com.data.manager.local.ManagerLocal$$$view153.searchRequests(Unknown Source)
at com.web.resource.RequestResource.searchRequests(RequestResource.java:397)
at com.trigger.handler.TriggerHandler.execute(TriggerHandler.java:43)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
本地Bean
@Local
@PermitAll()
public interface ManagerLocal {
@PermitAll()
public List<Request> searchRequests(...);
}
资源
@Path("/request")
public class RequestResource {
static final Logger logger = LoggerFactory.getLogger(RequestResource.class);
private static final String SLASH = "/";
public RequestResource(){
}
@PermitAll()
private ManagerLocal getRequestManager()
{
ManagerLocal manager = null;
try
{
manager = LookupUtil.lookup(ManagerLocal.class);
}
catch (NamingException e)
{
throw new RuntimeException("Couldn't get an instance of manager bean", e);
}
return manager;
}
@PermitAll()
public List<Request> searchRequests(...){
return getRequestManager().searchRequests(...);
}
}