• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

output a webapps classpath

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to output (to stdout or logs) the classpath for a webapp?

thanks!
 
Marshal
Posts: 28226
95
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
Let's back up a step: why would you want to do that?
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There really isn't a class path -- at least not in the same sense as the command line. What are you actually trying to accomplish?
 
David Sheltby
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting a ClassNotFoundException for a class which is in the web-inf/classes directory. I wanted to confirm that its actually loaded.
 
Paul Clapham
Marshal
Posts: 28226
95
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
It appears you spelled the name of that directory wrong. It should be "WEB-INF/classes", not "web-inf/classes".
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anything that's in WEB-INF/classes will be loaded (and yes, case counts!). You don't need any further affirmation on that.

If you are having problems with a class, the problem is with the class or your package structure, not with the container.
 
David Sheltby
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is WEB-INF/classes. Thats not the problem. I will have to look into the class more. The package structure appears to be correct. Even decompiling the class to verify the package confirms this.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:There really isn't a class path -- at least not in the same sense as the command line. What are you actually trying to accomplish?



Well, actually, there is. And, as a matter of fact I have found it necessary to dump the classpath of a webapp once or twice. It's not that hard if you chase down the proper JavaDocs.

There isn't a single classpath in a J2EE system. Depending on context, the classpath varies, and in particular, each webapp has its own unique classpath - which includes the WEB-INF/classes and contents of the WEB-INF/lib directories of that app's WAR. And, since a WAR in the strict sense is a ZIP file, that should immediately ring the alarm that not all webapp classpath entries may be discrete filesystem paths. But, like I said, there is a classpath and I've had the questionable good fortune to have had to dissect it once or twice.

As a quick solution, I recommend invoking Class.forName on the "missing" class. You can set a debugger breakpoint there and chase into the whole sordid process.
 
reply
    Bookmark Topic Watch Topic
  • New Topic