<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>My app deploys to a
URL that looks like this:</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2><A
href="http://www.myhost.com/myapp/">http://www.myhost.com/myapp/</A></FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>And in the
map-display JPS, I include this file via <script src>:</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2><A
href="http://www.myhost.com/myapp/scripts/OpenLayers/release/2.4/lib/OpenLayers.js">http://www.myhost.com/myapp/scripts/OpenLayers/release/2.4/lib/OpenLayers.js</A></FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>But it tries to
include each of the OL files from the wrong location, like
this:</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2><A
href="http://www.myhost.com/myapp/lib/OpenLayers">http://www.myhost.com/myapp/lib/OpenLayers</A></FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007></SPAN><SPAN class=187532518-08102007><FONT
face=Arial size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>I traced the problem
in the _getScriptLocation() function. Specifically, after this line is
executed:</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><SPAN class=sourceRowText>var scripts =
document.getElementsByTagName('script');</SPAN></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>I patched the code
with a very ugly fix, which forces the _getScriptLocation() to return a
hard-coded path of:</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2>/myapp/scripts/OpenLayers/release/2.4/</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>After the patch, it
all works just fine.</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>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 code.</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial size=2>Thanks for any help
or guidance you can provide.</FONT></SPAN></DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=187532518-08102007><FONT face=Arial
size=2>-eP</FONT></SPAN></DIV></BODY></HTML>