Thank you,there is a error in my FIRST EJB,can you help me?

This in a servlet:
public int getNo()
TestSessionEJB test = new TestSessionEJB();
return test.getNo();
This in a TestSessionEJB class�F
package test;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
public class TestSessionEJB {
private TestSessionHome testSessionHome = null;
public TestSessionEJB() {
try {
Context ctx = new InitialContext();
Object ref = ctx.lookup("TestSession");
testSessionHome = (TestSessionHome) PortableRemoteObject.narrow(ref, TestSessionHome.class);
catch(Exception e) {
e.printStackTrace();
public TestSessionHome getHome() {
return testSessionHome;
public int getNo()
TestSession test = null;
int li_rtn = 0;
try
this.getHome();
test = testSessionHome.create();
li_rtn = test.getNo();
catch(Exception e)
return li_rtn;
Not use bas4.5,is there any error?Thanks a lot.

I don't think you know the first thing about EJBs. I think you better go back and read a book or two first before attempting to write an EJB. Mastering EJBs or Professional EJB are both good books. You are not even close to writing your first EJB.

Similar Messages

Maybe you are looking for

  • Help needed in coding

    Hi Experts, I have put a select statement in a function module which takes a lot of time to pick the data as it has got some complex selections in it. Here is the code: SELECT DOCNUM STATUS CREDAT CRETIM UPDDAT UPDTIM DIRECT IDOCTP MESTYP           F

  • No photos in events

    I just uploaded 764 photos from a SD card into Iphoto, I did not deleted from the SD card but left themm on the card, and the photosshow up on my last import and also in the librart under "Photos' however when I click on a event it say in the upper r

  • Use Control File to load data in BW7.0

    Hi All, I have a requirement to load data in BW using control file. The development is done in in BW 7.0. In BW 3.5 there is an option of FILE IS ( Control File or Data File ). Please suggest how to simulate the same in BW 7.0 Regards, Vikram

  • Receive error message:  E_IO_CANNOT_OPEN-failed to write to destination file   How do I fix?

    I encountered this problem when trying to download a book from our public library on my new NOOK.  It is our second one.  Am wondering if having two active NOOKs, one with my husband as primary user and the new one with me as primary user is the caus

  • Enabling alerts for Seeburger Monitor

    Hello, I would like to know if there is any way to enable alerts for errors in Seeburger Monitor? There is a checkbox "Enable alerts" in AS2 adapter communication channel,I tried to check it,but it doesn't seem to be working. Currently,we have to man