• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Help !!!! StringIndexOut.....

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do i get the following error when I call the create on an entity bean.
FYI - The create method doesn't have any String arguments passed to it.All the parameters are int and short.

java.lang.StringIndexOutOfBoundsException: String index out of range: 0; nested exception is: javax.ejb.EJBException:
Thanks
Prahsanth
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This isn't enough information to go on, I would have to see some code to help.
 
Ram Pra
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the bean code ...
package com.ltcg.resol.dataaccess.exrule;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.CreateException;
import java.sql.SQLException;
import javax.ejb.FinderException;
import java.util.Collection;
/**
* @ejbHome <{com.ltcg.resol.DataAccess.ExRule.resol_pol_ex_rule_typeHome}>
* @ejbRemote <{com.ltcg.resol.DataAccess.ExRule.resol_pol_ex_rule_type}>
* @ejbPrimaryKey <{com.ltcg.resol.DataAccess.ExRule.resol_pol_ex_rule_typePK}>
* @ejbSchemaName dbo*/
public class resol_pol_ex_rule_typeBean implements EntityBean {
private EntityContext ctx;
public int resol_pol_ex_rule_type_id;
public short rpert_logical_operator_cd;
public short rpert_value;
public short resol_pol_ex_type_status_cd;
public short resol_pol_ex_type_cd;
public int resol_pol_ex_type_status_id;
public int resol_pol_ex_rule_id;
private resol_pol_ex_ruleBean FK_relationship2;
public void setEntityContext(EntityContext context) throws RemoteException, EJBException {
ctx = context;
}
public void unsetEntityContext() throws RemoteException, EJBException {
ctx = null;
}
public void ejbActivate() throws RemoteException, EJBException {
}
public void ejbPassivate() throws RemoteException, EJBException {
}
public void ejbRemove() throws RemoteException, EJBException {
}
public void ejbStore() throws RemoteException, EJBException {
}
public void ejbLoad() throws RemoteException, EJBException {
}
/**
* This method initializes the bean and creates a record in the resol_pol_ex_rule_type table
* @param int resol_pol_ex_rule_type_id
* short rpert_logical_operator_cd
*
* @return Object;Object of type resol_pol_ex_rule_typePK
* @exception CreateException, EJBException, RemoteException, SQLException
*/
public resol_pol_ex_rule_typePK ejbCreate(int resol_pol_ex_rule_type_id, short rpert_logical_operator_cd, short rpert_value, short resol_pol_ex_type_status_cd, short resol_pol_ex_type_cd, int resol_pol_ex_type_status_id, int resol_pol_ex_rule_id) throws CreateException, EJBException, RemoteException, SQLException {
this.resol_pol_ex_rule_type_id = resol_pol_ex_rule_type_id;
this.rpert_logical_operator_cd = rpert_logical_operator_cd;
this.rpert_value = rpert_value;
this.resol_pol_ex_type_status_cd = resol_pol_ex_type_status_cd;
this.resol_pol_ex_type_cd = resol_pol_ex_type_cd;
this.resol_pol_ex_type_status_id = resol_pol_ex_type_status_id;
this.resol_pol_ex_rule_id = resol_pol_ex_rule_id;
return null;
}
public void ejbPostCreate(int resol_pol_ex_rule_type_id, short rpert_logical_operator_cd, short rpert_value, short resol_pol_ex_type_status_cd, short resol_pol_ex_type_cd, int resol_pol_ex_type_status_id, int resol_pol_ex_rule_id) throws CreateException, EJBException, RemoteException, SQLException {
// Write your code here
}
/**
* This method finds the unique exclusion rule type indexed by primary key
*
* @param Object;Object of type resol_pol_ex_rule_typePK
* @return Object;Object of type resol_pol_ex_rule_type
* @exception FinderException,EJBException, RemoteException, SQLException
*/
public resol_pol_ex_rule_type ejbFindByPrimaryKey( resol_pol_ex_rule_typePK pk) throws FinderException, RemoteException, EJBException {
this.resol_pol_ex_rule_type_id = pk.resol_pol_ex_rule_type_id;
return null;
}
/**
* This method finds all rule types for a rule
*
* @param int resol_pol_ex_rule_id
* @return Collection;collection of primary keys
* @exception FinderException,EJBException, RemoteException, SQLException
*/
public Collection ejbFindAllRuleTypeForRule(int param) throws FinderException, RemoteException, EJBException {
this.resol_pol_ex_rule_id = param;
return null;
}
public int getResol_pol_ex_rule_type_id(){ return resol_pol_ex_rule_type_id; }
public void setResol_pol_ex_rule_type_id(int param){ this.resol_pol_ex_rule_type_id = param; }
public short getRpert_logical_operator_cd(){ return rpert_logical_operator_cd; }
public void setRpert_logical_operator_cd(short param){ this.rpert_logical_operator_cd = param; }
public short getRpert_value(){ return rpert_value; }
public void setRpert_value(short param){ this.rpert_value = param; }
public short getResol_pol_ex_type_status_cd(){ return resol_pol_ex_type_status_cd; }
public void setResol_pol_ex_type_status_cd(short param){ this.resol_pol_ex_type_status_cd = param; }
public short getResol_pol_ex_type_cd(){ return resol_pol_ex_type_cd; }
public void setResol_pol_ex_type_cd(short param){ this.resol_pol_ex_type_cd = param; }
public int getResol_pol_ex_type_status_id(){ return resol_pol_ex_type_status_id; }
public void setResol_pol_ex_type_status_id(int param){ this.resol_pol_ex_type_status_id = param; }
public int getResol_pol_ex_rule_id() {return resol_pol_ex_rule_id ;}
public void setResol_pol_ex_rule_id(int param) { this.resol_pol_ex_rule_id = param ;}
}
*************************************************\
The method from which I am calling the create method is ....
public void createExRuleTypes(EJBFactoryWrapper ejbFact, ExRuleTypeVO param) throws RemoteException, ExRuleException {
jndiName = "java:resol_pol_ex_rule_typeBean";
try
{
System.out.println("In createExRuleType - ");
System.out.println("In createExRuleType - " + "ruleTypeId=" + param.ruleTypeId + " logicalOpCd= " +
param.logicalOpCd + " ruleTypeValue=" + param.ruleTypeValue +
" ruleTypeStatusCd=" + param.ruleTypeStatusCd + " typeCd=" + param.typeCd
+ " typeStatusId=" + param.typeStatusId + " ruleId=" + param.ruleId);
resolPolExRuleTypeHome = (resol_pol_ex_rule_typeHome) ejbFact.getHomeInterface(jndiName);
System.out.println("In createExRuleType - Got the home interface " + resolPolExRuleTypeHome);
resolPolExRuleType = resolPolExRuleTypeHome.create(param.ruleTypeId, param.logicalOpCd, param.ruleTypeValue, param.ruleTypeStatusCd, param.typeCd, param.typeStatusId, param.ruleId);
System.out.println("In createExRuleType - Created the data " );
}
catch (Exception exception)
{
throw new ExRuleException("Error creating rule type in ExRuleBean" + exception.getMessage(), exception);
}
}
Hope this info will do.
Thanks ,
Prashanth
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check your client code.
u might have passed a string argument/empty quotations in the method call.
Regs
Nag
[ October 10, 2002: Message edited by: nageswara spy ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic