Infrastructure Map Server Developer

Infrastructure Map Server Developer

Reply
New Member
kdelcroix
Posts: 2
Registered: ‎02-17-2009
Message 1 of 2 (158 Views)

MgServiceNotSupportedException: The specified service is not supported

158 Views, 1 Replies
02-17-2009 02:38 AM
Hello,

I would like to enumerate all resources but I get an Exception everytime I try to get a MgResourceService object:
"org.osgeo.mapguide.MgServiceNotSupportedException: The specified service is not supported."

But when I browse MapAgent ( Services API > "Resources" > "EnumerateResources"), I can retrieve the resources.

Here the source code I'm using:
----------------------------------------------
{code}
MapGuideJavaApi.MgInitializeWebTier("C:\\Program Files\\MapGuideOpenSource2.0\\Server\\Bin\\serverconfig.ini");
MgUserInformation cred = new MgUserInformation("Administrator", "admin");

// Connect to the site and get a feature service and a resource service instances
MgSiteConnection siteConn = new MgSiteConnection();
siteConn.Open(cred);

// Create a session repository
MgSite site = siteConn.GetSite();
sessionId = site.CreateSession();

// >>>> THE EXCEPTION OCCURS AT THE FOLLOWING LINE <<<<
MgResourceService resourceSrvc = (MgResourceService)siteConn.CreateService(MgServiceType.ResourceService);

// Enumerates all maps in the library
MgResourceIdentifier resourceId = new MgResourceIdentifier("Library://");
MgByteReader mgBR = resourceSrvc.EnumerateResources(resourceId, -1, "MapDefinition", false);
System.out.println("-------------------------MAPS----------------------------");
System.out.println(mgBR.toString());
System.out.println("---------------------------------------------------------");
}
catch(MgException mge)
{
mge.printStackTrace();
}
{code}
----------------------------------------------

I checked in MapAdmin if the service was well set... but I have seen nothing wrong.

Thanks to post a suggestion if you have an little idea.

Edited by: kdelcroix on Feb 17, 2009 10:40 AM
Added "code" tags Edited by: kdelcroix on Feb 17, 2009 10:41 AM
Better visibility of the line generating the error
New Member
kdelcroix
Posts: 2
Registered: ‎02-17-2009
Message 2 of 2 (158 Views)

Re: MgServiceNotSupportedException: The specified service is not supported

02-17-2009 07:22 AM in reply to: kdelcroix
If found the error: the file I gave to the initializer was not the good file. Here is the good line code for the initializer:
{code}
MapGuideJavaApi.MgInitializeWebTier("C:\\Program Files\\MapGuideOpenSource2.0\\WebServerExtensions\\www\\webconfig.ini");
{code}
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.