Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT client accessing EJBs

Hi!

On Tue, Dec 03, 2002 at 03:44:38PM -0500, Alexander Kordun/CAM/Lotus wrote:
> I am writing a stand-alone SWT client that directly access EJBs deployed 
> in a WAS5 server.

That's a little bit offtopic, since it's a typical problem of
misunderstanding j2ee specification and has nothing to do with SWT.
And WAS5 is very picky on this.

> Everything seems to work fine, if I run it from 
> Websphere Application Developer, but fails when I try to run it from the 
> command line.

If you look at the section "Application Clients" in the j2ee specs,
you will notice that *everything* runs within a container, even a client.

There's no concept of a 'stand-alone' client in j2ee, just `application
clients'. How to run a client isn't specified in j2ee specs. However,
WAS5 (as well as Sun's j2ee reference implementation) require the client
to be packaged into an .ear file that (and that's really braindamaged)
contains all EJBs the client uses.

Apparantly, WAD takes care of setting up a container for running a client.
However there's no (at least no documented) way to do the same outside
of WAD.

> I suspect that I am not including the appropriate jars. Has 
> anyone done a client similar to the one I am working on? If so, I would 
> really appreciate some help on the correct websphere ejb build jars.

Oh, it's really simple :-). First of all, you have to

- write an InitialContextFactory that resolves JNDI lookups as
  'java:comp/env/Foo' to
  'cells/<cellname>/nodes/<nodename>/servers/<servername>/foo'

- If you're using JAAS, you have to guess which Callbacks a CallbackHandler must
  handle. WAS5 uses some special (undocumented) Callbacks. Have fun.

- Include everything in .../Websfear/lib into your classpath. You don't need
  everyhing, but I can't remember the 15 Jars required.

- Use IBM's 1.3 JDK. Other JDKs fail on generating the RMI-IIOP stubs (since
  com.ibm.CORBA.* classes are involved)

- Cross fingers.

HTH,
	Kili


Back to the top