Rmi client and jApplet

Hi,
I am trying to use a jApplet as an rmi client. However, either creating a new instance of the class i created, that extends jApplet, in the rmi client class i created or creating a new instance of the rmi client in the class that extends jApplet results in error.
What is the correct way to go about doing this? I developed the jApplet thinking it could be simply used with the rmi client.
instanciating the rmi client in the jApplet class gives :
java.lang.OutOfMemory Error
instanciating the jApplet class in the rmi client class gives other errors I am unable to reproduce at the moment :(
thanks for any help
-Paulo Murphy de Freitas

Hi,
I am trying to use a jApplet as an rmi client. However, either creating a new instance of the class i created, that extends jApplet, in the rmi client class i created or creating a new instance of the rmi client in the class that extends jApplet results in error.
What is the correct way to go about doing this? I developed the jApplet thinking it could be simply used with the rmi client.
instanciating the rmi client in the jApplet class gives :
java.lang.OutOfMemory Error
instanciating the jApplet class in the rmi client class gives other errors I am unable to reproduce at the moment :(
thanks for any help
-Paulo Murphy de Freitas

Similar Messages

  • One RMI client and mutliple RMI server implementation

    Hi,
    We are planning to implement a RMI. In the design approach we are planning to have 1 client and mutiple RMI server and each RMI server register to a system. All the RMI server will have the same functionality. The decision to call particualr RMI server is done at runtime based on some parameter. I am not clear on how to implement the same as I am new to RMI technology, so it would be great if you can suggest some good approach for doing the same.
    Thanks,
    Ramreddy

    greetings,
    your client and server are in the same class?
    i.e. server object (interface implementation instance)
    and lookup are within the same execution thread
    i believe this defeats the purpose of RMI
    the objective is to utilize object methods on different machines
    otherwise, you can just use a local method within your server/client mainline (of course, it ceases to become "remote" at that point)
    logistically, there is also the problem of the runtime not being able to resolve the skeleton/proxy components correctly (since it's probably searching for a client stub which doesn't exist...); maybe you could fake it out by compiling a phony client class - again, this won't provide any advantage but it might run
    perhaps if you shared your system/network setup and a bit more about your design objectives someone in this forum could provide some assistance
    good luck,
    D

  • RMI server and client in one application - Exceptions during some calls

    I wrote an application, which is an RMI-Server (Server1), and another separate application, which is an RMI-Client (Client1). Because I wont use dynamic class loading, I gave the client beside the interface.java also an interface_implementation.java, which is only a dummy of the original interface_implementation of the server. This dummy contains only declarations of the methods (parameters and return values) and no functional code. From this dummy the _stub.class is generated, and it works fine - no problem.
    Now I want to modify Client1 to become also an RMI-Server (Server2) for a second, separate Client (Client2), the methods used are different from the first RMI connection. This Client2 uses a dummy of the implementation of Server2 in the same way as described above. The application Client1+Server2 only has to "translate" the calls from Client2 to Server2 into calls of Client1 to Server1 (Server1 is not changed at all). In case of primitive method parameters or return values this chain of RMI-applications works fine, but in case of more complex structures (my own classes) during the call of Client1 to Server1 an "ClassNotFoundException: access denied to class loader" occurs by running through the stub. Both stub.classes are found, all of the applications know the objects needed, the call of Client1 to Server1 is exactly the same call as it was during the simple version (only Server1 and Client1).
    Does anybody know, why this exception occurs and how I can overcome this ?
    Axel

    I figured out a solution - it's a problem of policies. In detail: Server1's codebase entry (file:) refers to the class directory of Server1's project. In the simple case of only Client1, which has no codebase entry, it works fine without a file permission on the side of Server1. In the complex case of Client1+Server2, which has to have a codebase entry (file:) refering to the class directory of the Server2's project on a separate machine, for exactly the same method call from Client1 to Server1 a file permission entry on the side of Server1 is needed for Server1's class directory. But WHY ???
    It seems to be a little confusing with the codebase entries, many of the posts are contrary to others and to my personal experiences. Some comments given by Adrian Colley throw a little light upon some aspects. Is there anybody, who can explain the whole topic, when, why, and which part of RMI application deals with codebase entries, also in case of not dynamic code downloading ? May be there is also a reference into the java docs, which I didn't found up to now.
    Thanks in advance
    Axel

  • Can I put both RMI server and client in a same program

    hi everybody...
    I wanna know that can I use RMI server and client in a same program....My idea is like that I wanna use the same program for client and server....When I open my program, I can accept connection from other program and if I want to connect to others, I can also connect it. I expect you to understand my question. Here are the sample code for my program...
    package Chat.Rmi;
    import java.lang.*;
    import java.util.*;
    import java.rmi.*;
    import javax.swing.*;
    import java.net.*;
    import java.rmi.server.*;
    import java.rmi.registry.*;
    public class netKitManager implements netKitInterface{
        public netKitManager(){
            try{
            reg = LocateRegistry.createRegistry(4242);
            reg.rebind("NetKitServer",this);
            }catch(RemoteException re){
        public void DirectConnect(String ip){
            try{
            netUser = (netKitInterface) Naming.lookup("rmi://"+ip+":4242/NetKitServer");
            JOptionPane.showMessageDialog(null,"Connection succeded!");
            }catch(NotBoundException nbe){
                JOptionPane.showMessageDialog(null,"There is no server at specified IP address!");
            }catch(MalformedURLException mue){
                JOptionPane.showMessageDialog(null,"IP adress may be wrong!");
            }catch(RemoteException re){
                JOptionPane.showMessageDialog(null,"Remote exception occured!");
        public void SendMessage(String msg){
            try{
            netUser.SetMessage(msg);
            }catch(RemoteException re){
        public void SetMessage(String msg) throws RemoteException{
            chatKit.SetMessage(msg);
        private netKitInterface netUser;
        private Hashtable netUserList;
        private Registry reg;
    }

    Yes it can be done. I have done it.

  • 10.1.3.1 and standalone RMI client

    I'm migrating our J2EE applications from 10.1.2.0.1 to 10.1.3.1.0. I also have a custom JAAS login module that is used by our applications. I have the login module working successfully and web applications that can call EJBs.
    But I am unable to get a simple RMI client to call the EJBs. I can see from the server logs that the JAAS module executes successfully, but then I get a ClassNotFoundException (seems to be from the server) when the client tries to access the JNDI tree (see stack below on the client; I can't find any log relating to this event on the server).
    I had real problems with RMI access in 10.1.2, seems that Oracle AS isn't really thought through with respect to simple RMI client access. In the system-jazn-data.xml file I have granted my custom principals the RMI login permission. I tried to raise a TAR but it's been rejected because 10.1.3.1.0 is a "preview" version. (Don't you guys want to know about bugs before a release goes into production?)
    Any ideas?
    27-Sep-2006 14:50:46 oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_R
    EMOTE_SERVER
    WARNING: Exception returned by remote server: {0}
    java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObjectInfo
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at com.evermind.io.ClassLoaderObjectInputStream.resolveClass(ClassLoader
    ObjectInputStream.java:33)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:153
    8)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
    693)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
    at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1628)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1293)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
    at java.util.HashMap.readObject(HashMap.java:1013)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
    713)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
    at com.evermind.server.rmi.RMIClientConnection.handleListContextResponse
    (RMIClientConnection.java:768)
    at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse
    (RMIClientConnection.java:242)
    at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClien
    tConnection.java:205)
    at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RM
    IClientConnection.java:187)
    at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.jav
    a:152)
    at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnec
    tion.java:127)
    at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
    utor.java:814)
    at java.lang.Thread.run(Thread.java:595)
    javax.naming.NamingException: com/evermind/server/ejb/EJBHomeObjectInfo [Root ex
    ception is java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObje
    ctInfo]
    at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:1
    00)
    at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMICl
    ientConnection.java:334)
    at com.evermind.server.rmi.RMIClientConnection.list(RMIClientConnection.
    java:293)
    at com.evermind.server.rmi.RMIClient.list(RMIClient.java:392)
    at com.evermind.server.rmi.RMIClientContext.getListValues(RMIClientConte
    xt.java:95)
    at com.evermind.server.rmi.RMIContext.listBindings(RMIContext.java:444)
    at com.evermind.naming.FilterContext.listBindings(FilterContext.java:91)
    at com.evermind.server.ApplicationClientContext.listBindings(Application
    ClientContext.java:127)
    at javax.naming.InitialContext.listBindings(InitialContext.java:406)
    at com.axiomsystems.common.tools.test.APITester.getEJBs(APITester.java:2
    06)
    at com.axiomsystems.common.tools.test.APITester.<init>(APITester.java:17
    3)
    at com.axiomsystems.common.tools.test.APITester.main(APITester.java:68)
    Caused by: java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObje
    ctInfo
    at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_
    SERVER(RMICall.java:109)
    at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:9
    1)
    ... 11 more

    Hi Debu,
    I have found the problem and a workaround in my code.
    I obtained the initial context ctx with the following properties set:
    Context.INITIAL_CONTEXT_FACTORY (= oracle.j2ee.naming.ApplicationClientInitialContextFactory)
    Context.PROVIDER_URL (= opmn:ormi://myHost:myPort:myOC4J/myApp)
    Context.SECURITY_PRINCIPAL (= my username)
    Context.SECURITY_CREDENTIAL (= my password)
    then I did
    NamingEnumeration en = ctx.listBindings("ejb/myJndiName")
    which resulted in the exception.
    Changing this to
    Context ctx2 = (Context)ctx.lookup("ejb/myJndiName");
    NamingEnumeration en = ctx2.listBindings("");
    has resolved the problem. I'm not sure why this behaves differently, I suppose it may have something to do with the fact that ctx2 is not an InitialContext object. It is an adequate workaround for my application.
    Once I have an EJB reference, invoking methods over RMI works as expected.
    Thanks,
    Keith

  • RMI Server and RMI Client Problem

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.xxx; nested exception is: java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides, it works again. But I have to keep doing that. I have to keep copying the class file to the servlet directory every 2nd time I try to run it for it to work.
    Anyone know what am I doing wrong?

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it
    works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time
    but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host:
    xxx.xxx.xxx.xxx; nested exception is:
    java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides,which class file ? u mean RMIServer's class files ??
    I have faced the same problem too. In my case if i just restart my Tomcat webserver the error goes and the servlet is very well able to connect back to the RMI Server
    it works again. But I have to keep doing that. I have
    to keep copying the class file to the servlet
    directory every 2nd time I try to run it for it to
    work.
    Anyone know what am I doing wrong?

  • RMI client losing connection and weblogic.rjvm.PeerGoneException

    What causes PeerGoneExceptions? We are seeing this very often on our
    production and test systems. We use WLS RMI clients connected to WLS 4.5.1
    servers w/ service pack 10. I understand that there is a heartbeat between
    the client JVM and the server JVM. Is there any documentation that explains
    how this actually works. For example, how often does the client send its
    heartbeat. Is it configurable? What could cause it to stop or drop the
    connection. We are using straight T3 (no T3S or HTTP).
    thanks for your help,
    Edwin Marcial
    Intercontinental Exchange

    What causes PeerGoneExceptions? We are seeing this very often on our
    production and test systems. We use WLS RMI clients connected to WLS 4.5.1
    servers w/ service pack 10. I understand that there is a heartbeat between
    the client JVM and the server JVM. Is there any documentation that explains
    how this actually works. For example, how often does the client send its
    heartbeat. Is it configurable? What could cause it to stop or drop the
    connection. We are using straight T3 (no T3S or HTTP).
    thanks for your help,
    Edwin Marcial
    Intercontinental Exchange

  • SSL and RMI: Client hangs when trying to connect

    Hi all,
    Sorry for the cross-posting (I first posted to the RMI forum) but I thought someone here might be able to shed some light. The original message follows.
    I have a very simple client/server model implemented using RMI. Previously I used the default socket factories for creating sockets/connections and everything worked fine, but now I want to use SSL to encrypt all the traffic and I'm running into some trouble. The client is able to get the correct remote registry on the correct port, but when it tries to do registry.lookup("ServerName") to get a reference to the server object, it hangs indefinitely.
    Briefly, here are the changes from default RMI:
    As the docs suggested, I created a pair of custom socket factory classes (one for the client and one for the server) that create SSL sockets, and I put the following line in my server's constructor:
    super(0, new CustomClientSocketFactory(), new CustomServerSocketFactory());
    [my server extends UnicastRemoteObject].
    The custom factories are quite simple; the client consists of:
    public class CustomClientSocketFactory implements RMIClientSocketFactory, Serializable {
    public Socket createSocket(final String iHost, final int iPort) throws IOException {
    return SSLSocketFactory.getDefault().createSocket(iHost, iPort);
    and the server:
    public class CustomServerSocketFactory implements RMIServerSocketFactory {
    public ServerSocket createServerSocket(final int iPort) throws IOException {
    return SSLServerSocketFactory.getDefault().createServerSocket(iPort);
    Everything else is the same as before. I start the server on the remote machine, which starts its own registry on a certain port; then I start the client on the local machine. The client gets the registry and then ... nothing happens.
    I know this is somewhat vague, but the changes are small from the working code so I must be doing something wrong in creating SSL sockets. Is there something I can do to trace the process or figure out what's causing the hang? Am I missing some required authentication or other code in the server socket factory (my understanding from the docs is that authentication is optional)? Any other ideas about what's going on?
    Thanks,
    - Matt

    Matt, did you ever determine anything about your Strange Behavior #2. I'm running int the exact same issue. We've been using JSSE without problem for more than 2 years now. I'm currently trying to connect to a new SSL server and the connections setup is taking about 4 minutes (not the SecureRandom seeding) (see my comment in the trace: "this is where it sits for about 3 minutes")
    Trace:
    init context
    trigger seeding of SecureRandom
    done seeding SecureRandom
    %% No cached client session
    *** ClientHello, v3.1
    RandomCookie: GMT: 1005755098 bytes = { 7, 203, 184, 206, 249, 120, 35, 155, 160, 131, 72, 68, 12, 35, 64, 75, 63, 202, 161, 95, 42, 130, 74, 248, 145, 108, 49, 189 }
    Session ID: {}
    Cipher Suites: { 0, 5, 0, 4, 0, 9, 0, 10, 0, 18, 0, 19, 0, 3, 0, 17 }
    Compression Methods: { 0 }
    [write] MD5 and SHA1 hashes: len = 59
    0000: 01 00 00 37 03 01 3C F3 9B DA 07 CB B8 CE F9 78 ...7..<........x
    0010: 23 9B A0 83 48 44 0C 23 40 4B 3F CA A1 5F 2A 82 #...HD.#@K?.._*.
    0020: 4A F8 91 6C 31 BD 00 00 10 00 05 00 04 00 09 00 J..l1...........
    0030: 0A 00 12 00 13 00 03 00 11 01 00 ...........
    SbATAOutAdapter, WRITE: SSL v3.1 Handshake, length = 59
    [write] MD5 and SHA1 hashes: len = 77
    0000: 01 03 01 00 24 00 00 00 20 00 00 05 00 00 04 01 ....$... .......
    0010: 00 80 00 00 09 06 00 40 00 00 0A 07 00 C0 00 00 .......@........
    0020: 12 00 00 13 00 00 03 02 00 80 00 00 11 3C F3 9B .............<..
    0030: DA 07 CB B8 CE F9 78 23 9B A0 83 48 44 0C 23 40 ......x#...HD.#@
    0040: 4B 3F CA A1 5F 2A 82 4A F8 91 6C 31 BD K?.._*.J..l1.
    SbATAOutAdapter, WRITE: SSL v2, contentType = 22, translated length = 16310
    !!! This is where it sits for about 3 minutes !!!!
    %% No cached client session
    *** ClientHello, v3.1
    RandomCookie: GMT: 1005755287 bytes = { 8, 151, 45, 75, 86, 164, 141, 52, 216, 145, 81, 24, 157, 215, 246, 206, 87, 83, 153, 41, 88, 38, 3, 119, 190, 13, 0, 28 }
    Session ID: {}
    Cipher Suites: { 0, 5, 0, 4, 0, 9, 0, 10, 0, 18, 0, 19, 0, 3, 0, 17 }
    Compression Methods: { 0 }
    [write] MD5 and SHA1 hashes: len = 59
    0000: 01 00 00 37 03 01 3C F3 9C 97 08 97 2D 4B 56 A4 ...7..<.....-KV.
    0010: 8D 34 D8 91 51 18 9D D7 F6 CE 57 53 99 29 58 26 .4..Q.....WS.)X&
    0020: 03 77 BE 0D 00 1C 00 00 10 00 05 00 04 00 09 00 .w..............
    0030: 0A 00 12 00 13 00 03 00 11 01 00 ...........
    SbATAOutAdapter, WRITE: SSL v3.1 Handshake, length = 59
    [write] MD5 and SHA1 hashes: len = 77
    0000: 01 03 01 00 24 00 00 00 20 00 00 05 00 00 04 01 ....$... .......
    0010: 00 80 00 00 09 06 00 40 00 00 0A 07 00 C0 00 00 .......@........
    0020: 12 00 00 13 00 00 03 02 00 80 00 00 11 3C F3 9C .............<..
    0030: 97 08 97 2D 4B 56 A4 8D 34 D8 91 51 18 9D D7 F6 ...-KV..4..Q....
    0040: CE 57 53 99 29 58 26 03 77 BE 0D 00 1C .WS.)X&.w....
    SbATAOutAdapter, WRITE: SSL v2, contentType = 22, translated length = 16310
    SbATAOutAdapter, READ: SSL v3.1 Handshake, length = 74
    *** ServerHello, v3.1
    RandomCookie: GMT: 1005755466 bytes = { 145, 7, 69, 98, 152, 52, 222, 159, 96, 162, 220, 85, 77, 107, 82, 203, 25, 94, 208, 124, 2, 245, 96, 208, 224, 254, 139, 206 }
    Session ID: {68, 7, 167, 168, 236, 202, 48, 147, 191, 204, 208, 122, 24, 43, 132, 50, 65, 220, 172, 189, 17, 18, 197, 11, 150, 59, 201, 103, 86, 176, 115, 68}
    Cipher Suite: { 0, 5 }
    Compression Method: 0
    %% Created: [Session-1, SSL_RSA_WITH_RC4_128_SHA]
    ** SSL_RSA_WITH_RC4_128_SHA
    Anybody have any ideas?
    Thanks,
    Marcel

  • Problem of running rmi applet and client for Javacard 3.0.2 Connected

    Need help for running rmi application for Java Card 3.0.2 connected version. I am trying to move a working rmi applet & client from 3.0.2 Classic version to Connected version. Then I found that they are so different and I have no idea how to run my application :(
    Here are what I have done:
    - I have modified the Classic HelloWorld applet to an rmi applet. It is OK when I build and run the application in netbeans. The Applet can be selected successfully.
    My problems are:
    - How to connect a rmi client to the rmi applet? Here are what I have done:
    + Run rmi applet in netbeans
    + Run 'rmic' command to generate stub
    + Run rmiregistry outside of netbeans
    + Build and run rmi client application outside of netbeans by typing "ant all"
    However, the rmi client was not able to connect to the applet:
    [java] java.net.ConnectException: Connection refused: connect
    Would this be a problem of netbeans? Could someone tell me how to run rmi applet/client within or outside netbeans. Thanks a lot!

    Well finally I figured out that CREF-emulators (from JCDK 2.2.1, 2.2.2, 3.0.1 classic) do not support cryptographic extensions at all.
    BUT JCWDE(from JCDK 2.2.1, 2.2.2) - support, but this kind of simulator quite hard to use, because it does not have state between launches.
    About CJCRE(from JCDK 3.0.1 connected) - still don't know, seems not support cryptographic extensions.

  • Communication between client and server

    I am using sockets for communication between the client and the server. is there any other way that i can use for communication between the client and server???

    Plenty of ways: JMS, SOAP, RMI, a RESTful API, writing-files-to-a-shared-directory-on-the-disk, Sneakernet, ...
    Some of them use sockets (or better TCP/IP) as the underlying protocol.
    But to give you a good answer, you would have to tell us why you want a different way. I hope you're not searching for a different way just for the sake of being different.

  • Window 2000 & RMI client losing network connection

    We have a client/server java application communicating via RMI. The application runs perfect when the network is running smoothly. However, once the client loses connectivity with the network, the client runs in offline mode (as expected). However, once the client reestablishes a connection with the network, it is unable to communicate with the Server via RMI. It seems that Windows 2000 reassigns the client's IP address when it goes offline to localhost (127.0.0.1), when the client is reconnected the IP addresses is changed back to the network address, but it is unable to send data to the server running RMI. Any suggestions? We did not experience this problem with Windows NT.

    you need to specify the IP address of the server object from the JVM in which it is exported, using -Djava.rmi.server.hostname argument to the JVM (since the client and server run on one machine, you probably want to set this to 127.0.0.1, I think)

  • RMI client-side - how to encrypt,decrypt  in client-side

    I write javacard RMI style. My problem is...
    Source code below is work when it write in applet (card - side)
    but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. Did I misunderstand?
    if it make for use in applet only, how is possible to do like this " card use privatekey to sign message and send to reader , reader use card's publickey to verify that card sign this signature or not."
    or
    "card use reader's publickey to encrypt message and send to reader, then reader use privatekey to decrypt message (reader authencate itself) "
    because I can't do any of cipher , keybuilder in RMI-client side(reader)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    it will throw nullPointerException
    and if (change false to true)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
    throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    after that I swap this line with
    pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
    since it will do this first (i swap the line already) it also throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    also be the same result with swap
    kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
    to a first line
    it throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    Please help me
    RSAPrivateKey pri_key;
    RSAPublicKey pub_key;
    KeyPair kp;
    Cipher RSAcipher;
    RSAcipher = Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
    pub_key =(RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,KeyBuilder.LENGTH_RSA_512, false);
    kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
    kp.genKeyPair();
              pri_key = (RSAPrivateKey) kp.getPrivate();
              pub_key = (RSAPublicKey) kp.getPublic();
    //ENCRYPT
    RSAcipher.init(pri_key, Cipher.MODE_ENCRYPT);
    t_cipherLengthRSA = RSAcipher.doFinal(plaintxt,(short)0, (short)plaintxt.length, t_cipherText, (short)0);
    //DECRYPT
    RSAcipher.init(pub_key, Cipher.MODE_DECRYPT);
    RSAcipher.doFinal(ciphertxt,(short)0,(short) t_cipherLengthRSA, temp1, (short)0);

    I write javacard RMI style. My problem is...
    Source code below is work when it write in applet (card - side)
    but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw
    exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHMYou can not share code between card and client. On the card use the classes of javacardx.crypto and on the client side those of javax.crypto and java.security.
    It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. That is right.
    if it make for use in applet only, how is possible to
    do like this " card use privatekey to sign message
    and send to reader , reader use card's publickey to
    verify that card sign this signature or not." or
    "card use reader's publickey to encrypt message and
    send to reader, then reader use privatekey to decrypt
    message (reader authencate itself) "On each platform you have classes that provide the same cryptographic operations but the interface of these classes is different (because of the limitations of the java card platform).
    because I can't do any of cipher , keybuilder in
    RMI-client side(reader)Use the java.security.KeyFactory instead.
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    it will throw nullPointerException
    and if (change false to true)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
    throw exception 0x3 -
    javacard.security.CryptoException.NO_SUCH_ALGORITHMCryptographic support on java cards is optional. Not every card supports every algorithm. Try to use another algo.
    Jan

  • How do I make a RMI client running in Bea find a remote, non Bea, RMI server?

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

  • RMI, sockets and NAT

    Apparently a RMI server in a LAN with NAT cannot be seen outside of LAN. Thus, it is possible to manage polling client in LAN and server outside of LAN, but I cannot make bidirectional RMI connection (where server could invoke client's methods, that is), right? Now, is there same kind of a problem with sockets?
    Thanks,
    Yuzaa

    Yuzza,
    There is no problem with sockets, NAT is causing the problem. Happily, there is an easy work-around.
    When you create a remote object, you can specify two additional arguments, an RMIServerSocketFactory, and an RMIClientSocketFactory.
    The RMIClientSocketFactory is an interface which defines one method:
    Socket createSocket(String host, int port);
    Your RMI client gets an object implementing this interface from your server, to connect back to it. Currently your server gives your client a default RMIClientSocketFactory object. This object will let the client connect to the address inside your NAT subnet, this will not work with NAT. That is the problem.
    How can you fix this? Simply implement your own RMIClientSocketFactory, something like this:   class YuzzaCSF implements RMIClientSocketFactory, Serializable {
          final String host;
          YuzzaCSF(String host) { this.host = host; }
          public Socket createSocket(String host, int port) throws IOException {
             return new Socket(this.host, port);
       }Instantiate one using your server's address from outside NAT, and it will force the client to connect correctly.
    This is the core of the solution, there are a few more small steps, but I think you can figure out the rest from here. It would not be as satisfying if I did it all for you :-)
    John

  • NAPT Firewall, RMI Callbacks and JRMP MultiplexProtocol

    Hi All,
    I am looking at having an RMI client behind a Network Address Port Translation firewall receive RMI calls back from an RMI server. NAPT makes it impossible for the client to listen for connection coming from the server through the NAPT firewall.
    This is discussed at http://www.rmiproxy.com and http://cssassociates.com/rmifirewall.html but the proposed solutions do not appear to use the MultiplexProtocol protocol defined by JRMP (http://java.sun.com/j2se/1.4.2/docs/guide/rmi/spec/rmi-protocol3.html).
    The RMI FAQ
    "How can I receive incoming RMI calls through a local firewall"?
    (http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html#firewallIn) had a section for JSSE 1.3 that explained how to use the multiplex protocol (option 4). It sounds like this option referred to the JRMP MultiplexProtocol protocol.
    The multiplex protocol option has been removed from the 1.4 FAQ
    (http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html#firewallIn).
    Tried the "checkListen" and "socket factory" techniques mentioned in the 1.3 FAQ without success with 1.4.2. The RMI client behind the NAPT firewall runs in a signed Applet.
    Is the ability of using the JRMP MultiplexProtocol protocol available in the JRE in order to receive incoming RMI calls through a local firewall? If yes, what do you do in order to use it?
    What is the best way to have RMI callbacks work behind NAPT?
    Thanks a lot in advance!
    Cheers
    Bertrand

    As of about JDK 1.2.2, the ability of RMI clients to negotiate the multiplex protocol was
    removed, but the server-side support remains.
    Your best answer for negotiating NAT filrewalls may be the RMI Proxy http://www.rmiproxy.com, although I could be biased as I wrote it.
    EJP

Maybe you are looking for

  • Converting pdf file to a word document

    I'm trying to convert a pdf file to a word doc during the trial period but I'm having trouble. Does anyone know how I can achieve this?

  • How do I stop Messages notifications when the app is closed?

    Messages have an annoying tendancy to still "come through" even after I've quit the program, popping up in the right hand corner of my screen until I attend to them.  How do I stop this from happening?  There are many times in the day when I'd like t

  • Share Smart Playlists in iTunes?

    Where do smart playlist rules live? I'd like to copy a smart playlist to another user on the same computer without having to re-type the entire list (there are over 60 items). We both use the same media folder which is on an external hard drive that

  • Posting foreign currency

    Hi Gurus! During the posting  t-code F-02 or F-30 with foreign currency, system calculate getting converted automatically by using the rates specified in OB08 the local currency, but when to change the amount (foreign currency), system no replace amo

  • Download flash web page errors

    I am using Chromium without flash player. I go to this page to install flash player http://get.adobe.com/flashplayer/ and just get an empty div. div id="content-body">              <script type="text/javascript">             registerOnLoad(function()