aspose file tools*
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
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: 6
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: 2627
    
    9

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 OCPBCD5
Mamata Roy
Greenhorn

Joined: Jul 22, 2013
Posts: 6
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: 6
Is there any solution to this?
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2627
    
    9

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