Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-05-2009, 02:00 PM
jon80's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 195
Rep Power: 2
jon80 is on a distinguished road
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).

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




Code:
Product.java
 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;

 }

ProductImpl.java
  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;

 }


ProductServer.java
  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();
       }
    }
}
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-05-2009, 02:07 PM
Member
 
Join Date: Apr 2009
Location: Brisbane
Posts: 86
Rep Power: 0
corlettk is on a distinguished road
Default
Try
Code:
start java -cp . ProductServer
Cheers. Keith.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-05-2009, 02:15 PM
jon80's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 195
Rep Power: 2
jon80 is on a distinguished road
Default
doesn't work
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-05-2009, 02:43 PM
Member
 
Join Date: Apr 2009
Location: Brisbane
Posts: 86
Rep Power: 0
corlettk is on a distinguished road
Thumbs down
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-05-2009, 03:17 PM
jon80's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 195
Rep Power: 2
jon80 is on a distinguished road
Default
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:

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:

Code:
run_demo.bat
@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 . . .
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-05-2009, 05:25 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,256
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
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.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 07-05-2009, 07:56 PM
jon80's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 195
Rep Power: 2
jon80 is on a distinguished road
Default
...sorry about that I simply forgot
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 07-06-2009, 06:12 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,256
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Originally Posted by jon80 View Post
...sorry about that I simply forgot
Seems it's happen to you every time.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 07-06-2009, 07:07 PM
jon80's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 195
Rep Power: 2
jon80 is on a distinguished road
Default
Thank you for your rantful comments.
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 07-06-2009, 08:26 PM
angryboy's Avatar
Senior Member
 
Join Date: Jan 2009
Location: Javaland
Posts: 743
Rep Power: 2
angryboy is on a distinguished road
Default
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)
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 07-07-2009, 01:10 PM
jon80's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 195
Rep Power: 2
jon80 is on a distinguished road
Default
perhaps I was not clear; I only meant that it is irrelevant. I don't do mistakes on purpose duh!
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another newbie PhHein Introductions 0 04-22-2009 02:26 PM
:) newbie........... Somitesh Chakraborty Introductions 1 08-19-2008 10:00 AM
newbie newbie newbie krislogy New To Java 9 08-15-2008 01:28 AM
newbie needs help... vicky08 New To Java 2 03-31-2008 05:26 PM
Newbie CSnoob87 Introductions 2 02-18-2008 09:49 AM


All times are GMT +2. The time now is 02:19 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org