InitializeUpdate function of the class CardManager from com.ibm.jc
Hi,
I am currently trying to create an Applet loader for JavaCard and I am getting in trouble with the initializeUpdate function of the class CardManager. Bellow is the code I write to initialize the communication with the javacard/reader...
//list all the readers with a card present
readers = TerminalFactory.getDefault().terminals().list(State.CARD_PRESENT);
if(readers.isEmpty()){
return;
//establish connection with the reader
term = (PCSCJCTerminal)JCTerminal.getInstance("PCSC",readers.get(0).toString().substring(15));
term.open();
atr = new ATR(term.waitForCard(2000));
//connect to card
System.out.println("Getting card ...");
card = new JCard(term,atr,2000);
//select Cardmanager
System.out.println("Selecting card manager ...");
cardmanager = new CardManager(card, CardManager.daid);
cardmanager.select();
//setup keys
byte[] dfltKey = c2b("404142434445464748494a4b4c4d4e4f");
cardmanager.setKey(new OPKey(1, 1, OPKey.DES_ECB, dfltKey));
cardmanager.setKey(new OPKey(1, 2, OPKey.DES_ECB, dfltKey));
cardmanager.setKey(new OPKey(1, 3, OPKey.DES_ECB, dfltKey));
//authenticate to cardmanager
System.out.println("Authenticate to card manager ...\n");
* cardmanager.initializeUpdate(1, 0,CardManager.SCP_01_05);*
cardmanager.externalAuthenticate(OPApplet.APDU_CLR);
When I am launching the program, everything goes well until the initializeUpdate function which throw the exeption:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/jc/CL3
at com.ibm.jc.OPApplet.initializeUpdate(Unknown Source)
at com.jnet.tools.LoadApplet.initConnection(LoadApplet.java:80)
at com.jnet.tools.LoadApplet.load(LoadApplet.java:88)
at com.jnet.benchmarks.ClientBenchs.runTest(ClientBenchs.java:636)
at com.jnet.benchmarks.ClientBenchs.main(ClientBenchs.java:485)
Caused by: java.lang.ClassNotFoundException: com.ibm.jc.CL3
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Since I am quiet new in Java, I don't know what this exception means. I think that all the parameters of the function are good since I am using the same when I load "manually" the Applets on the card with the same parameters and it works. My JRE is 1.6 (but I also tried in 1.5), and the JCOP tools version is 3.2.7.
I also tried with a different card with a different AID and different SCP parameter but I always have the same error.
Thank in advance for the future replier
862087 wrote:
Hi,
I am currently trying to create an Applet loader for JavaCard and I am getting in trouble with the initializeUpdate function of the class CardManager. Bellow is the code I write to initialize the communication with the javacard/reader...
//list all the readers with a card present
readers = TerminalFactory.getDefault().terminals().list(State.CARD_PRESENT);
if(readers.isEmpty()){
return;
//establish connection with the reader
term = (PCSCJCTerminal)JCTerminal.getInstance("PCSC",readers.get(0).toString().substring(15));
term.open();
atr = new ATR(term.waitForCard(2000));
//connect to card
System.out.println("Getting card ...");
card = new JCard(term,atr,2000);
//select Cardmanager
System.out.println("Selecting card manager ...");
cardmanager = new CardManager(card, CardManager.daid);
cardmanager.select();
//setup keys
byte[] dfltKey = c2b("404142434445464748494a4b4c4d4e4f");
cardmanager.setKey(new OPKey(1, 1, OPKey.DES_ECB, dfltKey));
cardmanager.setKey(new OPKey(1, 2, OPKey.DES_ECB, dfltKey));
cardmanager.setKey(new OPKey(1, 3, OPKey.DES_ECB, dfltKey));
//authenticate to cardmanager
System.out.println("Authenticate to card manager ...\n");
* cardmanager.initializeUpdate(1, 0,CardManager.SCP_01_05);*
cardmanager.externalAuthenticate(OPApplet.APDU_CLR);When I am launching the program, everything goes well until the initializeUpdate function which throw the exeption:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/jc/CL3
at com.ibm.jc.OPApplet.initializeUpdate(Unknown Source)
at com.jnet.tools.LoadApplet.initConnection(LoadApplet.java:80)
at com.jnet.tools.LoadApplet.load(LoadApplet.java:88)
at com.jnet.benchmarks.ClientBenchs.runTest(ClientBenchs.java:636)
at com.jnet.benchmarks.ClientBenchs.main(ClientBenchs.java:485)
Caused by: java.lang.ClassNotFoundException: com.ibm.jc.CL3
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)Since I am quiet new in Java, I don't know what this exception means. I think that all the parameters of the function are good since I am using the same when I load "manually" the Applets on the card with the same parameters and it works. My JRE is 1.6 (but I also tried in 1.5), and the JCOP tools version is 3.2.7.
I also tried with a different card with a different AID and different SCP parameter but I always have the same error.
Thank in advance for the future replierRepost with code tags
Similar Messages
-
Hi. I developed a project with an older version of SAP NetWeaver and Web Dynpro and have now updated to newer versions (SAP NetWeaver 7.1).
I now tried to reimport the project and have 2 errors, i can't solve.
"The project was not built since its build path is incomplete. Cannot find the class file for com.sap.tc.webdynpro.progmodel.context.AttributePointer. Fix the build path then try building this project"
"The type com.sap.tc.webdynpro.progmodel.context.AttributePointer cannot be resolved. It is indirectly referenced from required .class files"
Does anybody know, how I can fix these problems?
Thanks, TobiasHi,
Refer this link
Using JAR Class Finder
in the server u can find the jar files required for the application....
C:usrsapJ2EJC00j2eeclusterserver0appssap.comirjservlet_jspirj
ootWEB-INFportal
Regards,
Senthil K. -
Hi,
I was trying the "How to BI JAVA SDK in a Portal iView and get the following error.
The project was not built since its classpath is incomplete. Cannot find the class file for com.sap.portal.services.api.connectorgateway.IConnectorGatewayService. Fix the classpath and try rebuilding this project.
I have the following in my portalapp.xml file
<property name="SharingReference" value="com.sap.portal.ivs.connectorservice"/>
and i have also added the jar file "com.sap.portal.ivs.connectorservice_api" in the set of lib's
Has some faced a similar issue? or can someone suggest how I could possibly resolve this.
Thanks,
SmithaHi Smitha:
My webdynpro dc was build failed for "This compilation unit indirectly references the missing type com.sap.engine.services.webservices.espbase.client.dynamic.content.GenericObject (typically some required class file is referencing a type outside the classpath)".
How should i do? Thank you! -
Calling a function in the main movie from a loaded swf
I realize this is probably a very basic question, but I have
loaded a SWF file into another movie. I now want to call a function
in the main SWF. Is there a way to do that? Alternatively, I have a
custom class where I could put the function, but I haven't been
able to figure out how to call it from the loaded SWF either. Do I
somehow need to associate the class with the main movie,
or...?Never mind - I was doing something very stupid and wasn't
calling the function as a method of a movie clip. I was simply
calling checkTarget(event) rather than
event.currentTarget.checkTarget(event); which seems to work. -
How to protect the .class files from decompilers
Hi all,
I have developeed an application and I want it to be protected from the decompilers. The problem that I am facing now is that the .class files can be ripped by using the decompiling softwares.
It will be great if any body cvan bail me out of this.
Thanks
kvmpObfuscating your files is your best bet. This has been discussed to death, both here and on every other Java-related discussion site and newsgroup since about 1996; a Google search on "Java obfuscation" should help.
You can also look here for an overview:
http://mindprod.com/jglossobfuscator.html#OBFUSCATOR
Grant -
How to restrict the .class file from decompilation
Hi all,
i got a security problem. i need all the java class files to be most secured. is there any to restriction on the java class files from decompilation. is that possible?. pls help me out. it's very urgent
thanks in advanceYou can make it harder to understand the decompiled code if you use an obfuscator. (I don't have links to any, do a google search, or search these forums, it have been discussed here previously.)
You cannot completely prevent decompilation, though. Obfuscating does not for example not mean that any passwords you have hardcoded in the source is secure. -
Running the .class file from java code
I'm doing a kind of providing service like compiling and running Java code on server side and giving output to the end user.
Please suggest me an approach with code to run .class file from the Java code.
import java.io.*;
public class demo {
public static void main(String args[]) throws IOException, InterruptedException {
int result;
try {
System.out.println("command output:");
Process proc = Runtime.getRuntime().exec("java -cp . demoh");
InputStream in = proc.getInputStream();
result = proc.waitFor();
BufferedInputStream buffer = new BufferedInputStream(proc.getInputStream());
BufferedReader commandOutput = new BufferedReader(new InputStreamReader(buffer));
String line = null;
System.out.print(commandOutput);
try {
while ((line = commandOutput.readLine()) != null) {
System.out.print(line);
System.out.println("command output: " + line);
}//end while
commandOutput.close();
} catch (IOException e) {
//log and/or handle it
}//end catc
} catch (IOException e) {
System.err.println("IOException raised: " + e.getMessage());
}What happened when you tried what you have there?
-
Getting the class name from within the compiled class file
hey!
I was wondering (i know its possible) how to read a .class and get the name of the class. ok that made not much sense^^ so, You have a file: c:\f.class but it wont run because the file name has to be the same as the classes name, right? so how can you read the class file i guess in binary mode to receive the correct class name.
I saw inside my f.class i have "realname.java" so i know now that the name of the class file should be realname.class, i tried ways to extract it from the class file but never had any success.
i think i need to study english^^
ps: i need this because i have some class files sent to me and the file names have been changed so they wont work, they only work when i open the class file in notepad and find out what its real name should be and then rename the file.
Edited by: forgotmydamnpass on May 7, 2009 11:23 AMah looks interesting, problem is i cant use it.. im prone to errors!
import java.net.URLClassLoader;
public class NewMain {
* @param args the command line arguments
public static void main(String[] args) {
FileClassLoader loader = new FileClassLoader();
Class clazz = loader.createclass("c:\\f.class");
Method method = clazz.getName();
}apparently "createclass" doesnt exist :/
FileClassLoader = cannot find symbol
Method = cannot find symbol -
Calling a Function in the Parent Window from the Child Window
QUESTION: How do I call a function resident in the parent
window from a child window?
BACKGROUND
I have a JavaScript function resident in the parent window
that reformats information obtained from the Date object and writes
the result to the parent window using the document.write( ) method.
I would like to call this function from the child window and have
it write to the child window instead. Is this possible? If not,
must I rewrite the entire function and nest it in the below code?
If so, what is the proper form of nesting?
CODE: The code that creates and fills the child window is
provided below. The highlighted area indicates where I would like
to enter the information from the function resident in the parent
window. I have tried every imaginable permutation of code that I
can imagine and nearly destroyed my parent document in the process.
I am very happy that I had a back-up copy!
function openCitationWindow() {
ciDow = window.open("", "", "width=450, height=175, top=300,
left=300");
ciDow.document.write("A proper way to cite a passage of text
on this page:<br /><br />Stegemann, R. A. 2000.
<cite>Imagine: Bridging a Historical Gap</cite>. " +
document.title + ". [<a href='" + location.href + "'
target='_blank'>online book</a>] <" + location.href
+ "> (");
MISSING CODE;
ciDow.document.write(").<br /><br /><input
type='button' value='Close Window' onclick='window.close()'>");
ciDow.focus();Never mind - I was doing something very stupid and wasn't
calling the function as a method of a movie clip. I was simply
calling checkTarget(event) rather than
event.currentTarget.checkTarget(event); which seems to work. -
Call a function in the shell SWF from a imported SWF
We have flash set up as a shell to take lesson data from XML
and display it frame by frame.
We import SWF files when the XML tells it to to be displayed
on the frame.
How can I get the imported SWF file to call a function in the
shell....
basically have a button or movie clip in the imported swf
call the "gotoNextFrame()" function in the shell.We found a "bit" easier way if anyone is interested.. we have
the have an eventlistner added to the loader to assign a event to
the swf file thats imported:
flashLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
addEventHandlers);
then when its completed, it adds event listeners and calls
our "goNextFrame" function (then clears it when its removed from
the stage):
function addEventHandlers(event:Event):void
var swfMC:MovieClip = event.target.content as MovieClip;
swfMC.addEventListener("NextFrame", goNextFrame);
swfMC.addEventListener("PreviousFrame", goPrevFrame);
swfMC.addEventListener(Event.REMOVED_FROM_STAGE,
clearEventListeners);
Then in the swf file thats to be imported, its real simple:
next_btn.addEventListener(MouseEvent.CLICK, MoveToNextFrame);
prev_btn.addEventListener(MouseEvent.CLICK,
MoveToPreviousFrame);
function MoveToNextFrame(e:MouseEvent):void
dispatchEvent(new Event("NextFrame"));
function MoveToPreviousFrame(e:MouseEvent):void
dispatchEvent(new Event("PreviousFrame")); -
How does one call a class if one gets the class name from a database?
Hi,
I'm writing an application that needs to handle different types of input file.
Each type of input file will be handled by a different processing class.
I plan to use a controller class that will read from a database rows that each contain a file name and processor class name such that the class can then be used to process that file:
So on a table somewhere I might have relationships like:
file1.csv , ProcessorClassA
file2.csv , ProcessorClassB
file3.csv , ProcessorClassB
My hope is that if I need a new processor class, I will not have to change the controller class. I simply write the new class say, ProcessorClassC and put an entry in my table for:
file4.csv , ProcessorClassC
So, finally, the question...
I can read in the new class name into a string but how can I employ that class or instantiate objects of that new class and use their methods.
The rationale is that so that the controller class needs no further modifications no matter how many new processor classes are required.
Any ideas anyone?A factory class? I'm all ears... or is that another
days work...?Look e.g. here (or Google for "Factory Design Pattern"):
http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/FactoryPattern.htm -
Is it possible to call a function with the same name from 2 different dll's at the same time.
I'm trying to call a function ( F ) form 2 different libraries ( A.dll and B.dll ) at the same time. The first lib loaded determines the function F. A->F and B->F have same interface and name but different implementation.
Hi,
I tried it with two dll's, both with the same interface, and at the same
time, in the same VI. The popups even appear at the same time.
But now I understand the problem... Both dll's are created by LabVIEW! If
they are not (or one is not, and the other is), this is no problem.
And VI's in memory cannot have the same name. LabVIEW doesn't care if VI's
are in a dll or not.
This might not help, but if you want to make some sort of "plug in" system,
you might consider using llb's. By loading VI's dynamically, you can select
the path from which they are loaded. You must unload (close all references)
one before the loading the other, or the same problem will occur. If you go
this way, I consider a different approach. Make on
e library (or even a dll)
that has the interface you like, this is the "loader". Now make several
"plug in"'s, with the same interfaces. The name of each function in a plug
in is a concatenation of the library name and the function name. The loader
has one extra function, that loads (and unloads, when done) references to
all desired libraries to use (the names of the functions can be figured out
easily). All that the loader functions do is dynamically call the library
functions. You can use a call by reference node for this (you can use the
connector pane or the loader vi, since the interface must be the same!).
If you go this way, I guess the loader library can be converted to a dll...
Hope this helps.
Wiebe.
"rsam" wrote in message
news:[email protected]..
> Thx Wiebe,
>
> did you load both dll at the same time? For example in 1 vi. Somehow
> the first loaded function keeps to overrule the second. Notice that
> the interface is
exactly the same.
>
> I loaded 2 dll created in Labview with results described above.
>
> Regards Ruud -
Hi Friends,
We are developing Adapter for XI using java, XI is giving String in the form of ModuleData, we r getting the String from ModuleData but in the logic we need to split the String in parts based on character ' ', but I observed that in the communication channel symbol is showing as ' '.
We have written the java code based on ' ' but splitting is not working, then I tried with the following code
String[] molecules = null;
if(filedata.indexOf(" ") != -1){ molecules = filedata.split(" ");
}else if(filedata.indexOf("?") != -1){
molecules = filedata.split("?");
}else if(filedata.indexOf(" ") != -1){
molecules = filedata.split(" ");
Still it is not working, please help in case of ModuleData text splitting..
Thanks in advance.
Satinder SainiCheck with a hex editor, what the ' '. really is.
Maybe it is a tab? Then you can use "\t" in a Java progam.
See also here:
http://en.wikipedia.org/wiki/ASCII#ASCII_control_characters
Regards
Stefan
Edited by: Stefan Grube on Mar 26, 2008 2:22 PM -
How do I keep the new tab from comming up all the time?
From email, whenever I click on an attachment, it opens in another window with the tab for the attachment as I expect. But the NewTab TAB opens as well and is the active tab. So I have to click on the attachment tab to view it. Then when done, if I delete the attachment tab , I also have to delete the NEW Tab as well.
This is a recent development and is different from the way things worked before.''Maurice1 [[#question-1043183|said]]''
<blockquote>
From email, whenever I click on an attachment, it opens in another window with the tab for the attachment as I expect. But the NewTab TAB opens as well and is the active tab. So I have to click on the attachment tab to view it. Then when done, if I delete the attachment tab , I also have to delete the NEW Tab as well.
This is a recent development and is different from the way things worked before.
</blockquote> -
Calling functions of the inner class in .java code file
Hello,
I created a .java code file in Visual J#.Net and converted it into
the application by adding the "public static void main(String args[])"
function.
I have created the two classes one extends from Applet, and the other
extends from Frame. The class which I inherited from the Frame class becomes
the inner class of the class extended from the Applet. Now How do I
call the functions of the class extended from Frame class - MenuBarFrame
class. the outline code is
public class menu_show extends Applet
------init , paint action function---------
public class MenuBarFrame extends Frame
paint,action function for Menu
public static void main(String args[])
applet class instance is created
instance of frame is created
Menu , MenuBar, MenuItem instance is created
and all these objects added
I have Created MenuBarFrame class instance as
Object x= new menu_show().new MenuBarFrame
????? How to call the functions such as action of MenuBarFrame class - what
should be its parameters??????
}Here's how I would do it:
interface Operation {
public int op(int y);
class X {
private int x;
public X(int x) {
this.x = x;
private class Y implements Operation {
public int op(int y) {
return x+y;
public Operation createOperation() {
return new Y();
public static void main(String[] args) {
X app = new X(17);
Operation f = app.createOperation();
System.out.println(f.op(-11));
}Your code, however, has some serious "issues". You typically don't
instantiate an applet class -- that's the job of the applet viewer or Java plugin
your browser is using. If you instantiate the applet directly, you're going
to have to supply it an AppletStub. Do you really want to go that way?
Again, use an applet viewer or browser, or better yet, why write applets at all?
Maybe you are looking for
-
Nvidia Quadro fx2800m on w701ds with Win 7 64 update problem
Hello, i had a couple of crashes with blue screen and i knew it was the graphic driver because several times i saw the windows warning Graphic driver restored. I decided to update it from the lenovo site by downloading the latest one, it was 307.xx a
-
Database Restore & Recovery from tape
Hi Fellows I'm about to attempt a recovery from backup tape to a test server, as a 'tape recovery' test. The files I've marked for recovery include (directories including all sub-tree); Datafiles directory $ORACLE_HOME/sid/ directory where the sid is
-
How to kill parent and child thread in sequnece
Hello freinds, I have one class FirstClass which creates one thread Pserver and Pserver creates three threads then how to kill parent Pserver and child threads.........
-
Weblogic.appc compiler for Weblogic 9 and higher version
We had problem precompiling the jsp's using weblogic.jspc compiler after migrating the project from 8.1 to 9.2. From the edocs weblogic documentation we see that jspc compiler is deprecated from weblogic 9 onwards and they recommend using weblogic.ap
-
Hi, Pretty simple problem; I create a regular playlist of TV shows, start the first one, and it stops at the end, doesn't advance to the next video. This happens whether I have shuffle and/or loop on or off. Anyone else notice this, or know the issue