Help coderanch get a
new server
by contributing to the fundraiser
  • 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Glassfish: Problem connecting two projects, one a WAR and another just a JAR

Posts: 4804
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really Tomcat, but both are servlet containers and there is a lot of common code, so...

I've been building a system using two NB projects. One is the library of
all the POJO's, persistance, utilities, etc. (call the lib) and the
other is the UI stuff with servlets, jsp pages, beans, etc. For the most
part it works well.

They projects are not connected directly. You have to build the lib and
its jar file first, and then build the web app.

In the web/WEB-INF/lib of the webapp, the library jar file is referenced as
which simply provides a relative path to where the library's jar file is

But, for a new section of code, I need to read the Jar files and look
for classes with specific annotations. And while all that code works,
there is a problem.

To access the jar files, I do

Set resourcePaths = servletContext.getResourcePaths("/WEB-INF/lib");

and when I do this, the library file is not included. Clearly something,
Netbeans, the JVM, Glassfish, or something does not consider that

So I tried creating a symlink to the library jar file in the
"/WEB-INF/lib" directory. Which works to allow the Web app to work, but
makes it impossible to step into the library classes during debugging.
This makes the solution impractical.

I've thought about changing the build.xml in its
<target name="-post-jar"> section to copy the jar file, but that
will fail is I only want to work, test, and debug the jar file.

So I have two questions:
1) what is causing what looks to be functionally identical setups to
perform differently in practice
2) what's the "best" approach to fix this?

Crusading Chameleon likes the size of this ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic