msDrawMap(): Map parent object is null

Rodrigo Del C. Andrade rodrigo.andrade at DIGITRO.COM.BR
Tue Jun 5 12:20:23 PDT 2007


    Hello dear list, I wish it had been a longer while before I had to 
bother y'all again, but I am pulling my hairs out on this one.

    <deepBreath>
    Here it goes: using java mapscript rev 6168 from svn, whenever I try 
to activate a specific layer, I get this:
 
    msDrawMap(): Image handling error. Failed to draw layer named 
'Layer_Tematica_RJ_145'.;: The map parent object is null.
    Tomcat does not crash, so I think this could be a good sign.

    Digging trough mapserver code I was unable to find this message and 
look at its context to get a better idea of whats going on, so debuging 
my code step by step I came up with the following facts:

    1- the layer where it crashes is the 68th in the line. Previously 
layers where drawn, both inline and non-inline ones.
    2 - this layer is a clone from a layer that exists in the mapfile. 
It is declared with:
              
                layerObj layer = 
map.getLayerByName(nameFromConstant).cloneLayer();
               layer.setName("blahblahblah");
               try{
                    valores = mapa.insertLayer(layerValores, -1);
                }catch(Exception e){
                    throw new DGTKeyException("error.maxNumLayers", 
e.getMessage());
               }

    3 - It only crashes when this layer is turned on. Map is shown with 
this layer off when user first logs and it can be turned on from a tree 
widget. If he does, boom.
    4 - Just before calling map.draw(), both map.getLayerByName(name) 
and map.getLayer(index) return the right layer. whem map.draw() is 
called, boom.
    5 - Suspecting of the clonage bits mixed with the changes to object 
parenthood Umberto implemented, I modified make threadtests to clone a 
bunch of layers, insert them into the map, juggle them around a bit like 
happens in my app and then call map.draw() in the hopes of reproducing 
the error. No go. The test works normally and no errors occur. :(
    and finally 6 - reverting to mapserver 4.10.1 "fixes" it.

    Any clues?

    Thanks!

    Rodrigo



-- 
*Rodrigo Del C. Andrade*
/Programador/
/SIC - SSE - Soluções Segurança Pública/

*DÍGITRO TECNOLOGIA*
*E-mail:* rodrigo.andrade at digitro.com.br 
<mailto:rodrigo.andrade at digitro.com.br>
*Fone:* +55 48 3281-7314 / +55 48 3281-7000
*Fax:* +55 48 3281-7299
*Site:* www.digitro.com <http://www.digitro.com>



More information about the MapServer-users mailing list