Arcobjects sample not running in eclipse

4035
11
Jump to solution
09-27-2012 06:06 AM
AvishekDutta
New Contributor
Hi,

I am new to the world of Arcobjects. To experiment I tried running a sample in eclipse but it pointed out a license issue. I am bit confused now about the pr-requisites so help is much needed.

I am running Desktop 10.1 on windows xp. I have also installed the Arcobjects sdk for Java. I have the license(s) and have already registered the product and extensions.

After configuring eclipse following http://resources.esri.com/help/9.3/arcgisengine/java/doc/91b1bd68-21a5-404d-b0d3-cc55086d2b68.htm (here it talks about ArcGIS engine but I did the same steps for ArcObjects) I was able to add create a "ArcObjects Sample" as a new project in eclipse. This is the custom tool "delete features". When I run the ToolRunner class I get the message "Could not initialize an Engine or Basic License. Exiting application." which comes from the static method initializeArcGISLicenses(AoInitialize aoInit).

Now ArcGIS is already running, so I can not understand where the problem is, I don't have ArcGIS engine but a desktop should do fine?

If you can find time to set me right I would be very grateful.

Avishek
0 Kudos
1 Solution

Accepted Solutions
TomSchuller
Occasional Contributor III
Hy,
I have solved the licensing problem between 10.0 and 10.1 system by defining my own "stable" code.
http://bitbucket.schuller.lu/pchprintsoe/src/aae3114abe00/src/lu/etat/pch/gis/utils/LicenceUtils.jav...

To identify your problem, you could enable the Interop-Logging and check these logs?

Tom

View solution in original post

0 Kudos
11 Replies
AvishekDutta
New Contributor
Hi all,

err...Was my explanation not clear enough?

I am a beginner and this is the only place where I hoped to get some help. If someone is running Arcobjects in Eclipse, it would be great if he/she can give some comments.

Avishek
0 Kudos
LeoDonahue
Occasional Contributor III
Avishek,

What version of ArcGIS Desktop do you have?  ArcInfo?  If Yes, keep reading.

Do you have this method in your sample?  private static void initializeArcGISLicenses(AoInitialize aoInit)

If yes, does it try to look for an Engine license and/or an ArcView license?  If you have ArcInfo installed, you will need to change esriLicenseProductCode.esriLicenseProductCodeArcView so that it is looking for ArcInfo.  Just change esriLicenseProductCodeArcView to esriLicenseProductCodeArcInfo.  That should do it.

Leo
0 Kudos
AvishekDutta
New Contributor
Thanks Leo, but this may sound strange.

You were right about changing the esriLicenseProductCode.esriLicenseProductCodeEngine, but ArcInfo (even ArcView) is no longer there. Eclipse help gives me Advanced, ArcServer, Engine, EngineGeoDB, Basic and Standard. Question now is, has the framework changed in 10.1, is there an updated documentation?

For me it worked (almost) with esriLicenseProductCode.esriLicenseProductCodeAdvanced. Now I get this stacktrace:

Removing toolbox from previous run, if it exists...Done.

In order to run this sample, please ensure that this GP tool's jar file is already in ENGINE HOME OR DESKTOP HOME/java/lib/ext folder.
Creating new toolbox from the Function Factory - javadffunctionfactory...Done.
Toolbox dftoolbox.tbx created in P:/workspace/deletefeatures/bin/arcgissamples/geoprocessing/output.

Adding Toolbox dftoolbox.tbx to the GeoProcessor...AutomationException: 0x80004005 - Unspecified error
at com.esri.arcgis.geoprocessing.GeoProcessor.addToolbox(Unknown Source)
at arcgissamples.geoprocessing.DeleteFeaturesToolRunner.runTool(DeleteFeaturesToolRunner.java:132)
at arcgissamples.geoprocessing.DeleteFeaturesToolRunner.main(DeleteFeaturesToolRunner.java:112)



Any ideas? My GP tool's jar file is missing, do I need to download it or something?

Also if you please briefly explain the flow of this sample code. Will it create this tool in the geoprocessing toolbox and execute it like in ArcMap?

Thanks again & awaiting your reply.

Avishek
0 Kudos
TomSchuller
Occasional Contributor III
Hy,
I have solved the licensing problem between 10.0 and 10.1 system by defining my own "stable" code.
http://bitbucket.schuller.lu/pchprintsoe/src/aae3114abe00/src/lu/etat/pch/gis/utils/LicenceUtils.jav...

To identify your problem, you could enable the Interop-Logging and check these logs?

Tom
0 Kudos
FerasObeidat
New Contributor

Hello, I am trying to run HillshadeCommand.java and I have this error, any clue ?

Thanks

the error:

Starting HillshadeCommand - An ArcObjects SDK Developer Sample

Could not initialize an Engine or Basic License. Exiting application.

0 Kudos
EricBader
Occasional Contributor III

This sample seems to only be looking for an Engine deployment or development license ...so if you don't have an Engine license installed on the Dev machine,  running the compiled sample jar will tell you this.

If you have Eclipse, you can install the ArcObjects SDK plugin, open the source code for this sample, and change it to check for an Advanced, Standard Desktop license instead.

Hope this helps?

0 Kudos
FerasObeidat
New Contributor

Hi Eric,

I changed the licence and that was resolved. But, I think the problem is in reading raster data.

Yes, I have Eclipse. Can you please send me the link to download and install  ArcObjects SDK plugin ?

I have licence for ArcGIS Desktop only not for engine

This is the error I get:

Starting HillshadeCommand - An ArcObjects SDK Developer Sample

devKitHome: null

inDataPath: nulljava\samples\data\raster

inDataPath: C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\java\samples\data\raster

Creating output directory - C:\Users\IBM_ADMIN\arcgis_sample_output

Using default Azimuth value 315.0 and Altitude 45.0

start Here

  inDataPath: C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\java\samples\data\raster

  inDataName: dem1

inDataPath: C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\java\samples\data\raster

inDataName: dem1

Opening raster workspace C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\java\samples\data\raster\dem1 and getting its dataset ...

Error: AutomationException: Failed to open raster dataset

AutomationException: 0x80041018 - Failed to open raster dataset in '"esriDataSourcesRaster.GdalRasterDataset"'

  at com.esri.arcgis.datasourcesraster.RasterWorkspace.openRasterDataset(Unknown Source)

  at HillshadeCommand_.createHillshade(HillshadeCommand_.java:203)

Thanks

Feras

0 Kudos
FerasObeidat
New Contributor

Hello,

Any idea how to install the ArcObjects SDK plugin ? the link for it

Thanks

0 Kudos
AvishekDutta
New Contributor
Thanks Tom!!

Thanks for both the tips. I enabled interop-logging. The log file is empty.

If you see my last post this GP tool's jar is missing in DESKTOP HOME/java/lib/ext folder. Infact I don't have any other jars except arcobjects.jar.

It would be very nice if you/someone can run this sample and see if everything is ok.

Thanks,
Avishek
0 Kudos