• Post Reply Bookmark Topic Watch Topic
  • New Topic

Running JAVA app from network drive may produce ClassNotFoundException  RSS feed

 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I usually launch my app from a network drive. So all resources/JARs are stored on the network. Also, the app has embedded JVM.

I noticed that from time to time I get ClassNotFoundException. The reason is JVM does not preload all resources and fetches classes as needed. So if I have any intermediate network issue, JVM looses connection to the class path and can no longer load resources.


I am looking for some remedy to this issue. I am on JAVA 1.6.13 (or whichever is the latest)


Any advice?
 
Paul Clapham
Sheriff
Posts: 22821
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two fairly obvious remedies:

(1) Don't run your app from a network drive.

(2) If you must do that, make the network more reliable.

If you're looking for technical fixes to make your program run in the presence of network errors -- perhaps even if the network drive is permanently disconnected? -- then I don't think you're going to be happy with the amount of work you have to do and the limited scale of the improvements you can achieve.

One solution you could look into is JNLP, which allows you to run your application from a web server, but basically its strategy is (1) from the list above since it just copies all of your jar files to your local machine.
 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.

JNLP is not the best solution for me. It involves infrastructure and methodology change.

I am not looking for a solution that will enable application to cache/pre-load all data. I'm ok to fail the app if network is lost.

I wonder if there is a way to make JVM to reconnect to the classpath.

For example.
I you use Log4J and record to a file appender that point to thee remote drive, in case of the intermediate network failure, FD is lost and new log records are dismissed. Since I can detect the failure, I can easily reload log4j config and restore logging. (This is trivial solution ignorant to log4j abilities)

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!