Problem with APDUCommand in javax.smartcardio

Hi,
There seem to be a bug (from my point of view) with the javax.smartcardio when i attempt to send a command over to the card.
There a code frag
factory = TerminalFactory.getDefault();
        try {
            terminals = factory.terminals().list();
            System.out.println("Terminals: " + terminals);
            terminal = terminals.get(1);
            System.out.println("Card Present: " + terminal.isCardPresent());
            Card card = terminal.connect("*");
            channel = card.getBasicChannel();
            ResponseAPDU resp = channel.transmit(new CommandAPDU(selectcom));
            System.out.println("Select Resp: " + getHexString(resp.getBytes()));
            CommandAPDU com = new CommandAPDU((byte)0x43, (byte)0x52, (byte)0x00, (byte)0x00, 0);
            System.out.println("CommandAPDU: " + getHexString(com.getBytes()));
            resp = channel.transmit(com);
            System.out.println("Result: " + getHexString(resp.getBytes()));
            card.disconnect(false);
        } catch (CardException e) {
            e.printStackTrace();
        }There the result:
Terminals: [PC/SC terminal OMNIKEY CardMan 5x21 0, PC/SC terminal OMNIKEY CardMan 5x21-CL 0]
Card Present: true
Select Resp: 90 00
CommandAPDU: 43 52 00 00
Result: 6E 00
BUILD SUCCESSFUL (total time: 1 second)
And there the result i tried with another tool (GPShell)
select -AID 53504545454659503101
--> 00A404000A53504545454659503101
<-- 9000
send_apdu -sc 0 -APDU 43520000
Send APDU: 43 52 00 00
--> 43520000
<-- 9000
Recv APDU: 90 00
card_disconnect
release_context
Anyone have encounter the same problem?

Refering to this code:
factory = TerminalFactory.getDefault();
        try {
            terminals = factory.terminals().list();
            System.out.println("Terminals: " + terminals);
            terminal = terminals.get(1);
            System.out.println("Card Present: " + terminal.isCardPresent());
            Card card = terminal.connect("*");
            channel = card.getBasicChannel();
            ResponseAPDU resp = channel.transmit(new CommandAPDU(selectcom));
            System.out.println("Select Resp: " + getHexString(resp.getBytes()));
            CommandAPDU com = new CommandAPDU((byte)0x43, (byte)0x52, (byte)0x00, (byte)0x00, 0);
            System.out.println("CommandAPDU: " + getHexString(com.getBytes()));
            resp = channel.transmit(com);
            System.out.println("Result: " + getHexString(resp.getBytes()));
            card.disconnect(false);
        } catch (CardException e) {
            e.printStackTrace();
        }ResponseAPDU resp = channel.transmit(new CommandAPDU(selectcom));
I already selected the applet here.
With this command here
static byte[] selectcom = new byte[] {(byte)0x00, (byte)0xA4, (byte)0x04, (byte)0x00, (byte)0x0A, (byte)0x53, (byte)0x50, (byte)0x45, (byte)0x45, (byte)0x45, (byte)0x46, (byte)0x59, (byte)0x50, (byte)0x31, (byte)0x01};
So selecting the applet is done. And it return a 90 00. Then i start to send applet specific command.
=)

