成功部署了一个cmp,但client调用时说:"ArrayIndexOutOfBoundsException:"

03-09-15 lyojbuilder
已经和数据库关联上了,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);
<p>

///////////////////////////////////////////////////////////

,则说:“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");”去掉,jsp又报错说:

"java.lang.ArrayIndexOutOfBoundsException: 13"

为什麽数组越界了?访问的的确就是第一条数据

如果去掉Context.SECURITY....,java控制台程序报错:"Debug...

after lookup...

Exception in thread "main" java.lang.AbstractMethodError: lyo.cmp.customer._Cust

omerHomeRemote_Stub.create(Ljava/lang/Integer;)Llyo/cmp/customer/CustomerRemote;"

谁能解释一下为什麽会越界?

lyojbuilder
2003-09-15 17:23
重贴一下两个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>
................................

<p>

lyojbuilder
2003-09-16 07:44
他说什麽越界了?

猜你喜欢