Tuesday, February 8, 2011

Eclipse deploy project libraries on glassfish

On eclipse i had this weired problem:
I was able to start glassfish server but any project i tried to deploy was could not access the libraries i had imported in the project.

Lets start with glassfish installation in eclipse.

I am using Eclipse Helios and glassfish 3.0.1

On eclipse go to window->preferences
On the left select server->Runtime Environments and click on add.. button.

Then from the popup window on top left select Download additional server adapters
From the list select to install Glassfish.

Then choose the jdk you want to use and the installation folder of the server (glassfish has to be downloaded and installed manually)
Then finish the operation.

Now if you have some jars imported to your project when you deploy your project the referenced libraries are not by default published to WEB-INF/lib directory of your project.

The directory is located in glassfish-3.0.1\glassfish\domains\domain1\eclipseApps

Not in order to use the libraries you must right click on your eclipse project and select properties.
Then from the left select Deployment Assembly.
Click add and select Java Build path entries


Now your application should be correctly deployed

1 comment:

Anonymous said...

I noticed this problem on Tomcat as well. It only happens sporadically, but I have been looking for a solution to this for the LONGEST time. THANKS!!!