[jboss-user] [EJB/JBoss] - Fail to lookup entity bean inside a stateless session bean b
calsonli
do-not-reply at jboss.com
Tue Jul 24 21:38:22 EDT 2007
Hi all,
I am using JBoss 4.0.5 GA and myEclipse 5.1.1 GA to do a web project with EJB for database manipulation.
I created a stateless session bean which is invoked in doGet method of a servlet. I tried to add CMP entity bean lookup method in a business method of this session bean. It ends up with a "Naming Exception". The code snippet inside the business method of stateless session bean is as follows.
| try {
| // StaffLocalHome is the home interface of CMP entity bean Staff
| StaffLocalHome staffHome = StaffUtil.getLocalHome();
| StaffLocal staff = staffHome.findByPrimaryKey(new StaffPK(loginID));
| StaffData staffData = staff.getValueObject();
| ....
| catch (NamingException ne) {
| returnCode = 1;
| }
| catch (FinderException fe) {
| returnCode = -2;
| }
| catch (Exception e) {
| returnCode = 2;
| }
| ...
|
If I moved the above codes inside the servlet where stateless session bean is invoked, no problem of naming exception when looking up CMP entity bean. So, it seems that ejb-jar.xml, jboss.xml, web.xml and jboss-web.xml are correctly configured.
Could you advise where the problem is?
Thank you,
Calson
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067254#4067254
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067254
More information about the jboss-user
mailing list