Hello,
John J. Berkenpas wrote:
>
> I've seen a couple of posts about a work around for the : "name can't
> be null" exception while trying to use OCF in an applet with the 1.2
> plug-in but I'm not sure I understand how to apply it. Do I need to
> modify the OCF source to ignore the exception or what? Also, does
> this problem exist in the 1.1 plug-in? I've fought my way through all
> of the security and path problems only to hit this WALL.
>
As you said, there are lots of things to care about when using
OCF inside a browser applet. I am preparing a short FAQ on the
subject. Basically, to summarize it: 1) you need to carefully read
docs from the programmer's guide and various other sources to tune
access rights and 2) there are problems with almost all type of
Java VMs that you might find on your browser:
- with Netscape4's VM, it is impossible because Netscape's way of
setting rights only works for the current thread and CommAPI is
forking at init time, then tries to read a property file..
We would need the comm.jar sources to try to find a work-around..
- with IE4/5's VM, it is impossible too because the default VM
do not understand JNI and so CardTerminals cannot work. It should
work, however, with the JNI-enabled VM that can be downloaded from
MS web-site (I haven't tried yet but I've read success stories).
- with the Java2 plugin, there is this problem that you descibed
which is a mismatch between the new Java2 security model and the
Comm API. The work-around is as follows (cut and pasted from
FAQ draft):
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* JDK1.2 Plugin vs javax.comm problems in applets. Known bug.
Also on any platform, you will have the following error (on Linux with
gnu.io.RXTXCommDriver, on Windows with com.sun.comm.Win32Driver, etc.)
always mentioning a 'name can't be null' error message:
Caught java.lang.NullPointerException: name can't be null while loading
driver com.sun.comm.Win32Driver
or
Caught java.lang.ExceptionInInitializerError while loading driver
gnu.io.RXTXCommDriver
or
Caught java.lang.IllegalArgumentException: name can't be null while
loading driver gnu.io.RXTXCommDriver
or (with IBM's Linux JDK1.3)
Caught java.lang.ExceptionInInitializerError while loading driver
com.ibm.comm.NSCommDriver
This is due to a Comm API <-> JDK1.2 security model mismatch... :-(
A work-around that fixes it given in the mailing-list (from "Haripriya
Kanduri" <[EMAIL PROTECTED]>): add this to your code:
---
String drivername = "gnu.io.RXTXCommDriver";
try {
CommDriver driver =
(CommDriver)Class.forName(drivername).newInstance();
driver.initialize();
} catch (Exception e) {
System.out.println (e.getMessage ());
}
---
The code above has to be placed before 'SmartCard.start();' in your
applet. You do not need to modify OCF sources. There is unfortunately
still an error message from javax.comm on the console, but it can be
ignored.
This quick-hacked fix has been found by Haripriya on the JDC forums
posted by Luc Kumps. The exact URL for this thread on the mismatch
between javax.comm and JDK1.2.x is:
http://forum.java.sun.com/forum?14@@.ee7e61d
(This problem with Comm API and Java2 has been declared by IBM; it's
referenced name is: Bug ID 4251547).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Note that the problem did not occured when JDK1.1.x plugins were
used. I have tried with both Sun's and IBM's implementation of
comm.jar (bundled with IBM's JDK1.3 release) and the results are
the same, although the messages are different. I haven't tried yet
with the new Solaris release of Comm (2.0.1) and I haven't tried
yet to use "Java Web Start" instead of a plugin technology, as
adviced by a Sun engineer (I'll post the results if it works! ;-D).
Hope it'll help.
Cheers,
Christophe.
= You never truly understand a thing until you can explain it =
= to your grandmother. --Albert Einstein =
--
-------------------------------------------------------------
[EMAIL PROTECTED] - Gemplus Research Lab
Phone: +33 4-42-36-57-83 | Disclaimer: I don't speak for Gemplus
Gemplus doesn't speak for me... it is better that way!
-------------------------------------------------------------
---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/
! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
! [EMAIL PROTECTED]
! containing the word
! unsubscribe
! in the body.