aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Dynamic dowload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Dynamic dowload" Watch "Dynamic dowload" New topic
Author

Dynamic dowload

Andras Nemeth
Ranch Hand

Joined: Jul 31, 2001
Posts: 80
Hi,
I surprised that now when I separated my client I have problem with dynamic downloading.
I have RMISecurityManager at both side and policy with permission java.security.AllPermission.
I set the java.rmi.server.codebase to file://c:\anemeth\java\scjdrmi\classes/ at both side.
My stub is found via codebase, but DataInfo (implements Serializable) can not be found... seems to me that dynamic downloading is not working...
(I made the registry from the server.)
Any idea?
Thanks.
Ban
PS: I tried codebase with file:/ (only one /), but in this case
the client can not found the stub file... so some kind of dynamic downloading is working.
Andras Nemeth
Ranch Hand

Joined: Jul 31, 2001
Posts: 80
Hi,
I went a bit forward. Just a wee-bit.
I set up a WebServer and used this for dynamic downloading.
When I start the client it downloads the stub. Great!
(I can see this at the web server log file.)
But! It even not try to download DataInfo, FieldInfo classes,
which all implement Serializable interface...
I use this URL (to webserver) at the codebase property. I think
it is used not only for dynamic stub downloading.
The exception what I got:
D:\client>java -Djava.security.policy=./suncertify/client/grantall.policy -Djava
.rmi.server.codebase=http://anemeth/examples/classes/ suncertify.client.RemoteDa
taClient anemeth
New SecurityManeger is set!
Exception in thread "main" java.lang.NoClassDefFoundError: [Lsuncertify/db/DataI
nfo;
at java.lang.Class.getMethod0(Native Method)
at java.lang.Class.getMethod(Class.java:888)
at suncertify.db.RemoteData_Stub.<clinit>(Unknown Source)
at java.lang.reflect.Field.getLong(Native Method)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:415)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.init(ObjectStreamClass.java:401)
at java.io.ObjectStreamClass.lookupInternal(ObjectStreamClass.java:112)
at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:566)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
:936)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at suncertify.client.RemoteDataClient.main(RemoteDataClient.java:23)

Sorry for this mass in the exception log, but it can not fit into the rows.
Please, give me a hand.
Thanks.
Ban
Andras Nemeth
Ranch Hand

Joined: Jul 31, 2001
Posts: 80
Originally posted by Andras Nemeth:

Exception in thread "main" java.lang.NoClassDefFoundError: [Lsuncertify/db/DataInfo;

I discovered two little things. It is even not an Exception,
it is an error! The documentation writes about this error,
that:
Thrown if the Java Virtual Machine or a classloader tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found. The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.
Last, but not least (I think), I do think that the class loader
do not try to load it from the codebase...
Where did I fail?
Ban
Andras Nemeth
Ranch Hand

Joined: Jul 31, 2001
Posts: 80
Hi All, (if indeed somebody read it )
I managed to find something about dynamic downloading via
RMI and this page shows that I have to write a class
that load (with the RMI ClassLoader) the class and instantiate.
Is it true? So, this is not automatic downloading?
When I need a class (beacause it was a parameter or a return
type) and it is not available at locally, the RMI will not
download it using codebase property?
Please, help me clarify it!
I shouldn't spend (now) more time with it if it is not automatic.
Thanks a lot.
So long, (and thanks for the fish)
Ban
 
jQuery in Action, 2nd edition
 
subject: Dynamic dowload
 
Similar Threads
RMI CodeBase => slowdown
Help,I will upload my work after handle the problem.
RMI - Dynamic class loading
where's the "sharpen your pencil" answer?
Dynamic Stub Loading with file URL's