Skip to main content

How to make glassfish deliver static content from a different server using a mapped drive

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
relensaas
Offline
Joined: 2014-05-01

There have been several questions concerning glassfish's alternatedocroot property, but I've not seen this issue addressed -- serving up static content from a drive other than the one glassfish is running on.

We are using glassfish v3.1 running on Windows (several versions 7,8, server 2003, server 2008, server 2012) and use the alternatedocroot property under virtual servers (in domain.xml) to serve up static content. We used to have the property in the application's sun-web.xml file, but moved it (removing the application context) to the server level for business reasons.

This has worked fine, but we now have a site where the static content will be on a different drive from glassfish, mapped to, say, X:. Just referencing the mapped drive does not work:

A typical reference to the content would be:

http://abc.com:8080/inv/100/100_01.jpg

While this worked fine when the drive was the same as that on which glassfish was running, the mapped drive causes an HTTP 502 response of Connection Failed.

We have tried other ways of referencing the other drive including:

dir=//servername/path
dir=file://servername/path
dir=file://X:/path
but to no avail.

Does anyone know how to get glassfish to provide access to static content that is on a drive other than the one glassfish is running on?