File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

output a webapps classpath

 
David Sheltby
Ranch Hand
Posts: 34
  • 0
  • 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
Pie
Posts: 20193
26
MySQL Database
  • 0
  • 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: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 20193
26
MySQL Database
  • 0
  • 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: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 17627
39
Android Eclipse IDE Linux
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic