I've been battling applets for a few days now. There seem to be several 
problems in getting a JDK 1.1 applet to talk to an EJB, even indirectly 
through JMS.

First, it's hard (impossible?) to use JNDI from an applet. jBoss' 2.0's 
implementation of the JNDI InitialContext() method requires you to set a 
couple of system-level properties:

     java.net.URL cb = getCodeBase();
     System.setProperty("java.naming.factory.initial",
       "org.jnp.interfaces.NamingContextFactory");
     System.setProperty("java.naming.provider.url",
       cb.getHost() + ":1099");
     InitialContext m_InitialContext = new InitialContext();

It looks like unsigned applets can't set system-level properties. Another 
constructor for InitialContext() has a Hashtable environment parameter. 
This doesn't work in JDK 1.1 -- there is no Hashtable. The third 
constructor, which takes a boolean parameter, isn't available in the jBoss 
JNDI implementation (but it is part of JDK 1.3).

Second, even if you use JDK 1.3 for your applet (with the Java plugin or 
appletviewer), there's a security problem connecting to JNDI on the jBoss 
server. I haven't figure out what's wrong there, but I suspect the problem 
is that an unsigned applet isn't allowed to open new sockets on your 
client. This also applies to RMI.

RMI from applets has an additional problem: MSIE's limited JVM doesn't 
support RMI classes. The RMI classes are available from Microsoft, but it 
requires your users to download and install them properly before using your 
applet -- hardly the way you want your Web software to work.

I've had the same kind of problem getting JMS to run in an unsigned JDK 1.1 
applet. After more hours than I care to think about, I've given up on that 
approach, and I'm trying to use HTTP or sockets to connect the applet with 
a servlet, where the servlet receives a JMS message from the EJB each time 
a bean is created, removed or modified. I really don't like this approach, 
because I'm not able to use all of the nifty remote object capabilities of 
J2EE this way, but 1.1 and the applet security sandbox are very limiting.

If anybody has a working implementation of realtime applet/servlet 
communication where the servlet uses an EJB for its business logic, please 
send me a note.

-- Ken Jenks, http://abiblion.com/

    Tools for reading.


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to