Hello List,
When I try to call a method in any entity bean(through a session bean) I
get the following error:
java.rmi.NoSuchObjectException: no such object in table
...
at $Proxy3.getCategorydesc(Unknown Source)
This is happening with all my entity accessors, mutators and inserts.
Everything works fine with Inprise App Server, but JBoss is giving me
problems. I've read jaws documentation and I can't figure out what is wrong.
This is the code In my session:
try {
Context jndiContext = new InitialContext();
Object category_lookup =
jndiContext.lookup("java:comp/env/ejb/category");
categoryHome category = (categoryHome)
javax.rmi.PortableRemoteObject.narrow(category_lookup,categoryHome.class);
Ccategorypk catpk = new Ccategorypk();
category cat=null;
catpk.cat_id=id;
try {
cat = category.findByPrimaryKey(catpk);
returndesc = cat.getCatDesc();
} catch (javax.ejb.FinderException fe) { fe.printStackTrace();
return null; }
return returndesc;
} catch (Exception e) {throw new javax.ejb.EJBException(e); }
My jaws.xml has:
<enterprise-beans>
<entity>
<ejb-name>category</ejb-name>
<table-name>category</table-name>
<cmp-field>
<field-name>cat_id</field-name>
<column-name>cat_id</column-name>
</cmp-field>
<cmp-field>
<field-name>cat_name</field-name>
<column-name>cat_name</column-name>
</cmp-field>
<cmp-field>
<field-name>cat_desc</field-name>
<column-name>cat_desc</column-name>
</cmp-field>
</entity>
</enterprise-beans>
My ejb-jar.xml has:
<entity>
<ejb-name>category</ejb-name>
<home>accessprj.categoryHome</home>
<remote>accessprj.category</remote>
<ejb-class>accessprj.categoryBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>accessprj.Ccategorypk</prim-key-class>
<reentrant>False</reentrant>
<cmp-field>
<field-name>cat_id</field-name>
</cmp-field>
<cmp-field>
<field-name>cat_name</field-name>
</cmp-field>
<cmp-field>
<field-name>cat_desc</field-name>
</cmp-field>
<ejb-ref>
<ejb-ref-name>ejb/category</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>accessprj.categoryHome</home>
<remote>accessprj.category</remote>
<ejb-link>category</ejb-link>
</ejb-ref>
<resource-ref>
<res-ref-name>jdbc/library</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
The table is called 'category' and has fields 'cat_id', 'cat_name' and
'cat_desc'. The code of my entity is as follows:
public class categoryBean implements EntityBean {
EntityContext entityContext;
public int cat_id;
public String cat_name;
public String cat_desc;
public Ccategorypk ejbCreate(int catid, String catname,String catdesc)
throws CreateException {
this.cat_id = catid;
this.cat_name = catname;
this.cat_desc = catdesc;
return null;
}
public int getCatId() {
return cat_id;
}
public String getCatName() {
return cat_name;
}
public String getCatDesc() {
return cat_desc;
}
public void setCatName(String str) {
this.cat_name = str;
}
public void setCatDesc(String str) {
this.cat_desc = str;
}
public void ejbPostCreate(int catid, String catname,String catdesc) throws
CreateException {
}
public void ejbRemove() throws RemoveException {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void ejbLoad() {
}
public void ejbStore() {
}
public void setEntityContext(EntityContext entityContext) {
this.entityContext = entityContext;
}
public void unsetEntityContext() {
entityContext = null;
}
}
Yours desperate,
Carlos Ferrao
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user