2 RMI Questions:"RMI and Marshalling" and...........

Hi,
Its not a programming Q. but its a conceptual Q. In all most all the websites related to RMI, I have seen refrence of Marshalling in the context of data encoding. In socket programming, we also do data transfer but there is no Marshalling? What is the reason of Marshalling in RMI? Is it because of Java to Java communication and for socket we use TCP/IP so we leave the Marshalling to the Network Interface Card??
Zulfi.

Thanks for your reply. Ok Marshalling is clear but I have to run a program and then we will discuss more about Marshalling. However after reading the doc specially about stubs
The caller invokes a method on the local stub which is responsible for carrying out the method call on the remote object.
In one other doc, I read the samething about dispatcher. Each machine has a local dispatcher . The client communicates with local dispatcher which then communicates with remote dispatcher and then returns a communication channel back to client via local dispatcher. So is it that these stubs and skeletons are basically the dispatcher component?
In one other doc., http://cs.gmu.edu/~setia/cs571/slides/rmi-proj.pdf , I found that there is no dispatcher component on the client side? Which is correct?
Zulfi.

Similar Messages

  • RMI and concurrency (newbie)

    Hi
    I have a simple question related to RMI and concurrency.
    I have a server and several clients calling remote objects concurrently.
    How is concurrency usually handled when one used RMI ?
    Can we make use of "synchronized" on some method of the remote objects ?
    I have read about risk related to performance and worse, some problems of deadlock if the synchronize is not well organized.
    Is there other ways to deal with that ?
    Thanks in advance for providinge me any information or suggestion.

    RMI is inherently multithreaded. If you have specific remote resources that you want protected from concurrency, then define all of the accessor methods to be synchronized. (I don't think you can get away with making the remote methods synchronized; I would instead figure out what which resources I want to protect, and only protect those particular objects.)
    Could there be problems? Maybe. But these are absolutely standard coding techniques.

  • Rmi and wireless

    Hello!
    I'm using the RMIAdapter sample of Oracle to check the basic mechanism of rmi and wireless.
    Does anybody now, if there are some known problems with wireless regarding this subject?
    I have written both: the adapter and the client code. So far so good. But when I try to point a masterservice
    to this adapter, there are some strange results:
    If I define the RMI Service URL in this way: rmi://localhost:port, ASW accepts the input, but using the
    service returns an IllegalArgumentException in the logfile.
    If I define the RMI Service URL with its ServiceName (= rmi://localhost:port/ServiceName, ASW doesn't accept
    the input.
    So my question is: where's the error? As far as I know, a "correct" RMI URL consists of the following parts:
    rmi://<hostname>[:<port>]/servicename. It would be the second above-mentioned trial.
    Why does ASW rejects this kind of RMI Service URL?
    So it would be great, if someone could help me out with the RMI magic of ASW.
    Thanks a lot in advance,
    Heike Skok

    Hello Heike,
    Here are the values for the RMIAdapter Init Parameters:
    RMI Server URL: rmi://localhost:2099/Sample
    Remote interface: oracle.panama.adapter.rmi.SampleInterface
    (assuming that you didn't make any changes in the sample source code).
    Here are some steps that the documentation does not describe in details (assuming that developers are familiar with RMI).
    1. I copied SampleInterface.class and SampleImpl.class in $ORACLE_HOME/wireless/server/classes/oracle/panama/adapter/rmi directory
    2. I ran
    rmic -d . oracle.panama.adapter.rmi.SampleImpl
    from $ORACLE_HOME/wireless/server/classes directory to generate SampleImpl_Stub.class and SampleImpl_Skel.class
    3. I ran
    java oracle.panama.adapter.rmi.SampleImpl
    from $ORACLE_HOME/wireless/server/classes directory to start my RMI server.
    You have to start the remote RMI server first before you can create the MasterService. The RMIAdapter will connect to the remote RMI server during initialization. The remote RMI server will print out
    "Sample bound in registry" if started correctly.
    If you have problems with the RMI registry then you may have to change JAVA_HOME\jre\lib\security\java.policy file and add the following:
    grant {
    permission java.net.SocketPermission "*:1024-65535",
    "connect,accept";
    permission java.net.SocketPermission "*:80", "connect";
    After doing all that I was able to successfully run RMIAdapter based services.
    Thanks,
    Hristo Tonev

  • Can we use applets as user interfaces with sockets, RMI and J2EE

    Dear Sir or Madam,
    Since I am a TA for software architecture class, some one ask me the following question: I think the answer is "No" based on the document on http://java.sun.com/sfaq/
    How I answer the quesions? Looking forward your help!!!
    1.You may have 2 applets and 2 html files. One applet with one html file may stay at a client PC and run on this PC, and the other applet with the other html file may stay at a server PC and run on this PC. In this case, all the applets are run locally.
    2.Could applets works with sockets, RMI and J2EE?
    3.Can we use applets as user interfaces with sockets, RMI and J2EE?
    Thank you very much!
    Best regards,
    Jing

    The scenario you paint doesn't quite make sense. The "server PC" wouldn't be running an applet, normally, since applets are by definition in a web browser page, and most likely involve user interaction, and "server processes" generally are done without user interaction.
    The security rules around applets are that -- by default -- applets can connect with sockets ONLY to the server from whence the applet was loaded. RMI uses sockets (J2EE is too broad a spec) and hence RMI calls would also be limited to the server from whence the applet was loaded. Within that limitation, an applet could open all the sockets it wants, so long as they are all on the server from whence the applet was loaded.
    If you want two applets on two different systems to communicate with each other, the simplest way is to have them rendevous through a server process on the server(s) from whence each applet was loaded. Maybe it's PC-a <-> server-a <-> server-b <-> PC-b ...? Or maybe PC-a and PC-b both are talking to the same server.
    The limitation is rooted in the security subsystem. You can specify a policy file and override anything in the security subsystem. That does mean signing the applet and then cajoling the user into agreeing to grant greater levels of security than the default. In such a case you can open sockets more broadly and then PC-a could talk directly to PC-b without going through any servers.
    - David

  • RMI and NetBeans again

    Hi everybody,
    I am doing one of my projects in university which involve remote method invocation.
    I wrote a simple program using RMI and it works when I am running it from the console, but I am unable to run it in NetBeans 5.5.1
    I found out that I need to add this text in build.xml file in my project
    <target name="-post-compile">
    <rmic base="${build.classes.dir}" includes="**/Remote*.class"/>
    </target>but still I am receiving this notification
    Trouble: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
            java.net.ConnectException: Connection refused: connectMay be anybody know how to make it work properly?
    Thanks!

    So it works in the Console but not NetBeans?
    Then your question belongs on a NetBeans specific forum and not a forum on Java programming in general.

  • RMI and Corba

    Please i need someone to tell me when to tell me the real life application of RMI and CORBA.

    jtahlborn wrote:
    wpafbuser1 wrote:
    jtahlborn wrote:
    Somebody just posted the answer to this question in another forum:
    http://catb.org/~esr/faqs/smart-questions.html
    I would argue that Google has always had the answer to this question and this is not the place for such a high level interest.Did you check out the link? ;)Haha! Nice. I missed that. We need more of that kind of tough love trickery :)

  • RMI and stub

    i have an ServerIfc.java which is an interface for the RMI (and extends the Remote object) , and ServerImpl.java which is an implemmentation of the ServerIfc.java interface.
    when i execute the rmic command i got ServerImpl_stub.class.
    My question is , if any change in the ServerImpl.java (e.g add System.out) will cause the ServerImpl_stub.class to be changed too? does the ServerImpl_stub.class will be changed only if the ServerIfc.java will be changed??

    I think yes. If you change anything in the interface's implementation the generated stubs and/or skeletons will change too.
    If you change the interface, your implementation-class should change as well. That is quite obvious. Thus, your stubs and skellies will change as well after you've compiled with rmic.
    This question belongs in the RMI forums though...

  • Corba,RMI and RMI-IIOP

    Can someone help me understand and analyze the marshaling techniques of CORBA, RMI and RMI-IIOP??

    RMI/JRMP is easy, just read the RMI Specification:
    http://java.sun.com/j2se/1.5.0/docs/guide/rmi/spec/rmi-protocol.html
    CORBA is not so easy. Find the GIOP and IIOP specifications at http://www.omg.org

  • Difference between RMI and Java Beans

    Hello
    I have to develop a program that allow the users to have access to the Patient information . The program will also organize appointment between the users and the patients. + extra thing like agenda .....
    I will have about 10 to 20 user that will have access at the same time to the same info .
    My question is :what is the best solution for such kind of programes
    RMI :after searching in google (it is light weight )
    java beans:more powerful than RMI
    or maybe thread ???
    any one can explain the difference please ?
    Thank you

    A little [url http://www.google.ca/search?hl=en&q=rmi+ejb&btnG=Google+Search&meta=]google with keywords: rmi ejb would give all the answers you need.
    Specifically you could read [url http://www.devx.com/Java/Article/20843/0/page/1]the article from the first result: EJB and RMI: A Practical Introduction.
    Also there are many threads from these forums that already answered your question in the past.
    Here is one: [url http://forum.java.sun.com/thread.jspa?threadID=539544&messageID=2613399]Rmi and EJB.
    Happy reading!
    Regards

  • RMI and Threads: Calling wait() on a remote object

    I created a counter as a remote object.
    Multiple clients are displaying the counter value.
    If one of the clients increments the counter, I want the displayed counter value on every client to be updated to the new value (of the counter on the server).
    Therefore every client starts a new thread to "listen" for changes of the countervalue. I wanted to call the wait() method on the remote object (the remote counter). But i think it will be called on the stub instead of on the actual remote object.
    Therefore i created a extra method waitForChange() on the remote object.
    public void waitForChange() throws RemoteException, InterruptedException {
         synchronized(this) {
              wait();
    This method only calls the wait() method. Now I'm sure it's called on the remote object and not on the stub.
    This works, but my question is: is there a better way to do this?
    Code:
    ==========================================
    The remote interface
    ==========================================
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface RemoteCounter extends Remote {
         void incrementCounter() throws RemoteException;
         int getCounterValue() throws RemoteException;
         void waitForChange() throws RemoteException, InterruptedException;
    } ==========================================
    The implementation of the remote interface
    ==========================================
    import java.rmi.*;
    import java.rmi.activation.*;
    import RemoteCounter;
    public class RemoteCounterImpl extends Activatable
         implements RemoteCounter {
         private static final long serialVersionUID = 1L;
         private int counter = 0;
         protected RemoteCounterImpl(ActivationID id, MarshalledObject data) throws RemoteException {
              super(id, 0);
         public void incrementCounter() throws RemoteException {
              synchronized(this) {
                   counter++;
                   notifyAll(); //Inform all clients of the new countervalue;
         public void waitForChange() throws RemoteException, InterruptedException {
              synchronized(this) {
                   wait();
         public int getCounterValue() throws RemoteException {
              return counter;
    }==========================================
    A piece of code registering the remote object
    ==========================================
    ActivationDesc desc = new ActivationDesc(agi, "RemoteCounterImpl", codebase, data);
    //Register with rmid
    RemoteCounter counter = (RemoteCounter)Activatable.register(desc);
    // Bind the stub to a name in the registry running on 1099
    Naming.bind("Counter", counter);==========================================
    The panel containing a button, a label
    which starts a new thread listening for
    counter value changes
    ==========================================
    import javax.swing.*;
    import java.awt.Dimension;
    import java.awt.event.*;
    import java.rmi.*;
    import org.personal.exam.services.RemoteCounter;
    public class PanelCounter extends JPanel {
         private static final long serialVersionUID = 1L;
         JLabel labelX = new JLabel("Press testbutton");
         Thread t;
         RemoteCounter remoteCounter;
         public PanelCounter()     {
              try {
                   jbInit();
              } catch(Exception e) {
                   e.printStackTrace();
         private void jbInit() throws Exception
              this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
              this.setPreferredSize(new Dimension(450,300));
              // The securityManager is required to make is possible
              // to download classes from the server
              if (System.getSecurityManager() == null) {
                   System.setSecurityManager(new RMISecurityManager());
              //Create a testButton to increment the counter          
              JButton testButton = new JButton("Increment");
              testButton.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent arg0) {
                        incrementCounter();
              this.add(testButton);
              //Add a label to display the counter value
              this.add(labelX);
              // Create thread to listen for counter value changes
              try {
                   remoteCounter = (RemoteCounter)Naming.lookup("Counter");
                   CounterValueChecker cvl = new CounterValueChecker(labelX, remoteCounter);
                   //Start a thread to listen for changes of the countervalue
                 t = new Thread(cvl);
                 t.start();
              } catch(Exception e) {
                   e.printStackTrace();
              this.setVisible(true);
         private void incrementCounter() {
              String message = "error";
              try {
                   remoteCounter.incrementCounter();
                   message = "Current value is " + remoteCounter.getCounterValue();
              } catch(Exception e) {
                   System.out.println("Test Exception: " + e.getMessage());
                   e.printStackTrace();
              labelX.setText(message);
    }==========================================
    The runnable implementation used by the
    thread to wait for counterchanges
    ==========================================
    import java.rmi.RemoteException;
    import javax.swing.JLabel;
    import org.apache.log4j.Logger;
    import RemoteCounter;
    public class CounterValueChecker implements Runnable {
         private JLabel counterLabel;
         private RemoteCounter remoteCounter;
         public boolean keepChecking= true;
         private Logger logger = Logger.getLogger(this.getClass());
         public CounterValueChecker(JLabel counterLabel, RemoteCounter remoteCounter){
              this.counterLabel = counterLabel;
              this.remoteCounter = remoteCounter;
         public void run() {
              while(keepChecking) {
                   int newVal = -1;
                   synchronized(remoteCounter) {
                        try {
                             //remoteCounter.wait();
    //this does not work. I think because the wait() method is called on the
    //stub instead of on the actual remote object
                             remoteCounter.waitForChange();
                        } catch (InterruptedException e) {
                             keepChecking = false;
                             break;
                        } catch (RemoteException re) {
                             re.printStackTrace();
                        try {
                             newVal = remoteCounter.getCounterValue();
                        } catch (RemoteException re) {
                             re.printStackTrace();
                        counterLabel.setText("New value: " + newVal);
    }This is just a little test. Actually I want to notify clients of changes in data displayed in a Table. If one client saves one record of the data, i want the new record to be displayed immediatly on all clients that are viewing the same data.

    I've been doing some reading about RMI and callback.
    As I understand it, there's a remote object is running on the client now as wel. And the server makes a call to the client.
    But now the server makes a call to one client.
    And the point is, I want all clients to be updated with the new value.
    Does this mean, I have to keep a list with references to all clients connected to the server?
    I my code the notifyAll() method causes all waiting Threads (running on several clients) to wake up and do something (getting the new counter value).

  • What is the difference between RMI and JAX-RPC?

    Dear All
    First of all my understanding of RMI and JAX-RPC:
    RMI is JAVA only version of RPC. It can't talk to any other language.
    JAX-RPC is a part of JWSDP and if you implement your client and server with JAX-RPC, client written in any language can talk with JAX-RPC implementation.
    What else makes them different and am I right with my understanding?
    Finally, I would like to develop clients which will have a java class, say httpserver.java, which will act like a http server, listens to a http port. Now, Two such client will run in two different PC and I want to call a module from one client to another which should be accessible via my httpserver.java. For that which should be my choice RMI or JAX-RPC? Can I achive it with http get-post method, as I am expecting to read some value of variables from one client to the another.
    Say class A has variable a, aa, aaa and clas B has variable b, bb, bbb. Now I want to read the value of b, bb, bbb from class A. How do I do that when class B is listening to a http port with my httpserver.java class.
    Lastly, say B is listening to a http port and I want to send a file to B from A. How can I do that? Remember, B didn�t ask for that. How can A send a file to B when B is listening to a http port with my httpserver.java.
    With regards
    Mohammed Jubaer Arif
    Mobile: +61-0411215302
    Personal Web: http://www.geocities.com/jubairarifctg/
    Org. Web.: http://www.geocities.com/halimschamber/

    simply put, RMI allows you to (semi) transparently treat remote objects as if they were local, and your distributed application can be written (more or less) like a "normal" java app. Sockets just give you a "raw" connection to work with, and you get to build up your application from that.
    I hope that helped
    Lee

  • Please help: RMI and Swing/AWT issue

    Hi guys, I've been having a lot of trouble trying to get a GUI application to work with RMI. I'd appreciate any help. Here's the story:
    I wrote a Java application and its GUI using Netbeans. In a nutshell, the application is about performing searches. I am now at the point where I need exterior programs to use my application's search capabilities, thus needing RMI. Such exterior programs are to call methods currently implemented in my application.
    I implemented RMI, and got the client --> server communication working. However, the GUI just breaks. It starts outputting exceptions, gets delayed, doesn't update properly, some parts of it stop working.... basically hysterical behavior.
    Now take a look at this line within my server class:
    Naming.rebind("SearchProgram", mySearchProgram);
    If I take it out, RMI obviously does not work... but the application and its GUI work flawlessly. If I put it in, the RMI calls work, but the GUI's above symptoms occur again. Among the symptoms are null pointer exceptions which all look similar, are related to "AWT-EventQueue-0", and keep ocurring. Here's just snippet of the errors outputted:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javax.swing.plaf.metal.MetalScrollBarUI.getPreferredSize(MetalScrollBarUI.java:102)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
    at javax.swing.JScrollBar.getMinimumSize(JScrollBar.java:704)
    at javax.swing.ScrollPaneLayout.minimumLayoutSize(ScrollPaneLayout.java:624)
    at java.awt.Container.minimumSize(Container.java:1598)
    at java.awt.Container.getMinimumSize(Container.java:1583)
    at javax.swing.JComponent.getMinimumSize(JComponent.java:1697)
    at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:634)
    at java.awt.Container.minimumSize(Container.java:1598)
    at java.awt.Container.getMinimumSize(Container.java:1583)
    at javax.swing.JComponent.getMinimumSize(JComponent.java:1697)
    at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:634)
    at java.awt.Container.minimumSize(Container.java:1598)
    at java.awt.Container.getMinimumSize(Container.java:1583)
    at javax.swing.JComponent.getMinimumSize(JComponent.java:1697)
    at javax.swing.BoxLayout.checkRequests(BoxLayout.java:433)
    at javax.swing.BoxLayout.layoutContainer(BoxLayout.java:375)
    at java.awt.Container.layout(Container.java:1401)
    at java.awt.Container.doLayout(Container.java:1390)
    at java.awt.Container.validateTree(Container.java:1473)
    at java.awt.Container.validateTree(Container.java:1480)
    at java.awt.Container.validateTree(Container.java:1480)
    at java.awt.Container.validateTree(Container.java:1480)
    at java.awt.Container.validateTree(Container.java:1480)
    at java.awt.Container.validate(Container.java:1448)
    at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:379)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:113)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize(BasicMenuItemUI.java:400)
    at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredSize(BasicMenuItemUI.java:310)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
    at javax.swing.BoxLayout.checkRequests(BoxLayout.java:434)
    at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:251)
    at javax.swing.plaf.basic.DefaultMenuLayout.preferredLayoutSize(DefaultMenuLayout.java:38)
    at java.awt.Container.preferredSize(Container.java:1558)
    at java.awt.Container.getPreferredSize(Container.java:1543)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1617)
    at javax.swing.JRootPane$RootLayout.layoutContainer(JRootPane.java:910)
    at java.awt.Container.layout(Container.java:1401)
    at java.awt.Container.doLayout(Container.java:1390)
    at java.awt.Container.validateTree(Container.java:1473)
    at java.awt.Container.validate(Container.java:1448)
    at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:379)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:113)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    There are no complaints about anything within my code, it's all GUI related whenever I make a bind() or rebind() call.
    Again, any help here would be great... cause this one's just beating me.
    Thanks!

    Maybe you want to change that worker thread to
    not do RMI but anything else (dummy data) to see if it really is RMI, I doubt it, I think you are updating some structures that have to do with swing GUI and hence you will hang.
    Just check this out.

  • Connection to CRX via RMI and getting WeakReference value..... with an exception!

    Hi there,
    I have the following problem.
    I opened a ticket in Day Care Support system, about CRX users/group membership that got lost while synchronization with our LDAP server.
    Although when the user and the group had been created (and therefore taken from that same LDAP server), the membership was good.... but after some time the membership got lost......
    So what i am trying to do now is a Java program that connects to CRX via RMI.
    And gets the list of all the users from a group (aka membership).
    The idea is to monitor the membership each seconds.
    But when trying to get the property "rep:members" of the group, I have the following exception :
    javax.jcr.ValueFormatException: Unknown value type 10
              at org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:13 9)
              at org.apache.jackrabbit.rmi.server.ServerProperty.getValues(ServerProperty.java:71)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
              at java.lang.reflect.Method.invoke(Method.java:611)
              at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)"
    I searched a little bit and found that "10" is the number for type WeakReference.
    That's normal to me because memberships are stored in the group as a list reference to users linked to that group....
    Anyways, what's not normal to me is that when the type is "10" the API does not let me get the Value (cf. ServerProperty.getValues() method)
    Here is the program:
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.Map;
    import javax.imageio.spi.ServiceRegistry;
    import javax.jcr.Node;
    import javax.jcr.NodeIterator;
    import javax.jcr.Property;
    import javax.jcr.PropertyIterator;
    import javax.jcr.Repository;
    import javax.jcr.RepositoryException;
    import javax.jcr.RepositoryFactory;
    import javax.jcr.Session;
    import javax.jcr.SimpleCredentials;
    import javax.jcr.Value;
    public class Test {
              public static void main(String[] args) {
                        String uri = "rmi://sma11c02.............:1234/crx";
                        String username = "admin";
                        char[] password = {....................};
                        String workspace = "crx.default";
                        String nodePath = "/home/groups/a";
                        Repository repository = null;
                        Session session = null;
                        try {
                                  // Connection to repository via RMI
                                            Map<String, String> jcrParameters = new HashMap<String, String>();
                                            jcrParameters.put("org.apache.jackrabbit.repository.uri", uri);
                                            Iterator<RepositoryFactory> iterator = ServiceRegistry.lookupProviders(RepositoryFactory.class);
                                            while (null == repository && iterator.hasNext()) {
                                                      repository = iterator.next().getRepository(jcrParameters);
                                  if (repository == null) {
                                            throw new IllegalStateException("Problem with connection to the repository...");
                                  // Creation of a session to the workspace
                                  session = repository.login(new SimpleCredentials(username, password), workspace);
                                  if (session == null) {
                                            throw new IllegalStateException("Problem with creation of session to the workspace...");
                                  // Get the targetted node
                                  Node node = session.getNode(nodePath);
                                  System.out.println("Node : " + node.getName());
                                  System.out.println();
                                  PropertyIterator properties = node.getProperties();
                                  System.out.println("List of properties for this node :");
                                  while (properties.hasNext()) {
                                            Property property = properties.nextProperty();
                                            System.out.print("\t"+property.getName() + " : ");
                                            if (property.isMultiple()) {
                                                      Value[] values = property.getValues();
                                                      for (int i = 0; i < values.length; i++) {
                                                                System.out.print(values[i]);
                                                                if (i+1 != values.length) {
                                                                          System.out.print(", ");
                                                      System.out.println();
                                            } else {
                                                      Value value = property.getValue();
                                                      System.out.println(value);
                                  System.out.println();
                                  NodeIterator kids = node.getNodes();
                                  System.out.println("List of children nodes for this node :");
                                  while (kids.hasNext()) {
                                            Node kid = kids.nextNode();
                                            System.out.println("\tChild node : "+kid.getName());
                                            PropertyIterator kidProperties = kid.getProperties();
                                            System.out.println("List of properties for this child :");
                                            while (kidProperties.hasNext()) {
                                                      Property property = kidProperties.nextProperty();
                                                      System.out.print("\t"+property.getName() + " : ");
                                                      if (property.isMultiple()) {
                                                                Value[] values = property.getValues();
                                                                for (int i = 0; i < values.length; i++) {
                                                                          System.out.print(values[i]);
                                                                          if (i+1 != values.length) {
                                                                                    System.out.print(", ");
                                                                System.out.println();
                                                      } else {
                                                                Value value = property.getValue();
                                                                System.out.println(value);
                                            System.out.println();
                        } catch (RepositoryException e) {
                                  e.printStackTrace();
                        } finally {
                                  if (session != null) {
                                            session.logout();
    Here is the output of the below program:
    Node : a
    List of properties for this node :
              jcr:createdBy : admin
              jcr:mixinTypes : mix:lockable
              jcr:created : 2011-10-25T16:58:48.140+02:00
              jcr:primaryType : rep:AuthorizableFolder
    List of children nodes for this node :
              Child node : administrators
    List of properties for this child :
              jcr:createdBy : admin
              rep:principalName : administrators
              rep:members : javax.jcr.ValueFormatException: Unknown value type 10
              at org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:13 9)
              at org.apache.jackrabbit.rmi.server.ServerProperty.getValues(ServerProperty.java:71)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
              at java.lang.reflect.Method.invoke(Method.java:611)
              at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
              at sun.rmi.transport.Transport$1.run(Transport.java:171)
              at java.security.AccessController.doPrivileged(AccessController.java:284)
              at sun.rmi.transport.Transport.serviceCall(Transport.java:167)
              at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:547)
              at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:802)
              at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:661)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
              at java.lang.Thread.run(Thread.java:736)
              at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
              at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
              at sun.rmi.server.UnicastRef.invoke(Unknown Source)
              at org.apache.jackrabbit.rmi.server.ServerProperty_Stub.getValues(Unknown Source)
              at org.apache.jackrabbit.rmi.client.ClientProperty.getValues(ClientProperty.java:173)
              at Test.main(Test.java:96)
    Here is the list of jar files i'm using with this program:
              2862818581          61388           crx-rmi-2.2.0.jar
              732434195           335603           jackrabbit-jcr-commons-2.4.0.jar
              1107929681           411330           jackrabbit-jcr-rmi-2.4.0.jar
              3096295771           69246           jcr-2.0.jar
              1206850944           367444           log4j-1.2.14.jar
              685167282           25962           slf4j-api-1.6.4.jar
              2025068856           9748           slf4j-log4j12-1.6.4.jar
    Finally, we are using CQ 5.4 (CRX 2.2) with the latest hotfix and under Websphere 7.0
    Best regards,
    Vincent FINET

    Je suis absent(e) du bureau jusqu'au 17/04/2012
    Je suis absent.
    Je répondrai à votre sollicitation à mon retour le 17 avril 2012.
    Cordialement,
    Vincent FINET
    Remarque : ceci est une réponse automatique à votre message  "[CQ5]
    Connection to CRX via RMI and getting WeakReference value..... with an
    exception!" envoyé le 13/4/12 0:32:14.
    C'est la seule notification que vous recevrez pendant l'absence de cette
    personne.
    Le papier est un bien precieux, ne le gaspillez pas. N'imprimez ce document que si vous en avez vraiment besoin !
    Ce message est confidentiel.
    Sous reserve de tout accord conclu par ecrit entre vous et La Banque Postale, son contenu ne represente en aucun cas un engagement de la part de La Banque Postale.
    Toute publication, utilisation ou diffusion, meme partielle, doit etre autorisee prealablement.
    Si vous n'etes pas destinataire de ce message, merci d'en avertir immediatement l'expediteur.

  • RMI and Swing Events

    Hi,
    I have a problem, integrating an application with RMI and a Client side with swing.
    I have un RMI object that does something, and in any time I want to inform to the client side rmi... I did something like:
    // This is the REmote implementation
    public MyRemoteImpl extends Activatable implements MyRemote{
      EventListenerList listeners;
    // code for activation, etc.......
      public void addListener(MyListener l){
        // add the listener in the list...
      public void fireEvent(String msgEvent){
        // in each listener that is MyListener, .doEvent(String msg)
      // Methods that calls fireEvent...
    // Mylistener interface..
    public MyListener implements EventListener{
      public void doEvent(String msg);
    // The swing client side.
    public MyClient extends JPanel implements MyListener{
      MyRemote rem=null;
      // In the start of ui.. Ido:
      rem.addListener(this);
      public void doEvent(String msg){
        // Puts the message at one component....
    }The problem is that when the doEvent of the Swing side is called, it is executing in the rmid... And the UI is not updated...
    What I do wrong??
    Thanks and Best Regards.

    I wrote an application that does something similar, it receives some event and modifies a JTree accordingly. You should try using the java.awt.EventQueue.invokeLater(Runnable) method. Something like this:
    public void doEvent(String msg) {
        // Determine what changes need to be made
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                // Only the GUI component modification calls need to go here
    }

  • RMI and native code

    Hi
    Can anybody send me a sample code(HelloWorld type)that is based on RMI and uses native code(eg. win32).
    SANJAY

    If you're trying to do anything with native code, then you should be familiar with JNI API, windows or not.
    Check out the JNI tutorials on this site and i'm sure they'll provide you with JNI tutorials and samples.

  • Rmi and http

    i know this might sound silly but i am new to rmi ( to java too )
    i want to understand the difference between rmi and other protocols such as http,ftp and so.
    now what i think i know - and sometimes think im not sure i know or
    perhaps im sure i know nothing about - is that rmi is java specific and can only work with java while http is different if im not wrong.. and rmi does not require http r8?
    so how can rmi work over http or ftp ..,( can it in the 1st place ?)

    Which version of WLS you are using?
    Applet should also need to satisfy the version requirements similar to
    standalone java client. With WLS 5.1, it may work. But, it will not work
    with 6.* servers.
    Again, the JRE versions in the Netscape and IExplorer are different. So the
    applet, working in IE may not work on Netscape. It is better to test a
    sample application, than taking assumptions.
    Cheers,
    ..maruthi
    "Andrea Musumeci" <[email protected]> wrote in message
    news:3cb1dcba$[email protected]..
    can an applet written in java 1.1.x work in a browser using weblogic rmiwithout a plugin? I need to create a java chat applet with callback. Tnx in
    advance

Maybe you are looking for

  • IOS 8 - Disentangling Camera Roll and Photostream - help!

    In iOS 8, Apple removed the “Camera Roll” and “Photostream” albums and collapsed them into a single stream of photos on the camera that can be accessed under “Collections”.  “Collections” also includes all other photos otherwise loaded onto the phone

  • NIPALU.dll entry point error message when launching application

    A previously working application (written in VB6.0, using Measurement Studio 6 and NI-IMAQ1394) now has a fatal error message when starting: "The procedure entry point _pkgModulePackageEventLog@20 could not be located in the dynamic link library NIPA

  • Calculation in an add instance

    I am trying to use an if statement in an addinstance of an interactive form.  Based on the results of one field in the addinstance, I want to sum a different field from the add instance.  So, the customer can add any number of rows and choose from a

  • Extra condition added in the query

    Hi All, I have created a report but its not showing all the results.When I checked the query I saw the extra filter (where ( D1.c7 = 1 )) .I have not added any such filter.Can someone please tell me how this filter has got added and how we can avoid

  • SAP MII user guide

    are there any user guides for MII 12.1 and the latest one coming up 14 ?