Title: RE: [jBoss-User] Problems getting sessionbean from servlet

Thanks. I knew it had to be something stupid that I was doing.

Dave Bolt
ATSC/SPAWAR ASAT Team
Bolt's Law of Bandwidth - There is always plenty of network bandwidth, just none for you.


-----Original Message-----
From: Toby Allsopp [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 06, 2000 5:02 PM
To: jBoss
Subject: Re: [jBoss-User] Problems getting sessionbean from servlet


Your problem is a plain Java bug:

> "Bolt, Dave" wrote:
[snip]
>    private Hashtable lookup = new Hashtable();
>    private Context ctx = null;
>    private CourseList list = null;
[snip]
>    //Process the HTTP Get request
>   public void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
[snip]
>          if (list == null)
>          {
>             ctx = new InitialContext(lookup);
>             Object ref = ctx.lookup("CourseList");
>             CourseListHome listHome =
> (CourseListHome)PortableRemoteObject.narrow (ref,
> CourseListHome.class);;
>             CourseList list = listHome.create();
>          }
>          System.out.println(list.getSize());

Aha! you assign the result of listHome.create() to a local variable that
immediately goes out of scope.

Toby.


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to