• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Running JAVA app from network drive may produce ClassNotFoundException

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 28329
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)

 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic