aspose file tools*
The moose likes Other Java Products and Servers and the fly likes Glassfish: Problem connecting two projects, one a WAR and another just a JAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Glassfish: Problem connecting two projects, one a WAR and another just a JAR" Watch "Glassfish: Problem connecting two projects, one a WAR and another just a JAR" New topic
Author

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

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

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
../../../../fnflib/dist/fnflib.jar
which simply provides a relative path to where the library's jar file is
located.

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
"/WEB-INF/lib"
includes
../../../../fnflib/dist/fnflib.jar

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?

Thanks
Pat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Glassfish: Problem connecting two projects, one a WAR and another just a JAR