This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Not able to refer EJB Session Bean methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Not able to refer EJB Session Bean methods" Watch "Not able to refer EJB Session Bean methods" New topic
Author

Not able to refer EJB Session Bean methods

Mamata Roy
Greenhorn

Joined: Jul 22, 2013
Posts: 4
Dear all,

I am trying to call session bean methods through a delegate in my action class . Although the session object is getting created the methods are not getting called . I am not getting any error either.

The are the classes i refer

Session :

public interface TestSession extends EJBObject
{
public void insertIAFile( HashMap dataForDao, String loginId) throws SQLException,FileNotFoundException,RemoteException;
}

SessionBean;

public class TestSessionBean implements SessionBean {



public void ejbCreate()
{
}

public void ejbActivate()
{
}

public void ejbPassivate()
{
}

public void ejbRemove()
{
}

public void setSessionContext(SessionContext ctx)
{
}
public void insertIAFile(HashMap dataForDao, String loginId) throws SQLException,FileNotFoundException,RemoteException
{

try{

System.out.println("In insertIAFile of TestSessionBean");
InvAdvDao invDao = new InvAdvDao();
invDao.insertIAFile(dataForDao,loginId);

} catch...... (Not copying the exception trace)

}


Session Home :

public interface TestSessionHome extends EJBHome
{
TestSession create() throws RemoteException, CreateException;
}



Using a delegate in my action class :


invDel.insertIAFile(dataForDao,loginId);


But it doesnot go inside the bean method (marked in red).
But it does not give any error also




Please help.





K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2247
    
    7

Welcome to the Ranch.

Why is your TestSessionBean class "implements SessionBean"? Shouldn't it be "implements TestSession"?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Mamata Roy
Greenhorn

Joined: Jul 22, 2013
Posts: 4
I need to implement methods of SessionBean



public void ejbCreate()
{
}

public void ejbActivate()
{
}

public void ejbPassivate()
{
}

public void ejbRemove()
{
}

public void setSessionContext(SessionContext ctx)
{
}
Mamata Roy
Greenhorn

Joined: Jul 22, 2013
Posts: 4
Is there any solution to this?
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2247
    
    7

Are you using EJB3? If so you don't need to "implement SessionBean" interface.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to refer EJB Session Bean methods
 
Similar Threads
ejb create() Error java.lang. IllegalStateEx: Failed to find method for hash
JNDI not creating for EJB Local interfaces example
Help with exceptions
session bean create error() can anyone plzz help me out...
how to deploy ejb on sun application