Similar Messages

  • PC/SC with JNI vs. javax.smartcardio

    Hi,
    for programming card terminals (USB tag readers) the PC/SC was used with JNI. Since the Java Smartcard I/O API (javax.smartcardio, JSR 268) was introduces in 1.6 it makes the JNI obsolete right?
    So there is no need for jpcsc and similar?
    Thanks
    STeN
    Edited by: stenlik on Jun 8, 2011 8:39 PM

    smartcardio uses JNI to access the PC/SC layer. It is built into the JDK so you do not have to distribute the JAR/DLL files any more as they are already delivered. jpcsc still has it's place but as you mentioned it is not required any more (unless your JDK does not have smartcardio).
    Cheers,
    Shane

  • Help me - I have a problem of using the javax.smartcardio

    Hi everybody!!!
    I'm creating an application to communicate with javacard.
    I searched on internet and know about javax.smartcardio.
    But I can not use it, even it's inside the default library of Java 6.
    I already import the javax.smartcardio.*; to my java file.
    But it can not find the class inside this package.
    Can somebody help me? Thanks a lot.

    Hi everybody.
    I got the advice from Mr. Safarmer on this forum.
    So:
    If you're using Eclipse to develop the application.
    You have to set the JRE Library to Alternate JRE.
    Below is the instruction for dummies like me ^^:
    Go to Build Path > Configure Buil Path of your project
    In Libraries tab, Edit the JRE System Library
    Instead of choosing the Execution Environment, we choose Alternate JRE (usually jre6)--> This is my case. And i did it.

  • MS SQL Server problem with MDB's: javax.transaction.xa.XAException

              I am programming agents in j2ee and using MDB to implement the asynchronicity of
              the agents.
              Those MDB's get messages (MapMessage) from a controller (an SFSB) that contain
              the agent's ID and the action that the agent has to perform. The MDB creates a
              SFSB, and calls the appropriate action from this session bean. Those actions require
              to read and write from my MS SQL Server 2000 XA database. But when running my
              program, I often get this error, which doesn't seem to affect the action, because
              when I check my database data, everything is updated correctly. So the program
              still completes, but the errors slow down the execution (the program hangs for
              about 3 seconds, each time the error occurs).
              Does anybody has an explanation or solution for this?
              Thank you...
              This is the error output:
              onMessage()
              Reading MapMessage: 1
              <26-apr-2004 14.34 u. CEST> <Error> <EJB> <BEA-010026> <Exception occurred during
              commit of transaction Xid=BEA1-005F88135FFBA636FFF7(15619088),Status=Rolled back.
              [Reason=javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare
              (0) returns -4],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=4,seconds
              left=30,XAServerResourceInfo[JMS_JMS Server2_NotDurable]=(ServerResourceInfo[JMS_JMS
              Server2_NotDurable]=(state=rolledback,assigned=lucille3_ms),xar=JMS_JMS Server2_NotDurable),XAServerResourceInfo[MSSQL
              Connection Pool]=(ServerResourceInfo[MSSQL Connection Pool]=(state=rolledback,assigned=lucille3_ms),xar=MSSQL
              Connection Pool),SCInfo[cluster+lucille3_ms]=(state=rolledback),local properties=({}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=lucille3_ms+127.0.0.1:8001+cluster+t3+,
              XAResources={},NonXAResources={})],CoordinatorURL=lucille3_ms+127.0.0.1:8001+cluster+t3+):
              javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare
              (0)returns -4
              at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown
              Source)
              at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.prepare(Unknown Source)
              at weblogic.jdbcx.base.BaseXAResource.prepare(Unknown Source)
              at weblogic.jdbc.jta.DataSource.prepare(DataSource.java:821)
              at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:1161)
              at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:395)
              at weblogic.transaction.internal.ServerSCInfo$1.execute(ServerSCInfo.java:253)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
              --------------- nested within: ------------------
              weblogic.transaction.RollbackException: Could not prepare resource 'MSSQL Connection
              Pool
              [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare (0) returns -4 - with nested
              exception:
              [javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare
              (0) returns -4]
              at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1644)
              at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:300)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:221)
              at weblogic.ejb20.internal.MDListener.execute(MDListener.java:412)
              at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
              at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
              at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170).>
              

              I am programming agents in j2ee and using MDB to implement the asynchronicity of
              the agents.
              Those MDB's get messages (MapMessage) from a controller (an SFSB) that contain
              the agent's ID and the action that the agent has to perform. The MDB creates a
              SFSB, and calls the appropriate action from this session bean. Those actions require
              to read and write from my MS SQL Server 2000 XA database. But when running my
              program, I often get this error, which doesn't seem to affect the action, because
              when I check my database data, everything is updated correctly. So the program
              still completes, but the errors slow down the execution (the program hangs for
              about 3 seconds, each time the error occurs).
              Does anybody has an explanation or solution for this?
              Thank you...
              This is the error output:
              onMessage()
              Reading MapMessage: 1
              <26-apr-2004 14.34 u. CEST> <Error> <EJB> <BEA-010026> <Exception occurred during
              commit of transaction Xid=BEA1-005F88135FFBA636FFF7(15619088),Status=Rolled back.
              [Reason=javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare
              (0) returns -4],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=4,seconds
              left=30,XAServerResourceInfo[JMS_JMS Server2_NotDurable]=(ServerResourceInfo[JMS_JMS
              Server2_NotDurable]=(state=rolledback,assigned=lucille3_ms),xar=JMS_JMS Server2_NotDurable),XAServerResourceInfo[MSSQL
              Connection Pool]=(ServerResourceInfo[MSSQL Connection Pool]=(state=rolledback,assigned=lucille3_ms),xar=MSSQL
              Connection Pool),SCInfo[cluster+lucille3_ms]=(state=rolledback),local properties=({}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=lucille3_ms+127.0.0.1:8001+cluster+t3+,
              XAResources={},NonXAResources={})],CoordinatorURL=lucille3_ms+127.0.0.1:8001+cluster+t3+):
              javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare
              (0)returns -4
              at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown
              Source)
              at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.prepare(Unknown Source)
              at weblogic.jdbcx.base.BaseXAResource.prepare(Unknown Source)
              at weblogic.jdbc.jta.DataSource.prepare(DataSource.java:821)
              at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:1161)
              at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:395)
              at weblogic.transaction.internal.ServerSCInfo$1.execute(ServerSCInfo.java:253)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
              --------------- nested within: ------------------
              weblogic.transaction.RollbackException: Could not prepare resource 'MSSQL Connection
              Pool
              [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare (0) returns -4 - with nested
              exception:
              [javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver][SQLServer]xa_prepare
              (0) returns -4]
              at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1644)
              at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:300)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:221)
              at weblogic.ejb20.internal.MDListener.execute(MDListener.java:412)
              at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
              at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
              at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170).>
              

  • Problem with JBuilder and javax.xml.transform package

    Hi,
    My JBuilder 7 can not find javax.xml.transform package. i use javax.xml.parsers package but i can not access to javax.xml.transform. is there a problem or something necessary to do to access that?
    Best Wishes - WiseWarrior

    Hey WiseWarrior,
    your problem is directly related to your jar file in run time. The xml parser jar which you are using to perform transfor is not having the appropriate classes, take the latest version of xalan it has transform package and put it into your class path, it will work.
    CheerS!!
    Sandeep Raikwar

  • Problem with return of javax.xml.transform.Source impl from webService

    I have a web services that needs to return an XML string to the calling client. If I return the XML as a String object it gets deserialized twice and the end result is no longer XML. My research indicates that I can return an implementation of javax.xml.transform.Source and this will cause SOAP to attach the XML string to the message rather than embed it (protecting it from deserialization). The following is the effective part of my method:
    public Source[] consumeTextMessage(String id) throws RemoteException {
    try {
    MessageConsumer mc = new MessageConsumer();
    String[] messages = mc.consumeTextMessage(id);
    StreamSource[] sources = new StreamSource[messages.length];
    for(int i = 0; i < messages.length; i++) {
    sources[ i ] = new StreamSource();
    return sources;
    } catch(RemoteException e) {
    throw e;
    note: the mc.consumeTextMessage(id) call works correctly and I know that I'm not putting anything in the StreamSource objects in the loop to build the array of StreamSource objects - just trying to get SOMETHING to work
    so this deploys without problem, but when I try to get a wsdl for the webservice i get a Server 500 error; the log says this:
    javax.servlet.ServletException: WSDL Generation exception: java.lang.Exception javax.xml.transform.Source is an abstract class: cannot be instanciated
    ok.... if I change the method return type to a concrete class (StreamSource[]), redeploy and try to get a wsdl, I get this absolutely crazy error:
    javax.servlet.ServletException: WSDL Generation exception: java.lang.Exception java.io.Reader is an abstract class: cannot be instanciated
    I have NO clue why it thinks it needs a Reader.
    If I change the method return type to String[] (and make the various adjustments to the method) then it deploys ok and gives me a good WSDL (though it still doesn't work because the Strings are deserialized twice so this isn't a viable solution but it does show that my webservice config is correct).
    So... bottom line seems to be that the webService "engine" of 10g AS doesn't like Source or StreamSource.....
    Any ideas what I can do??

    Funny story here: trying to deploy a different webserivce all together and got the same error message; thought I remembered seeing it before but wasn't sure; did a google search on it and lo and behold came across my first posting in this thread.... crazy.
    Anyway, I have discovered something that answers some of the questions I had in my first post: It seems that the argument types used in a webservice signature MUST be CONCRETE classes (and I would think primitives would work too though I don't remember trying them) - they can not be Interfaces or abstract classes. Probably if I read the webservices spec it would tell me that.
    So the error I was getting before was because Source was not a concrete class, and presumably the second error was caused by some signature somewhere along the line using the Reader abstract class.
    Fun stuff.

  • Problem with JAXB Unmarshall - javax.xml.bind.UnmarshalException

    Hi,
    I'm getting an expection while unmarshalling using JAXB. The error is as follows :
    DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"http://www.etrade.com/ee/systemdomainao/search", local:"Context_Id"). Expected elements are <{}contextId>,<{}predicateInterceptor>,<{}isDefaultsearch>,<{}implicitContextSQL>,<{}contextName>,<{}searchId>,<{}implicitContextText>
    I've generated JAXB classes using xjc command from my schema. The root element is Search object which has a List of Searchcontext and Columlist object. When I'm trying to unmarshall the XML, I'm getting the above exception. What is baffling, if I comment out the <tns:SearchContext> entry from the XML, unmarshall doesn't throw any exception and populates the columnlist properly. Columnlist and Searchcontext have little difference except that columnlist contains more elements.
    Here'e the unmarshall code,
    URL metadataURL = this.getClass().getClassLoader().getResource("metadata/search/PARTICIPANT.xml");
    JAXBContext jc = JAXBContext.newInstance("com.etrade.ee.systemdomainao.search.domain");
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
    Search search = (Search)unmarshaller.unmarshal(metadataURL);
    Any pointers will be highly appreciated.
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    XSD :
    XSD :
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.etrade.com/ee/systemdomainao/search" targetNamespace="http://www.etrade.com/ee/systemdomainao/search" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <!-- Searchcontext type definition -->
         <xs:complexType name="Searchcontext">
              <xs:sequence>
                   <xs:element name="Context_Id" type="xs:int"/>
                   <xs:element name="Search_Id" type="xs:string"/>
                   <xs:element name="Context_Name" type="xs:string"/>
                   <xs:element name="Implicit_Context_SQL" nillable="true">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:maxLength value="500"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
                   <xs:element name="Implicit_Context_Text" nillable="true">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:maxLength value="500"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
                   <xs:element name="Is_Defaultsearch" type="xs:boolean" nillable="true"/>
                   <xs:element name="Predicate_Interceptor" type="xs:string" nillable="true"/>
              </xs:sequence>
         </xs:complexType>
         <!-- Searchlist type definition -->
         <xs:complexType name="Columnlist">
              <xs:sequence>
                   <xs:element name="Columnlist_Id" type="xs:int"/>
                   <xs:element name="Search_Id" type="xs:string"/>
                   <xs:element name="Is_Quicksearchable" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Advancesearchable" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Quicksearchview" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Fullview" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Sortable" type="xs:boolean" nillable="true"/>
                   <xs:element name="Is_Defaultsort" type="xs:boolean" nillable="true"/>
                   <xs:element name="Default_SortOrder" type="xs:string" nillable="true" minOccurs="0"/>
                   <xs:element name="Display_Order" type="xs:int" nillable="true"/>               
                   <xs:element name="Default_Value" type="xs:string" nillable="true" maxOccurs="6"/>
                   <xs:element name="Default_Operator" type="xs:string" nillable="true"/>
                   <xs:element name="Is_Closedset" type="xs:boolean"/>
                   <xs:element name="Closedset_List_Name" type="xs:string" nillable="true"/>
                   <xs:element name="Is_RelatedMenu" type="xs:boolean" minOccurs="0"/>
                   <xs:element name="Column_Name" type="xs:string"/>
                   <xs:element name="Display_Name" type="xs:string"/>
                   <xs:element name="Is_UDF" type="xs:boolean" nillable="true"/>
                   <xs:element name="Table_Name" type="xs:string"/>
                   <xs:element name="Data_Type" type="xs:string"/>
                   <xs:element name="Column_Size" type="xs:int"/>
              </xs:sequence>
         </xs:complexType>
         <!-- Search declaration -->
         <xs:element name="Search">
              <!--<choice>
         <xs:interface name="java.io.Serializable" />
         </choice>-->
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Search_Id" type="xs:string"/>
                        <xs:element name="Schema_Set">
                             <xs:simpleType>
                                  <xs:restriction base="xs:string">
                                       <xs:maxLength value="20"/>
                                       <xs:minLength value="1"/>
                                  </xs:restriction>
                             </xs:simpleType>
                        </xs:element>
                        <xs:element name="SearchContext" type="tns:Searchcontext" maxOccurs="unbounded"/>
                        <xs:element name="ColumnList" type="tns:Columnlist" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
              <xs:key name="Search_PrimaryKey_1">
                   <xs:selector xpath="."/>
                   <xs:field xpath="tns:Search_Id"/>
              </xs:key>
              <xs:keyref name="Searchcontext_ForeignKey_1" refer="tns:Search_PrimaryKey_1">
                   <xs:selector xpath=".//tns:SearchContext"/>
                   <xs:field xpath="tns:Search_Id"/>
              </xs:keyref>
              <xs:keyref name="Columnlist_ForeignKey_2" refer="tns:Search_PrimaryKey_1">
                   <xs:selector xpath=".//tns:ColumnList"/>
                   <xs:field xpath="tns:Search_Id"/>
              </xs:keyref>
              <xs:key name="Searchcontext_PrimaryKey_1">
                   <xs:selector xpath=".//tns:SearchContext"/>
                   <xs:field xpath="tns:Context_Id"/>
              </xs:key>
              <xs:key name="Columnlist_PrimaryKey_1">
                   <xs:selector xpath=".//tns:ColumnList"/>
                   <xs:field xpath="tns:Columnlist_Id"/>
              </xs:key>
         </xs:element>
    </xs:schema>

  • Java 6: javax.smartcardio - can't get CPLC

    Hello! I have a problem - can't get CPLC with classes from javax.smartcardio (get SW=6a88), but I easily get it with com.sun.javacard.apduio classes from Java Card Kit 2.2.2.
    Here the test code for javax.smartcardio :
    import java.util.List;
    import javax.smartcardio.*;
    public class TestSmartCardJSE60
    public static void main(String[] args)
      try
       TerminalFactory tf = TerminalFactory.getInstance("PC/SC", null);
       CardTerminals cts = tf.terminals();
       List<CardTerminal> avaiableTerminals = cts.list();
       CardTerminal ct = avaiableTerminals.get(0);
       Card card = ct.connect("*");
       try
        CardChannel channel = card.getBasicChannel();
        CommandAPDU capdu = new CommandAPDU(0x80, 0xCA, 0x9F, 0x7F);
        ResponseAPDU res = channel.transmit(capdu);
        System.out.printf("%s%n", res);
       finally
        card.disconnect(true);
      catch(Exception e)
       e.printStackTrace();
    }And here the same for com.sun.javacard.apduio
    import com.sun.javacard.apduio.*;
    public class TestSmartCardJCK222
    public static void main(String[] args)
      try
       CadClientInterface cad = CadDevice.getPCSCClientInstance(0);
       cad.powerUp();
       try
        Apdu capdu = new Apdu();
        capdu.command[Apdu.CLA] = (byte) 0x80;
        capdu.command[Apdu.INS] = (byte) 0xCA;
        capdu.command[Apdu.P1] = (byte) 0x9F;
        capdu.command[Apdu.P2] = 0x7F;
        cad.exchangeApdu(capdu);
        System.out.printf("%s%n", capdu);
        capdu.setLe(0x2D);
        cad.exchangeApdu(capdu);
        System.out.printf("%s%n", capdu);
       finally
        cad.powerDown(true);
      catch(Exception e)
       e.printStackTrace();
    }I run both tests under WindowsXP SP3 with ORGA ECO5000 Usb and JCOP21 smart card.
    What is my problem? Actualy I want to use javax.smartcardio for my application, because classes from that package more useful than com.sun.javacard.apduio;
    Any ideas?

    You're missing the Le byte, since you're expecting data back. Try it.

  • How to get free memory size of a card with javax.smartcardio

    Hi,
    How can I find how much memory of a card is free with javax.smartcardio?
    Please your advice.
    Thank in advance.

    gizmo wrote:
    I wanted to read the free memory size with a card reader and javax.smartcardio.
    Is it possible to send a APDU Command to select the root 3F00 and read the properties?There is no built-in smartcardio funationality to do this. What you can do is send an APDU and get the memory by calling the code mentioned already.

  • Javax.naming.PartialResultException (ConnectionException) problem with MSAD

    Hi,
    I have BPM 10gR3 installation connected to Microsoft Active Directory (both on the same VMWare host) and get the following intermittent errors being reported.
    "Exception [javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: migrations.com.au:389
    \[Root exception is java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine\]]]"
    Has anyone run into this problem before or know of a fix?
    I've trolled through some other forums and have found other applications reporting similar problems. I think this has something to do with my AD or DNS settings.
    It's intermittent because I'm able to run my project from time to time but when it hits this condition the engine reports unexpected error has occurred (during an interaction with an instance) or when attempting to login. When things are working I'm able to access the User/participant information. I've created my AD users in an Org Unit called "al" and the users are not listed in the default Users container.
    TP

    Looks like it was a problem with DNS. Built the DNS (and used it) server first and then AD separately (pointing to this DNS) instead of allowing Win 2K3 Server to build AD and DNS the same time.
    TP

  • Having problem with javax packages

    i had problem with compiling my program which is java servlet, and it is complaining that it does exist javax servlet * package , how can i solve this problem?

    I don't think servlets come with the standard packages. You have to find it somewhere else. I think you can try J2EE API. There in beta version for 1.3. Should be ok though. Hopefully it will fit right into 1.4.

  • Compile problem with javax.sql

    I have upgraded to sdk 1.4.2 and tried to compile my code. I am getting an error on import javax.sql.* where I am getting the message "Package does not exist" error. As the result of this any class that is in this package gets an error as well. I am using ant to do the build. It does not seem to have a problem with the other import files and some of my code do compile fine except for this one that contains javax.sql.*. Thanks for your help.

    Are you sure that the javax.sql.* stuff exists in your javac classpath? It seems not to be there. Look for j2ee.jar (from Sun J2EE SDK), or something like that (something like it probably came with your app server).
    Mike

  • JCDK 3.0.1 Problem with PCSC

    I am developing a RMI client application using JCDK 3.0.1. This call is throwing an exception in PCSC mode:
    com.sun.javacard.clientlib.ApduIOCardAccessor ca = new ApduIOCardAccessor();The client application is able to communicate with CREF successfully if jcclient.properties file contains "connection = TCP".
    I want to test with a real card, and after changing jcclient.properties file to "connection = PCSC", I get the following exception:
    WARNING: PC/SC is not officially supported and may not work on all platforms.
    java.lang.UnsatisfiedLinkError: Can't load library: E:/javapcsc\jpcsclite.dllI do not know where this path comes from. I cannot find jpcsclite.dll in JCDK 3.0.1, but it isin JCDK 2.2.2. I tried to link with that by adding the following runtime parameter where jpcsclite.dll is located.
    -Djava.library.path=C:\javacard\jc222\java_card_kit-2_2_2-rr-bin-windows-do\binHowever, I still get the same exception.
    Since I am developing a RMI client, I cannot use javax.smartcardio. Does anyone else have the same issue?

    Hi Shane,
    I passed through all the described problems in the list, and after doing several tests the error that you described is always present if the "jpcsclite_en_US.properties" is not present in the same place of the "jpcsclite.properties". I really don't know the reason, I just copied and pasted the same file, renamed the copy and the error was gone... though both of them include the line where the .dll is found!
    That's how it worked for me, but if anybody knows how it works without that dirty trick, it would be good.
    Regards,
    Leandro
    PS: Just in case that somebody is using the version JCSDK3.0, I did not find the .dll in that version, but in the JCSDK2.2.2 *(:-S)*

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • Problem with JFrame and busy/wait Cursor

    Hi -- I'm trying to set a JFrame's cursor to be the busy cursor,
    for the duration of some operation (usually just a few seconds).
    I can get it to work in some situations, but not others.
    Timing does seem to be an issue.
    There are thousands of posts on the BugParade, but
    in general Sun indicates this is not a bug. I just need
    a work-around.
    I've written a test program below to demonstrate the problem.
    I have the problem on Solaris, running with both J2SE 1.3 and 1.4.
    I have not tested on Windows yet.
    When you run the following code, three JFrames will be opened,
    each with the same 5 buttons. The first "F1" listens to its own
    buttons, and works fine. The other two (F2 and F3) listen
    to each other's buttons.
    The "BUSY" button simply sets the cursor on its listener
    to the busy cursor. The "DONE" button sets it to the
    default cursor. These work fine.
    The "SLEEP" button sets the cursor, sleeps for 3 seconds,
    and sets it back. This does not work.
    The "INVOKE LATER" button does the same thing,
    except is uses invokeLater to sleep and set the
    cursor back. This also does not work.
    The "DELAY" button sleeps for 3 seconds (giving you
    time to move the mouse into the other (listerner's)
    window, and then it behaves just like the "SLEEP"
    button. This works.
    Any ideas would be appreciated, thanks.
    -J
    import java.awt.BorderLayout;
    import java.awt.Cursor;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class BusyFrameTest implements ActionListener
    private static Cursor busy = Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR);
    private static Cursor done = Cursor.getDefaultCursor();
    JFrame frame;
    JButton[] buttons;
    public BusyFrameTest (String title)
    frame = new JFrame (title);
    buttons = new JButton[5];
    buttons[0] = new JButton ("BUSY");
    buttons[1] = new JButton ("DONE");
    buttons[2] = new JButton ("SLEEP");
    buttons[3] = new JButton ("INVOKE LATER");
    buttons[4] = new JButton ("DELAY");
    JPanel buttonPanel = new JPanel();
    for (int i = 0; i < buttons.length; i++)
    buttonPanel.add (buttons);
    frame.getContentPane().add (buttonPanel);
    frame.pack();
    frame.setVisible (true);
    public void addListeners (ActionListener listener)
    for (int i = 0; i < buttons.length; i++)
    buttons[i].addActionListener (listener);
    public void actionPerformed (ActionEvent e)
    System.out.print (frame.getTitle() + ": " + e.getActionCommand());
    if (e.getActionCommand().equals ("BUSY"))
    frame.setCursor (busy);
    else if (e.getActionCommand().equals ("DONE"))
    frame.setCursor (done);
    else if (e.getActionCommand().equals ("SLEEP"))
    frame.setCursor (busy);
    try { Thread.sleep (3000); } catch (Exception ex) { }
    frame.setCursor (done);
    System.out.print (" finished");
    else if (e.getActionCommand().equals ("INVOKE LATER"))
    frame.setCursor (busy);
    SwingUtilities.invokeLater (thread);
    else if (e.getActionCommand().equals ("DELAY"))
    try { Thread.sleep (3000); } catch (Exception ex) { }
    frame.setCursor (busy);
    try { Thread.sleep (3000); } catch (Exception ex) { }
    frame.setCursor (done);
    System.out.print (" finished");
    System.out.println();
    Runnable thread = new Runnable()
    public void run()
    try { Thread.sleep (3000); } catch (Exception ex) { }
    frame.setCursor (done);
    System.out.println (" finished");
    public static void main (String[] args)
    BusyFrameTest f1 = new BusyFrameTest ("F1");
    f1.addListeners (f1);
    BusyFrameTest f2 = new BusyFrameTest ("F2");
    BusyFrameTest f3 = new BusyFrameTest ("F3");
    f2.addListeners (f3); // 2 listens to 3
    f3.addListeners (f2); // 3 listens to 2

    I've had the same problems with cursors and repaints in a swing application, and I was thinking of if I could use invokeLater, but I never got that far with it.
    I still believe you would need a thread for the time consuming task, and that invokeLater is something you only need to use in a thread different from the event thread.

Maybe you are looking for

  • Doubt about BTE  0001011_E   (in F-43 Tcode)

    Hi I need to make some validations in F-43 tcode where i will send some differents error messages depending on header (company, currency..) and detail (posting key, account..) data. I found the BTE  001011_E  (FM   'OPEN_FI_PERFORM_00001011_E) , i al

  • Lenovo Energy Management - Where is my Dust Removal button?

    Hello. After installation my Windows 8.1 which i downloaded from Microsoft DreamSpark i installed all drivers from a CD which came with my laptop in a box. I installed Lenovo Energy Management and I had button to remove dust. After updating my system

  • Select-option parameter passed to function module

    hi, I have passed the select-option parameter as a table to my function module, suppose i have passed it as date(it contains field date-high and date-low) In my function module while i am looping the table and selecting the data according to date_low

  • Incorrect URLs in Breadcrumb and Web Links

    Hi BSP Experts, I have an issue which I cannot resolve and hope you can help. I have copied three pages: prebook.htm, training.htm, trainingtype.htm from the standard LSO application HCM_LEARNING to ZHCM_LEARNING.  Table LSPAGE_ALIAS_C has been updat

  • Getting Photoshop CS3 deactivated to re-install

    We've had Photoshop CS3 running on two machines successfully for several years, one of the PCs was updated to Windows 7 yesterday but we couldn't find a 'Deactivation' option either. Support today claim the serial number is not valid and will do noth