[OpenLayers-Dev] Problem with Auto-Detection of Script Path (and
not a 2.5 release-blocker!)
Eric.Peterson at motorola.com
Mon Oct 8 15:19:55 EDT 2007
I am building a J2EE application using OpenLayers, and I'm including the
OL tree in the .WAR file I build for release. My app deploys just fine.
When I get to the JSP that displays my map, I get weird errors - it
seems like lib/OpenLayers.js is getting loaded correctly, but it doesn't
load any of the other .js files.
My app deploys to a URL that looks like this:
And in the map-display JPS, I include this file via <script src>:
But it tries to include each of the OL files from the wrong location,
I traced the problem in the _getScriptLocation() function. Specifically,
after this line is executed:
var scripts = document.getElementsByTagName('script');
Then the "scripts" variable has only two entries in it, neither of which
have anything to do with Open Layers. So the _getScriptLocation()
function returns "", which gives the wrong path to the file-loading code
later on in OpenLayers.js. I can see the <script> tags in the page
source, but I'm completely confused as to why they're not loaded into
the DOM structure by the time the OL code runs.
I patched the code with a very ugly fix, which forces the
_getScriptLocation() to return a hard-coded path of:
After the patch, it all works just fine.
Environment: My server is a stock JBoss 4.0.5.GA running Tomcat, and I
see the problem on Firefox 2.0, Opera 9.2, and IE6.
Has anyone seen this issue before? Any ideas what might be causing this
behavior? I have no problem patching each OL release before I
incorporate it into my app, but I'd rather just use the plain vanilla OL
Thanks for any help or guidance you can provide.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Dev