Dear Arnaud,
thankyou very much for all your help. I have done exactly as you have suggested,
but it still seems to give me an error!
I have attached a text file with the source code (which is the sample
application from the OCF book and the error recieved when running) I have the
configuration setup just as suggested and I have also enclosed my
opencard.properties file for your reference.
I cannot seem to figure out why I am getting this error! Please Help!!
Any help from anyone will be appreciated!
Cheers
Ash
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Cc: Jean-Christophe Raynon <[EMAIL PROTECTED]>
> Subject: OCF with SCM Microsystems swapsmart
> MIME-Version: 1.0
>
> Hello,
>
> The java version of the CardTerminal for the SwapSmart SCM has not
> been yet implemented but it is possible to work with it using PC/SC
> drivers with the OCF/PC-SC wrapper as follow:
>
> <<readers.cfg>> <<reference-terminals-windows.jar>>
>
> <<opencard.properties>>
>
> - Iincludes these 3 files in the JRE\LIB\EXT directory and update
> the classpath.
>
> - Includes the OCFPCSC1.dll in the JRE\BIN directory.
>
> Regards,
>
> Arnaud JOUSSELIN
>
> _________________________________________________
> Arnaud Jousselin
> SCM Microsystems
> Athelia III - Voie Atlas - 13705 La Ciotat Cedex - France.
> Tel: +33 (0)4.42.83.80.00 Fax: +33 (0)4.42.83.80.01
> Direct : +33 (0)4.42.83.80.06
> e-mail: [EMAIL PROTECTED]
> _________________________________________________
>
>
_____________________________________________________________________
`,
,\, # _____________
* |/ ? | '\\\\\\
Ashish Goenka | ~ \ | ' ____|_
Systems Engineer \//, /_ /\ \_____ | '||::::::
Sun Microsystems `-o' / \_/ '\ | '||_____|
2 Woodside Road | \ ' / \'________|_____|
Farnborough | )- o < ___/____|___\___
Hampshire GU14 6XR `_/'------------| _ ' <<<:|
Phone : +44(0)1252 399514 /________\| |_________'___o_o| b'ger
smartcenter# more ReadFile.java
import opencard.core.terminal.CardTerminalFactory;
import opencard.core.service.SmartCard;
import opencard.core.service.CardRequest;
import opencard.opt.iso.fs.FileAccessCardService;
import opencard.opt.iso.fs.CardFile;
public class ReadFile {
public static void main( String []args)
{
System.out.println("reading from smartcard...");
try{
System.out.println("Starting SmartCard Services");
SmartCard.start();
CardRequest cr = new CardRequest(FileAccessCardService.class);
SmartCard sc = SmartCard.waitForCard(cr);
if (sc == null) {
System.out.println("Sorry, card not supported");
System.exit(0);
}
else {
FileAccessCardService facs =
(FileAccessCardService)sc.getCardService(FileAccessCardService.class, true);
CardFile file = new CardFile(facs, ":c009");
byte[] data = facs.read(file.getPath(), 0,
file.getLength());
System.out.println(new String(data));
sc.close();
}
}//try
catch (Exception e){
System.out.println("Error Starting Card Services");
e.printStackTrace();
}//catch
finally {
try{
System.out.println("Shutting Down SmartCard Services..");
SmartCard.shutdown();
}//try
catch (Exception e){
System.out.println("Error Shutting Down SmartCard Services");
e.printStackTrace();
}//catch
}//finally
System.exit(0);
}//main
}//class
On compiling and running the file.....
smartcenter# java ReadFile
using CLASSPATH :
/usr/java/bin:/usr/java/jre/lib/ext:/usr/java/OCF1.1.1/lib/base-core.jar:/usr/java/OCF1.1.1/lib/base-opt.jar:/usr/java/OCF1.1.1/base-opt.jar:/usr/java/OCF1.1.1/lib/reference-services.jar:/usr/java/OCF1.1.1/lib/reference-terminals-windows.jar:/usr/java/OCF1.1.1/lib/ibmservices.jar:/usr/java/OCF1.1.1/migterminals.jar:/usr/java/OCF1.1.1/lib/demo.jar:/usr/java/OCF1.1.1/lib/stockbroker-x.jar:/usr/java/lib:/usr/java/lib/tools.jar:/usr/java/jre/bin:.
.....
reading from smartcard...
Starting SmartCard Services
Shutting Down SmartCard Services..
Exception in thread "main" java.lang.NoClassDefFoundError:
opencard/core/terminal/CardTerminalFactory
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass0(Compiled Code)
at java.lang.ClassLoader.defineClass(Compiled Code)
at java.security.SecureClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.access$1(Compiled Code)
at java.net.URLClassLoader$1.run(Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Compiled Code)
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Compiled Code)
at java.lang.Class.forName(Compiled Code)
at opencard.core.service.SmartCard.handleTerminalFactoryEntries(Compiled Code)
at opencard.core.service.SmartCard.configureTerminalRegistry(Compiled Code)
at opencard.core.service.SmartCard.start(SmartCard.java:527)
at ReadFile.main(ReadFile.java:14)
smartcenter#
# Copyright � 1997 - 1999 IBM Corporation.
#
# Redistribution and use in source (source code) and binary (object code)
# forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributed source code must retain the above copyright notice, this
# list of conditions and the disclaimer below.
# 2. Redistributed object code must reproduce the above copyright notice,
# this list of conditions and the disclaimer below in the documentation
# and/or other materials provided with the distribution.
# 3. The name of IBM may not be used to endorse or promote products derived
# from this software or in any other form without specific prior written
# permission from IBM.
# 4. Redistribution of any modified code must be labeled "Code derived from
# the original OpenCard Framework".
#
# THIS SOFTWARE IS PROVIDED BY IBM "AS IS" FREE OF CHARGE. IBM SHALL NOT BE
# LIABLE FOR INFRINGEMENTS OF THIRD PARTIES RIGHTS BASED ON THIS SOFTWARE. ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IBM DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THIS
# SOFTWARE WILL MEET THE USER'S REQUIREMENTS OR THAT THE OPERATION OF IT WILL
# BE UNINTERRUPTED OR ERROR-FREE. IN NO EVENT, UNLESS REQUIRED BY APPLICABLE
# LAW, SHALL IBM BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ALSO, IBM IS UNDER NO OBLIGATION
# TO MAINTAIN, CORRECT, UPDATE, CHANGE, MODIFY, OR OTHERWISE SUPPORT THIS
# SOFTWARE.
# **** Services ****
OpenCard.services = com.ibm.opencard.factory.MFCCardServiceFactory
#*********************************************************************************
# **** OCF/PC-SC wrapper *****
#
OpenCard.terminals = com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory
#
#*********************************************************************************
#######################
# TRACE configuration #
#######################
OpenCard.trace = opencard:6 com.ibm:6 demos.samples:6