Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

output a webapps classpath

 
David Sheltby
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to output (to stdout or logs) the classpath for a webapp?

thanks!
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's back up a step: why would you want to do that?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic