users@glassfish.java.net

Re: FileNotFoundException for lib dependency...

From: Stijn de Witt <StijnDeWitt_at_chello.nl>
Date: Mon, 3 May 2010 20:38:08 +0200

Hi Steve,

As far as I understand it, it's not normally possible to nest jars inside other jars, unless you are using something like OneJar ( http://one-jar.sourceforge.net/ ). That project has a custom classloader that will recursively search jars inside other jars, the default classloaders don't do that.

I have heard some bad talk about OneJar though, it seems that for big projects the recursive search causes a serious performance drop when loading classes. Sun probably had good reasons to implement jars this way in the first place, inconvenient as it may be.

I think you will have to move the nested jars up to the .ear level for this setup to work.

If you are using Glassfish v3, it may be worth your while to investigate EJB 3.1 simplified packaging, which basically allows you to stuff everything you need in one simple .war file (with all your library jars in WEB-INF/lib). That's what I am doing now (and I wish they had implemented this earlier, it really simplifies development).

Hope this helps,

-Stijn

  ----- Original Message -----
  From: Steven Siebert
  To: users_at_glassfish.dev.java.net
  Sent: Monday, May 03, 2010 7:35 PM
  Subject: FileNotFoundException for lib dependency...


  Hello all,

  I have a similar problem I have read about on this mailing list, however, I have upgraded to the latest GlassFish (which resolved the first issue) and a new (but seemingly related) issue has come up. When I attempt to deploy my .ear, which contains .jar libraries with their own dependencies, I get two FileNotFoundExceptions (attached: fileNotFoundExceptions.txt). Each of the Exceptions are a result of "nested" dependencies, and not from the first-level. By this I mean:

  centralizedLogger.ear
  |__ centralizedLogger.jar (my EJB)
  | |__ configuration.jar (deploys fine - this was fixed recently)
  | | |__ get_dev-common (exception)
  | | |__ javax.persistence.jar (exception - needed because I have Entity classes in configuration.jar)
  | |__ logger.jar
  | | |_ javax.persistence.jar (exception - again, have Entity classes in logger.jar)
  | |__ persistence.xml (for both the configuration.jar and logger.jar Entities)
  |__ centralizedLogger.war (nothing significant)

  The persistence.xml is working - I can see the Entities being "transformed" and my tables being created from the DDL annotations (as I requested in the persistence.xml file). My SLSB's deploy and my application-scoped Singleton SLSB starts up. Then, I get the lib file dependency problem looking for the libraries in C:/glassfishv3/glassfish/domains/domain1/applications/centralizedLogger/lib/lib/get_dev-common.jar (forgive me, I am forced to work on a Windows box at work).

  The javax.persistence.jar file I am referencing is referenced from each project from the C:/glassfishv3/glassfish/modules/ directory. Shouldn't the class loader already see this and not need it again?

  The deployment is "successful", as they were just warnings, and GlassFish sets up the standard file system structure under my domain. The application seems to work fully, as well (LogEvents are being persisted, all SLSB's deploy and are operational...). If I manually place the jars in the "expected" place (lib/lib), restart the server, no more complaints.

  Obviously, I can just add the libraries to passify the validating checking...but seems like there is something wrong (especially since everything is working dispite the warnings during "TLD scanning".

  Thanks,

  Steve



------------------------------------------------------------------------------


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
  For additional commands, e-mail: users-help_at_glassfish.dev.java.net