Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBoss class loader

 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on JBoss 5.0.0 GA. I have an .ear file which contains few libraries(.jar files) at the root level in the ear.

I was under the impression that all the libraries(.jar files) at the root level of ear are in the classpath by default but i get class not found exceptions while deploying the ear. However If, i add the jar file to the application.xml then it works fine.

Is this the intended behaviour? Shouldn't JBoss add the libraries to classpath by default?

Thanks,
Srikanth.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, this is the intended behavior. Only JAR files in the lib directory within the EAR file are automatically added to the classpath.
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Johnson:
Yes, this is the intended behavior. Only JAR files in the lib directory within the EAR file are automatically added to the classpath.


Peter,

This question might be silly but want some clarification from you.
I have few .properties files at the root level of ear and JBoss picks all the files which means they are in the classpath by default then why doesn't it pick the jar files? Is it how the JBoss is designed?

Thanks,
Srikanth.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is strange but true. But recall that if you place a directory in your classpath that the JVM does not pick up the JAR files located in that directory - you have to add the JAR files specifically. (Rumor has it that this will be "fixed" in JDK 7...)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic