Results 1 to 11 of 11
Thread: [newbie]
- 07-05-2009, 01:00 PM #1
[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(); } } }
- 07-05-2009, 01:07 PM #2
Member
- Join Date
- Apr 2009
- Location
- Brisbane
- Posts
- 86
- Rep Power
- 0
Try
Cheers. Keith.Java Code:start java -cp . ProductServer
- 07-05-2009, 01:15 PM #3
doesn't work
- 07-05-2009, 01:43 PM #4
Member
- Join Date
- Apr 2009
- Location
- Brisbane
- Posts
- 86
- Rep Power
- 0
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.
- 07-05-2009, 02:17 PM #5
Sorry about that; I think I was in the middle of the process coz after a while the error was displayed as:
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: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
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: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
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 . . .
- 07-05-2009, 04:25 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
@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.
- 07-05-2009, 06:56 PM #7
...sorry about that I simply forgot
- 07-06-2009, 05:12 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 07-06-2009, 06:07 PM #9
Thank you for your rantful comments.
- 07-06-2009, 07:26 PM #10
- 07-07-2009, 12:10 PM #11
Similar Threads
-
Another newbie
By PhHein in forum IntroductionsReplies: 0Last Post: 04-22-2009, 01:26 PM -
:) newbie...........
By Somitesh Chakraborty in forum IntroductionsReplies: 1Last Post: 08-19-2008, 09:00 AM -
newbie newbie newbie
By krislogy in forum New To JavaReplies: 9Last Post: 08-15-2008, 12:28 AM -
newbie needs help...
By vicky08 in forum New To JavaReplies: 2Last Post: 03-31-2008, 04:26 PM -
Newbie
By CSnoob87 in forum IntroductionsReplies: 2Last Post: 02-18-2008, 08:49 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks