Results 1 to 11 of 11

Thread: [newbie]

  1. #1
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default [newbie]

    So, I'm doing the following:

    1. running 'start rmiregistry' from the windows command line (cli). No issues are noted here, however, is there some way of confirming that no errors have occurred?

    2. starting another cli session and running 'start java ProductServer'

    NOTE: The .class files are compiled successfully within the directory.
    Product is an interface not a class (see Product.java below).

    Java Code:
    Microsoft Windows [Version 6.0.6001]
    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
    
    C:\Users\Administrator>cd Documents
    
    C:\Users\Administrator\Documents>cd Java Code Snippets
    
    C:\Users\Administrator\Documents\Java Code Snippets>dir
     Volume in drive C has no label.
     Volume Serial Number is F081-49E8
    
     Directory of C:\Users\Administrator\Documents\Java Code Snippets\Product
    
    05/07/2009  12:54    <DIR>          .
    05/07/2009  12:54    <DIR>          ..
    05/07/2009  12:40               219 Product.class
    05/07/2009  12:34               286 Product.java
    05/07/2009  12:40               632 ProductImpl.class
    05/07/2009  12:37               556 ProductImpl.java
    05/07/2009  12:55               998 ProductServer.class
    05/07/2009  12:54               983 ProductServer.java
                   6 File(s)          3,674 bytes
                   2 Dir(s)  138,310,074,368 bytes free
    
    C:\Users\Administrator\Documents\Java Code Snippets\Product>start java ProductSe
    rver
    
    C:\Users\Administrator\Documents\Java Code Snippets\Product>

    ..and I'm getting the following error:

    Constructing server implementations...
    Binding server implementations to registry...
    javax.naming.CommunicationException [Root exception is java.rmi.ServerException:
    RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: Product]
    at com.sun.jndi.rmi.registry.RegistryContext.bind(Unk nown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.bind(Un known Source)
    at javax.naming.InitialContext.bind(Unknown Source)
    at ProductServer.main(ProductServer.java:34)
    Caused by: java.rmi.ServerException: RemoteException occurred in server thread;
    nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: Product
    at
    sun.rmi.server.UnicastServerRef.oldDispatch(Unicas tServerRef.java:396
    )
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 59)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:5
    35)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run0(TCPTranspor
    t.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport
    .java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908)
    at java.lang.Thread.run(Thread.java:619)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceiv edFromServer(Unknow
    n Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unk nown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    ... 4 more
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
    ception is:
    java.lang.ClassNotFoundException: Product
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknow n Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(Unicas tServerRef.java:386
    )
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 59)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:5
    35)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run0(TCPTranspor
    t.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport
    .java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassNotFoundException: Product
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 52)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(L oaderHandler.java:7
    11)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Loader Handler.java:655)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Loader Handler.java:592)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(RM IClassLoader.java:6
    28)
    at java.rmi.server.RMIClassLoader.loadProxyClass(RMIC lassLoader.java:294
    )
    at sun.rmi.server.MarshalInputStream.resolveProxyClas s(MarshalInputStrea
    m.java:238)
    at java.io.ObjectInputStream.readProxyDesc(ObjectInpu tStream.java:1531)
    at java.io.ObjectInputStream.readClassDesc(ObjectInpu tStream.java:1493)
    at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1
    732)
    at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:351)
    ... 12 more


    :confused:

    Java Code:
    [B]Product.java[/B]
     import java.rmi.*;
    
     
      /**
         The interface for remote product objects.
      */
      public interface Product extends Remote
      {
         /**
            Gets the description of this product.
           @return the product description
        */
        String getDescription() throws RemoteException;
    
     }
    
    [B]ProductImpl.java[/B]
      import java.rmi.*;
    
      import java.rmi.server.*;
    
     
      /**
         This is the implementation class for the remote product
         objects.
      */
      public class ProductImpl
         extends UnicastRemoteObject
        implements Product
     {
        /**
           Constructs a product implementation
           @param n the product name
        */
        public ProductImpl(String n) throws RemoteException
        {
           name = n;
    
        }
    
        public String getDescription() throws RemoteException
        {
           return "I am a " + name + ". Buy me!";
    
        }
    
        private String name;
    
     }
    
    
    [B]ProductServer.java[/B]
      import java.rmi.*;
      import java.rmi.server.*;
      import javax.naming.*;
    
    
      /**
         This server program instantiates two remote objects,
         registers them with the naming service, and waits for
         clients to invoke methods on the remote objects.
      */
     public class ProductServer
     {
        public static void main(String args[])
        {
           try
           {
              System.out.println("Constructing server implementations...");
    
    
              ProductImpl p1 = new ProductImpl("Blackwell Toaster");
              ProductImpl p2 = new ProductImpl("ZapXpress Microwave Oven");
    
    
              System.out.println("Binding server implementations to registry...");
              Context namingContext = new InitialContext();
              namingContext.bind("rmi:toaster", p1);
              namingContext.bind("rmi:microwave", p2);
              System.out.println("Waiting for invocations from clients...");
    
           }
           catch (Exception e)
           {
              e.printStackTrace();
           }
        }
    }

  2. #2
    corlettk is offline Member
    Join Date
    Apr 2009
    Location
    Brisbane
    Posts
    86
    Rep Power
    0

    Default

    Try
    Java Code:
    start java -cp . ProductServer
    Cheers. Keith.

  3. #3
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    doesn't work

  4. #4
    corlettk is offline Member
    Join Date
    Apr 2009
    Location
    Brisbane
    Posts
    86
    Rep Power
    0

    Thumbs down

    Quote Originally Posted by jon80 View Post
    doesn't work
    Care to be a little more forthcoming?

    C'mon for FFS a "senior member" should know the drill by now. If you ask for help it's encumbent upon you to provide as much pertintant information as possible, to allow the helper(s) to identify the problem.

    "It doesn't work" don't tell me diddy.

    I'm out. GL.

    Cheers. Keith.

  5. #5
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    Quote Originally Posted by corlettk View Post
    Care to be a little more forthcoming?

    C'mon for FFS a "senior member" should know the drill by now. If you ask for help it's encumbent upon you to provide as much pertintant information as possible, to allow the helper(s) to identify the problem.

    "It doesn't work" don't tell me diddy.

    I'm out. GL.

    Cheers. Keith.
    Sorry about that; I think I was in the middle of the process coz after a while the error was displayed as:

    Java Code:
    Constructing server implementations...
    Binding server implementations to registry...
    javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectExce
    ption: Connection refused to host: 192.168.2.201; nested exception is:
            java.net.ConnectException: Connection refused: connect]
            at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
            at com.sun.jndi.toolkit.url.GenericURLContext.bind(Unknown Source)
            at javax.naming.InitialContext.bind(Unknown Source)
            at ProductServer.main(ProductServer.java:34)
    Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.2.201;
     nested exception is:
            java.net.ConnectException: Connection refused: connect
            at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
            at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
            at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
            at sun.rmi.server.UnicastRef.newCall(Unknown Source)
            at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
            ... 4 more
    Caused by: java.net.ConnectException: Connection refused: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(Unknown Source)
            at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
            at java.net.PlainSocketImpl.connect(Unknown Source)
            at java.net.SocksSocketImpl.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
    ource)
            at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
    ource)
            ... 9 more
    The ProductServer just doesn't start on its own, it needs a few services to run (I guess...sorry I might be a senior member but I'm still learning). So, I compiled the following batch file:

    Java Code:
    [B]run_demo.bat[/B]
    @echo off
    rem demonstrates the use of calling a remote method
    rem javac Product*.java
    rmic -v1.2 ProductImpl 2> rmic.error.log
    start rmiregistry 2>>rmic.error.log
    start java ProductServer 2> ProductServer.log
    java ProductClient 
    pause
    I've noted that the last line gives me an error unless I execute it on its own (i.e. open the console window and run java ProductClient separately:
    javax.naming.NameNotFoundException: toaster
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(U nknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup( Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at ProductClient.main(ProductClient.java:35)
    Press any key to continue . . .

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    @jon80, please use an appropriate title next time. And also I believe that since you are dealing here in the forum for a long time, you know the best way to present your question. Take that serious jon80.

  7. #7
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    ...sorry about that I simply forgot

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by jon80 View Post
    ...sorry about that I simply forgot
    Seems it's happen to you every time. ;)

  9. #9
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    Thank you for your rantful comments.

  10. #10
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    Quote Originally Posted by jon80 View Post
    Thank you for your rantful comments.
    I take this to mean you are not coming back then. Good luck in finding a new forum. Since most members here are also members of the sun forum, maybe you'll have better luck with those boy-lovers at java ranch.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  11. #11
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    perhaps I was not clear; I only meant that it is irrelevant. I don't do mistakes on purpose duh!

Similar Threads

  1. Another newbie
    By PhHein in forum Introductions
    Replies: 0
    Last Post: 04-22-2009, 01:26 PM
  2. :) newbie...........
    By Somitesh Chakraborty in forum Introductions
    Replies: 1
    Last Post: 08-19-2008, 09:00 AM
  3. newbie newbie newbie
    By krislogy in forum New To Java
    Replies: 9
    Last Post: 08-15-2008, 12:28 AM
  4. newbie needs help...
    By vicky08 in forum New To Java
    Replies: 2
    Last Post: 03-31-2008, 04:26 PM
  5. Newbie
    By CSnoob87 in forum Introductions
    Replies: 2
    Last Post: 02-18-2008, 08:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •