RMI and Exception

Hi all,
I pass all information to server side through
I am trying to do some validation checking on server side. If there is some invalid input, I want to pass the errors (string) to client side indicating that there some inputs are invalid. How can I do that?
Thanks all
Tony Ton

Throw an exception.

Similar Messages

  • 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.

  • Client/server RMI app using Command pattern: return values and exceptions

    I'm developing a client/server java app via RMI. Actually I'm using the cajo framework overtop RMI (any cajo devs/users here?). Anyways, there is a lot of functionality the server needs to expose, all of which is split and encapsulated in manager-type classes that the server has access to. I get the feeling though that bad things will happen to me in my sleep if I just expose instances of the managers, and I really don't like the idea of writing 24682763845 methods that the server needs to individually expose, so instead I'm using the Command pattern (writing 24682763845 individual MyCommand classes is only slightly better). I haven't used the command pattern since school, so maybe I'm missing something, but I'm finding it to be messy. Here's the setup: I've got a public abstract Command which holds information about which user is attempting to execute the command, and when, and lots of public MyCommands extending Command, each with a mandatory execute() method which does the actual dirty work of talking to the model-functionality managers. The server has a command invoker executeCommand(Command cmd) which checks the authenticity of the user prior to executing the command.
    What I'm interested in is return values and exceptions. I'm not sure if these things really fit in with a true command pattern in general, but it sure would be nice to have return values and exceptions, even if only for the sake of error detection.
    First, return values. I'd like each Command to return a result, even if it's just boolean true if nothing went wrong, so in my Command class I have a private Object result with a protected setter, public getter. The idea is, in the execute() method, after doing what needs to be done, setResult(someResult) is called. The invoker on the server, after running acommand.execute() eventually returns acommand.getResult(), which of course is casted by the client into whatever it should be. I don't see a way to do this using generics though, because I don't see a way to have the invoker's return value as anything other than Object. Suggestions? All this means is, if the client were sending a GetUserCommand cmd I'd have to cast like User user = (User)server.executeCommand(cmd), or sending an AssignWidgetToGroup cmd I'd have to cast like Boolean result = (Boolean)server.executeCommand(cmd). I guess that's not too bad, but can this be done better?
    Second, exceptions. I can have the Command's execute() method throw Exception, and the server's invoker method can in turn throw that Exception. Problem is, with a try/catch on the client side, using RMI (or is this just a product of cajo?) ensures that any exception thrown by a remote method will come back as a java.lang.reflect.InvocationTargetException. So for example, if in MyCommand.execute() I throw new MySpecialException, the server's command invoker method will in turn throw the same exception, however the try/catch on the client side will catch InvocationTargetException e. If I do e.getCause().printStackTrace(), THERE be my precious MySpecialException. But how do I catch it? Can it be caught? Nested try/catch won't work, because I can't re-throw the cause of the original exception. For now, instead of throwing exceptions the server is simply returning null if things don't go as planned, meaning on the client side I would do something like if ((result = server.executeCommand(cmd)) == null) { /* deal with it */ } else { /* process result, continue normally */ }.
    So using the command pattern, although doing neat things for me like centralizing access to the server via one command-invoking method which avoids exposing a billion others, and making it easy to log who's running what and when, causes me null-checks, casting, and no obvious way of error-catching. I'd be grateful if anyone can share their thoughts/experiences on what I'm trying to do. I'll post some of my code tomorrow to give things more tangible perspective.

    First of all, thanks for taking the time to read, I know it's long.
    Secondly, pardon me, but I don't see how you've understood that I wasn't going to or didn't want to use exceptions, considering half my post is regarding how I can use exceptions in my situation. My love for exception handling transcends time and space, I assure you, that's why I made this thread.
    Also, you've essentially told me "use exceptions", "use exceptions", and "you can't really use exceptions". Having a nested try/catch anytime I want to catch the real exception does indeed sound terribly weak. Just so I'm on the same page though, how can I catch an exception, and throw the cause?
    try {
    catch (Exception e) {
         Throwable t = e.getCause();
         // now what?
    }Actually, nested try/catches everywhere is not happening, which means I'm probably going to ditch cajo unless there's some way to really throw the proper exception. I must say however that cajo has done everything I've needed up until now.
    Anyways, what I'd like to know is...what's really The Right Way (tm) of putting together this kind of client/server app? I've been thinking that perhaps RMI is not the way to go, and I'm wondering if I should be looking into more of a cross-language RPC solution. I definitely do want to neatly decouple the client from server, and the command pattern did seem to do that, but maybe it's not the best solution.
    Thanks again for your response, ejp, and as always any comments and/or suggestions would be greatly appreciated.

  • 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.

  • RMI Security Exception

    Hi I have followed the sun java RMI trail (tutorial).
    However my server side application is giving me a security exception. I think it s because of the grant code sections:
    grant {
        permission java.net.SocketPermission "*:1024-65535",
            "connect,accept";
        permission java.net.SocketPermission "*:80", "connect";
    };My problem is that I can't understand were to put this code segment, and I read the same page over and over again, and could not find were is says were to put it!!
    As I said I think it is from this, but maybe it is from other parts! not sure! ... Maybe you need to run the server side from a web server??
    The links of the tutorial I am following is the following (from sun java website itself):
    http://java.sun.com/docs/books/tutorial/rmi/
    and the following link is were there is the grant permission code:
    http://java.sun.com/docs/books/tutorial/rmi/running.html
    Thanks for any sugestions!

    I still have the exception:
    ComputeEngine exception: access denied (java.net.SocketPermission host resolve)
    java.security.AccessControlException: access denied (java.net.SocketPermission host resolve)I followed the tutorial step by step, reading and writing the provided code so far. So this is what I have now at the moment:
    I create a permision file and I called it java.policy. In this file I have the following code:
    grant {
        permission java.net.SocketPermission "*:1024-65535",
            "connect,accept";
        permission java.net.SocketPermission "*:80", "connect";
    };Then I have the following code sugested by WirajR in the engine class, which is the server side application:
    static{
        System.setProperty("security.policy", "java.policy");
    }I compiled everything, and no errors are given. But when i run just the server side, I still recieve the above error. When I debuged the application it stops on the following line:
    Naming.rebind(name, engine);Were name is a string containing the following text :
    "//host/Compute"and engine is the class to be exposed over RMI.
    I am betting my problem is with name!! ... maybe
    or else my permission file has invalid data.
    Also wanted to add that security seems to have been taken care of in that tutorial by the following lines of code:
    if (System.getSecurityManager() == null) {
       System.setSecurityManager(new RMISecurityManager());
    }Aren't these to set the security policy?

  • Java.rmi.RemoteException: Exception in ejbLoad

    I use findByPrimaryKey() to find the object first.And I also can get PrimaryKey by method getPrimaryKey().
    But when I invoke method getName()(the method I defined to get name) ,it throws out exception:
    java.rmi.RemoteException: Exception in ejbLoad:; nested exception is:
    java.lang.NullPointerException
    what's wrong?

    Hi Susan ,
    By looking at your question , the first thing that comes to my mind is the "Null pointer Exception" migt only come when you have the null reference to your primary key . I mean , your metod call findByPrimaryKey shoudl return you a NOT NULL reference . But I guess there is a probablility that it might be returning NULL. And after that when u try to use that reference to invoke getName() method , it must be throwing NULL pointer exception. Just try priting the reference returned by your findByPrimaryKey() method.
    If it does not work out , write me more about what exactly is happening at your end.
    -amit

  • How RMI handle exception in RMI kernel ?

    hi everyone.
    How RMI handle exception in RMI kernel ?
    That is , when RMI catch an exception ,
    what RMI should do to handle the exception?
    best regards.

    it throws an exception (some derived class of RemoteException) which is transmitted to, rethrown at, and must be caught at, the client.

  • Standard Java RMI and WLS5.1?

     

    I would surmise that the problem you are seeing is the result of the fact
    that we do not except standard Java RMI calls using the functionality in the
    JDK. You must use the WebLogic implementation of RMI. It is exactly the
    same in terms of APIs, but we have gone through and optimize the underlying
    protocol.
    Please see the documentation for more details.
    We offer both RMI over IIOP and RMI over T3.
    Thanks,
    Michael
    Michael Girdley
    Product Manager, WebLogic Server & Express
    BEA Systems Inc
    Mario Felarca <[email protected]> wrote in message
    news:[email protected]..
    Hello,
    I was trying to get a simple callback demo working using standard java
    RMI and the WLS5.1. Unfortunately, although things seemed to compile
    and launch smoothly, when the client started up and tried to talk to the
    WLS I would get the following error:
    weblogic.rmi.server.ExportException: A description for CallbackImpl was
    found but it could not be read due to: [Failed to find a stub for [class
    CallbackImpl] implements at least one interface [interface Callback]
    which extends Remote.]
    weblogic.rmi.StubNotFoundException: Failed to find a stub for [class
    CallbackImpl] implements at least one interface [interface Callback]
    which extends Remote.
    I tried determining if this was a classpath problem, but all my efforts
    kept producing this result.
    On the flip side, if I retool my objects slightly in order to make them
    use weblogic.rmi.*, then everything works perfectly.
    Is there a tradeoff to using weblogic.rmi over java.rmi?
    Also, does anyone have any ideas as to what might be causing my error
    when using standard rmi?
    Thanks so much in advance,
    Mario-

  • RMI and Netbeans

    hello,
    i have develop a simple application using RMI. It was running perfectly from command prompt.
    Then i imported the project into netbeans 6.1. Then when i run it the server looks running normally but when a client try to connect to the server it given an error
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
    java.lang.ClassNotFoundException: ........(No security manager: RMI class loader disabled)
    Can someone help suggest a solution
    Thanks

    Hi!
    Please tell me how could you get netbeans 6.1 to recognise an RMI project.
    I have too, tried to import some old java files (two rmi interface files a server implementation and an applet) into netbeans 6.1. As far as i can tell it completely refuses to work with RMI, and i have not found ANY support on the internet so far, to how to do it, or any working rmi modules for netbeans 6.1 ...
    Years old rmi developement, what worked nicely under windows 95 (good old days lol) does not wish to work for me now...
    Should I return to use age old enviroments, or what?
    I would deeply appreciate any help from You, or anyone able.
    Thanks!

  • Java.rmi.MarshalException: Exception

    hi,
    i am getting the below error while displaying the data from a servlet. Here in servlet i had written the code to store values. And then i had written a function "getDetails()" which will give result set object. At that time i am getting this error. This method code is in bena class.
    In servlet this is the code i had wriiten
    InitialContext initContext=new InitialContext();
                        home=(InsuranceHome)initContext.lookup(ejbJndiName);
                        remote=home.create();
                        int n=remote.insertDetails(cname,frm_date,to_date,type,ppaid,rmks);
                        ResultSet rs=remote.getResults();
                        while(rs.next())
                             System.out.print(rs.getString(1));
                             System.out.print(rs.getString(2));
                             System.out.print(rs.getString(3));
                             System.out.println(rs.getString(4));
                        System.out.println(n);
    [10/Apr/2008:11:34:06] INFO ( 3108): CORE3282: stdout:      java.rmi.MarshalException: Exception occurred in server thread; nested exception is:
    [10/Apr/2008:11:34:06] INFO ( 3108): CORE3282: stdout:      java.io.NotSerializableException

    the NEVER used here, is it an EJB specification issue or design issue. If EJB specification issue then you should be right of which i am not sure. Please quote reference.
    If design issue then NEVER is wrong. Its depends on task to be addressed. Data Transfer Pattern allows the use of Rowset to exchange data between clients and servers.These options are either DTOs, containers, RowSets all are serializabel.How will you managed bandwidth and memory issues in a critical application where by clients needs to get a copy of data store in their memory(delete,update, insert) and after finished with their task they simply click synchronized.
    this copy(rowset) in client is simply sent to sever for updates rather than doing update, insert, delete request to server for every operation.
    This is a pattern design issue and the choice of Data Transfer Object depends on the task and type of communication between clients and server.
    A RowSet in the situation whereby 1. number of request to server has to be reduced, 2. connection to server has to be minimal. 3. each client gets a copy of his data as a snapshot of server contents processed it an then do synchronization when needed(bulk).Also this is issued when memory of client is a big issue like mobiles so installing a DB on the mobile is not possible. The rowset sent to client must not hold a connection to DB.
    Ivo Sumelong

  • 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 jms

    It is the fouth thread for the jms and rmi. Is there anyone that can answer me?
    I can run rmi and jms sample in the oc4j standalone. but if I run in the application server, there are always some errrors. I have searched all the forum and the documents about application. I found nothing helping to me.
    Is there a tutoral for run rmi and jms in the application server step by step?
    Was there anyone help me, I will lose my job soon.
    God save me.

    I installed the oracle9ias9.02 on linux 7.1. and the installation is ok. I can deploy application.
    I deploy the ear file and the jsp and servlet are running ok.
    In the application, there is a applet which will call the method through rmi.
    and the bean which provide the rmi method will recieve jms messages in the server side.
    here is the applet:
    package transfer;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.io.*;
    import java.util.*;
    import com.longshine.transfer.TransferDataList; //interface file
    * Title: CAO5M3H]TV187]O5M3--J5J1<`?XJ}>]4+Jd
    * Description: @{SCRMI5wSC7~NqFw6K5DTransferDataList3LPr#,2ISCJMS4SJ}>]7"KM6K;q5C4+JdJ}>]!#
    * Copyright: Copyright (c) 2002
    * Company: longshine
    * @author MuCt
    * @version 1.0
    public class TransferMonitor extends Applet {
    boolean isStandalone = false;
    TextArea textArea1 = new TextArea();
    Button refresh = new Button();
    Button stop = new Button();
    Label data_stat=new Label(); //M3<FJ}>]OTJ>
    TransferDataList DataList=null; //6(ReR;8vT63L6TOs5D=S?Z!#
    /**Get a parameter value from applet param list*/
    public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
    (getParameter(key) != null ? getParameter(key) : def);
    /**Construct the applet*/
    public TransferMonitor() {
    /**Initialize the applet*/
    public void init() {
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    /**Component initialization*/
    private void jbInit() throws Exception {
    setLayout(new BorderLayout());
    textArea1.setText("?*J<=SJUIm7]Is:KJ}>]O{O"...\n");
    refresh.setLabel("K"PB");
    refresh.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    refresh_mouseClicked(e);
    stop.setLabel("T]M#");
    stop.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    stop_mouseClicked(e);
    //data_stat.setText("M3<F");
    this.add(textArea1, BorderLayout.CENTER);
    this.add(refresh, BorderLayout.SOUTH);
    this.add(stop, BorderLayout.EAST);
    /**Start the applet
    * ?*J<@{SCRMI:MT67=7~NqFw3LPrTransferDataListServer=(A"A*O5#,5wSC7=7(getPersonList,
    * 5C5=ND1>8qJ=5DJ}>]#,?IRTV1=SOTJ>5=FAD;IO!#
    public void start() {
    String url="rmi://"+getCodeBase().getHost()+"/person_list"; //T63L6TOs5D5XV7<0remote objectC{3F!#
    // System.setSecurityManager(new RMISecurityManager());//applet2;PhR*2ISCsecurityManager9\@m
    try {
    DataList=(TransferDataList)Naming.lookup(url);
    textArea1.append(this.get_gb(DataList.getMessageList()));
    catch (Exception e) {
    System.out.println("Lookup RMI Server Error:"+e);
    /**Stop the applet*/
    public void stop() {
    /**Destroy the applet*/
    public void destroy() {
    /**Get Applet information*/
    public String getAppletInfo() {
    return "Audit Data Monitor Applet";
    /**Get parameter info*/
    public String[][] getParameterInfo() {
    return null;
    /**Main method*/
    public static void main(String[] args) {
    TransferMonitor applet = new TransferMonitor();
    applet.isStandalone = true;
    Frame frame;
    frame = new Frame() {
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    public synchronized void setTitle(String title) {
    super.setTitle(title);
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    frame.setTitle("Applet Frame");
    frame.add(applet, BorderLayout.CENTER);
    applet.init();
    applet.start();
    frame.setSize(400,320);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
    frame.setVisible(true);
    * Ge?U51G0GxSr5D@zJ7OTJ>J}>]#,VXPB?*J<OTJ>PB5DO{O"!#
    void refresh_mouseClicked(MouseEvent e) {
    textArea1.setText("?*J<=SJUPB5DIm7]HOV$O{O"#!#!#!\n");
    this.start();
    System.out.println("clear current text area!!!");
    * reserved
    void stop_mouseClicked(MouseEvent e) {
    System.out.println("click stop button!!!");
    public String get_gb(String s_name) {
    String s_unicode="" ;
    try{
    s_name = s_name.trim ();
    byte[] bytes = s_name.getBytes("8859-1");
    s_unicode = new String(bytes,"GB2312");
    }catch(UnsupportedEncodingException e){
    System.out.println(e.toString());}
    return s_unicode;
    public String get_iso8859_1(String s_name) {
    String s_unicode="" ;
    try{
    s_name = s_name.trim ();
    byte[] bytes = s_name.getBytes("GB2312");
    s_unicode = new String(bytes,"8859-1");
    }catch(UnsupportedEncodingException e){
    System.out.println(e.toString());}
    return s_unicode;
    here is the rmi bean:
    package com.longshine.transfer;
    import java.rmi.*;
    import java.rmi.server.*;
    import com.longshine.pub_func.*;
    * Title: CAO5M3H]TV187]O5M3#-#-RMI Server3LPr#,4&@mRMIT63LGkGs!#
    * Description: 2ISCJMS7=J=4SG06KO5M3;q5CO{O"J}>]!#
    * Copyright: Copyright (c) 2002
    * Company: longshine
    * @author MuCt
    * @version 1.0
    public class TransferDataListServer {
    public TransferDataListServer() {
    public static void main(String[] args) {
    // Read run option:start/stop from command line
    if (args.length != 1) {
    System.out.println("Usage: java " +"TransferDataListServer <option>");
    System.exit(1);
    // System.out.println("Queue name is " + queueName);
    TransferDataListServer ts1 = new TransferDataListServer();
    try {
    String host_name=GetSysparam.getParam("web_server");
    System.out.println(host_name+"------");
    String url="rmi://127.0.0.1:3101/person_list";
    System.out.println("Construction server implementations...");
    TransferDataListImpl p1=new TransferDataListImpl();
    System.out.println("binding server implementation to registry...");
    Naming.rebind(url,p1);
    System.out.println("Waiting for invocations from clients...");
    catch (Exception e) {
    System.out.println("Start RMI Server Error:"+e);
    here is the impl bean:
    package com.longshine.transfer;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.server.*;
    import java.rmi.*;
    import com.longshine.pub_func.*;
    import java.sql.*;
    import javax.jms.*;
    import javax.naming.*;
    * Title: CAO5M3H]TV187]O5M3--J5OV=S?Z5D7~NqFw@`
    * Description:
    * Copyright: Copyright (c) 2002
    * Company: longshine
    * @author MuCt
    * @version 1.0
    public class TransferDataListImpl extends UnicastRemoteObject
    implements TransferDataList
    int TotalMessage=0; //M3<FO{O"W\LuJ}!#
    public TransferDataListImpl() throws RemoteException {
    * 2bJTSC@}#:T63L5wSC5D7=7(#,;q5CIm7]Is:KJ}>]5DAP1m
    public String getPersonList() throws RemoteException {
    String sql_stmt="select * from doc_user";
    int limit=0;
    String user_id,name,str="";
    DbOperate db1=new DbOperate();
    db1.setExecQuery(sql_stmt);
    ResultSet rs=db1.getExecQuery();
    try {
    while (rs.next() && limit<30) {
    user_id=rs.getString("user_id");
    name=rs.getString("name");
    System.out.println("user_id:"+user_id+"---name:"+name);
    str+="user_id:"+user_id+"; name:"+name+"\n";
    limit++;
    db1.setCloseQuery();
    catch (SQLException e) {
    System.out.println(e.getMessage());
    return "error!!!";
    return str;
    * get queue name from config.properties file.
    public String getQueueName() {
    String queue_name="";
    try {
    queue_name=GetSysparam.getParam("queueName");
    catch (Exception e) {
    System.out.println("Get system param error:"+e);
    return queue_name;
    * @{SCJMS5C5=7"KM5DIs:KJ}>]PEO"!#V.:s9)?M;'6KappletJ9SCrmi7=J=5wSC;q5C!#
    public String getMessageList() throws RemoteException {
    String queueName = null;
    Context jndiContext = null;
    QueueConnectionFactory queueConnectionFactory = null;
    QueueConnection queueConnection = null;
    QueueSession queueSession = null;
    Queue queue = null;
    QueueReceiver queueReceiver = null;
    TextMessage message = null;
    String message_str=""; //save all message to a string .
    queueName = this.getQueueName();
    System.out.println("Queue name is " + queueName);
    * Create a JNDI API InitialContext object if none exists
    * yet.
    try {
    // java.util.Hashtable env=new java.util.Hashtable();
    // env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.rmi.registry.RegistryContextFactory");
    // env.put(Context.PROVIDER_URL,"rmi://172.18.18.128:1099");
    jndiContext = new InitialContext();
    catch (NamingException e) {
    System.out.println("Could not create JNDI API " +
    "context: " + e.toString());
    System.exit(1);
    * Look up connection factory and queue. If either does
    * not exist, exit.
    try {
    queueConnectionFactory = (QueueConnectionFactory)
    jndiContext.lookup("QueueConnectionFactory");
    queue = (Queue) jndiContext.lookup(queueName);
    } catch (NamingException e) {
    System.out.println("JNDI API lookup failed: " +
    e.toString());
    System.exit(1);
    * Create connection.
    * Create session from connection; false means session is
    * not transacted.
    * Create receiver, then start message delivery.
    * Receive all text messages from queue until
    * a non-text message is received indicating end of
    * message stream.
    * Close connection.
    try {
    queueConnection =
    queueConnectionFactory.createQueueConnection();
    queueSession =
    queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
    queueReceiver = queueSession.createReceiver(queue);
    queueConnection.start();
    while (true) {
    Message m = queueReceiver.receive(1);
    if (m != null) {
    if (m instanceof TextMessage) {
    message = (TextMessage) m;
    System.out.println("Reading message: " +
    message.getText());
    message_str+=message.getText()+"\n";
    } else {
    break;
    } catch (JMSException e) {
    System.out.println("Exception occurred: " +
    e.toString());
    } finally {
    if (queueConnection != null) {
    try {
    queueConnection.close();
    } catch (JMSException e) { System.out.println("jms expetion: "+e);}
    return message_str;
    all these bean will run ok in the sun j2ee envrionment, but can not work in the application server.
    in the sun j2ee, I will run rmiregister and the run the rmi server, the applet then can invoke the rmi method.
    in the oracle9ias application server, how i can run the rmi server
    thanks

  • Help Please!!!!!  RMI and Threads

    My server has 10 threads doing constant polling of network equipment through use of SNMP. I have a servlet that connects to my server and retrieves collected information by using RMI and displays it in the browser window. Browser refreshes the information very often. So, there is a constant flow of RMI traffic between the server and the servlet.
    Here is the problem:
    There are times when my server stops responding to RMI requests issued by the servlet. All 10 threads that are doing SNMP polling stop being scheduled by the JVM. They block! This picular situation occurs with the server only during RMI requests coming from servlet. It doesn't always happen though. Also, I've noticed that if RMI load is high this problem emerges again.
    I get no RMI exceptions.
    I am using Apache and Jserv.
    All of my attempts to understand and fix the problem have been futile so far. Could a heavy RMI load between my server and servlet be causing my threads to block? Should I decrease my RMI traffic?

    You have the same problem I had. You need to set the timeout .. so once the timeout is exceeded, an exception is thrown. You need to create a custom RMISocketFactory ... trust me, its easier than it sounds ..check the answers to my post at:
    http://forums.java.sun.com/thread.jsp?forum=58&thread=167287
    hope that helps.

  • 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

Maybe you are looking for

  • How to convert the date in the Parameter from to mm/dd/yyyy when you tab out of field

    Hello, Can some one help me out in Oracle Reports 3.0 version i am trying to set in the parameter form two date fields to mm/dd/yyyy. my questions is can we set the both of the date fields to if the user enters as 010202 and Tab out of the field it s

  • CS_BOM_EXPLOSION :Looking for a general concept of function modules

    Dear friends, As i am new to abap world,i have a few apprehensions regarding using a function module.I am being asked to use CS_BOM_EXPLOSION to explode BOM list.I searched at google,found some pretty links and this suited to my requirements as given

  • Monitoring physical standby progress

    Hi, On standby database: SQL> select max(sequence#) from v$log_history; max(sequence#) 643 SQL> select max(sequence#) from v$archived_log; max(sequence#) 647 ---> This is the same as from primary database. SQL> select max(sequence#) from v$archived_l

  • The application level multicast and VoD/LiveTV application

    Hi,    As I read from the document, so far only user's video published out from a Flash Player 10.1 could take advantage of the new application level multicast. But can other video applications scenarios, such as VoD and Live TV (encoded by Flash Liv

  • How to get a Value based on Foreign Key item

    Hi, I have two tables as below TABLE 1 T1_COL1 NUMBER ---primary_key T1_COL2 NUMBER ---foreign_key to TABLE2.T2_COL1 TABLE 2 T2_COL1 NUMBER ---primary_key T2_COL2 VARCHAR2(40) Table 2 is my reference table. I have created a form for table 1, however