Re: need help about code mobility
Gregg Wonderly <[email protected]>
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
Mark Zaini wrote:
> I have a exception with JVM I don't believe who I have problems
> with Apache(because I made a test without inheritance between A and B )
> the exception is :java.lang.NoClassDefFoundError: class B
> I think that the problem is with the resolution of the hierarchy
> What do you think?
> Thank you very much for the explanations,Mark.
Right, I used 'C' in my example instead of 'B'. I would suggest that you put
these classes into a jar file (B and its dependents) and then place that jar
file into your web server directory under /remoteclasses. If you call that jar
file "server.jar", then you should be able to use your web browser to download
the jar as "http://myhost:80/remoteclasses/server.jar". That same URL is what
you should use in your URL classloader.
Loading classes from a directory structure usually creates these kinds of
problems until you have fully understood package naming vs directory hierarchies
and have a sane configuration.
When you compile your class files do this
javac -d classes *.java
then do
cd classes
jar cvf ../server.jar .
to create the correct jar structure given the packaging you are using.
Then put that server.jar into the director that the /remoteclasses alias points at.
Change your URL in the classloader construction and try it again.
Gregg Wonderly
--------------------------------------------------------------------------
Getting Started: http://www.jini.org/wiki/Category:Getting_Started
Community Web Site: http://jini.org
jini-users Archive: http://archives.java.sun.com/archives/jini-users.html
Unsubscribing: email "signoff JINI-USERS" to [email protected]