成功部署了一个cmp,但访问拒绝?
lyo 2003-09-15 04:33:00 已经和数据库关联上了,weblogic显示部署成功,如果用java程序访问,代码:
////////////////////testclient.java////////////////////////////////
Properties pro=new Properties();
pro.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
pro.put(Context.PROVIDER_URL,"t3://127.0.0.1:7001");
pro.put(Context.SECURITY_PRINCIPAL,"Employees");
Context ctx=new InitialContext(pro);
System.out.println("Debug...");
Object obj=ctx.lookup("CustomerEJB");
System.out.println("after lookup...");
CustomerHomeRemote home=(CustomerHomeRemote)PortableRemoteObject.narrow(obj,CustomerHomeRemote.class);
//create customers
Integer primary=new Integer(1);
CustomerRemote remote=home.create(primary);
remote.setFirstName("lyo");
remote.setLastName("Yashnoo");
CustomerRemote customer=home.findByPrimaryKey(primary);
String first=customer.getFirstName();
String last=customer.getLastName();
System.out.println("first name is"+first);
System.out.println("=================");
System.out.println("last name is"+last);
///////////////////////////////////////////////////////////
,则说:“Debug...
javax.naming.NamingException: Unhandled exception in lookup [Root exception is j
ava.lang.NullPointerException]”
如果写在jsp中在weblogic中访问,则控制台报错说:
“javax.naming.AuthenticationException [Root exception is javax.security.auth.logi
n.FailedLoginException: [Security:090304]Authentication Failed: User Employees j
avax.security.auth.login.FailedLoginException: [Security:090302]Authentication F
ailed: User Employees denied]
”
但是我的ejb-jar.xml和weblogic-ejb-jar.xml是授权了的:
///////////////////////////////////////////////
ejb-jar.xml
/////////////////////
..................
<assembly-descriptor>
<security-role>
<role-name>Employees</role-name>
</security-role>
<method-permission>
<role-name>Employees</role-name>
<method>
<ejb-name>CustomerEJB</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
.....................
weblogic-ejb-jar.xml
//////////////////////////////////
<security-role-assignment>
<role-name>Employees</role-name>
<principal-name>Employees</principal-name>
</security-role-assignment>
................................
以上不就是授权Employees可以访问所有方法,且它的密码为空吗?
而且用weblogic的系统管理员都不能访问!在weblogic中的security的group中我也加了Employees,还是不行,weblogic在哪里设密码?
我的数据库中游一条纪录,如果我把“Context.SECURITY_PRINCIPAL,"Employees");”去掉,又报错说:
"java.lang.ArrayIndexOutOfBoundsException: 13"
为什麽数组越界了?就是访问第一条数据啊?