我希望有人在weblogic之前遇到过这个错误。
我使用双向SSL,RMI over T3S设置远程EJB调用。以下代码运行完美:
Environment env = new Environment();
env.setProviderUrl("t3s://localhost:7002");
env.setSecurityPrincipal("");
Context ctx = env.getContext();
IMyEJB bean = (IMyEJB)ctx.lookup("java:global.ejb.MyEJB!com.sample.IMyEJB");
System.out.println(bean.getMessage());
但是当我注释掉env.setSecurityPrincipal("");我得到例外,有人知道为什么吗?
Exception in thread "main" javax.ejb.EJBAccessException: [EJB:010160]Security violation: User <anonymous> has insufficient permission to access EJB type=<ejb>, application=ejb, module=ejb.jar, ejb=MyEJB, method=getMessage, methodInterface=Remote, signature={}.
at weblogic.ejb.container.internal.MethodDescriptor.checkMethodPermissionsBusiness(MethodDescriptor.java:201)
at weblogic.ejb.container.internal.BaseRemoteObject.__WL_preInvoke(BaseRemoteObject.java:118)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:23)
at com.sample.MyEJB_lkq74w_IMyEJBImpl.getMessage(Unknown Source)
at com.sample.MyEJB_lkq74w_IMyEJBImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:701)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:231)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:527)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:523)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)