Error: com.esri.mo.ui.bean.LayerNotFoundException: Layer could not be found

Error Message

When adding a shapefile layer to a MapObjects Java application, the following error is returned:

com.esri.mo.ui.bean.LayerNotFoundException: Layer could not be found (Mines_msc)

at com.esri.mo.ui.bean.r.getLayer(Unknown Source)

at com.esri.mo.ui.bean.Layer.getLayer(Unknown Source)

at com.esri.mo.ui.bean.Map.addImpl(Unknown Source)

at java.awt.Container.add(Container.java:228)



Two potential causes:

1) An incorrect path to the dataset has been specified.

2) MapObjects Java cannot read shapefile datasets that contain two or more fields where the first 10 characters are identical. This is a limitation imposed by the dBase III (dbf) definition associated with ESRI's proprietary shapefile format. Some applications (such as Arcview and ArcMap) have internal methods for handling dbf fields with more than 10 characters.

Solution or Workaround

1) Check the path to the dataset, and point it to the proper location if incorrect.

2) Verify the field names of the shapefile are in the correct format, and if not, alter them so that the first 10 characters of each field are unique.