on 03-07-2007 2:13 PM
Hi guys
I have a webdynpro application and i'm trying to access KM libraries to get the full list of metadata properties. But i'm getting and error while trying to get the service on the following code:
Property propertyAux = null;
IResourceFactory resFactory = ResourceFactory.getInstance();
IRepositoryServiceFactory serFactory = resFactory.getServiceFactory();
IPropertyConfigurationService propConfigService = (IPropertyConfigurationService) serFactory.getService("PropertyConfigurationService");
IMetaNameListIterator i = propConfigService.getMetaModel().nameIterator();
while (i.hasNext()) {
IMetaName metaname = i.next();
if ( metaname.getDocumentPatterns()!= null){
propertyData.setId(metaname.getName());
propertyData.setName(metaname.getLabel(locale));
propertyData.setNamespace(metaname.getNamespace());
propertyData.setDescription(metaname.getDescription(locale));
propertyList.add(propertyData);
}
}
The error on the trace is this one:
System.err#sap.com/KmmsListEAR#System.err#Guest#2####30a27fa0cbfa11dbace30018de0545f1#SAPEngine_Application_Thread[impl:3]_29##0#0#Error##Plain###Configuration Framework error: unable to create an IConfigClientContext instance from an EP5 userInitialConfigException: The configuration service locator could not be initialized for any of the environments. The configuration framework is not available.#
System.err#sap.com/KmmsListEAR#System.err#Guest#2####30a27fa0cbfa11dbace30018de0545f1#SAPEngine_Application_Thread[impl:3]_29##0#0#Error##Plain###InitialConfigException: The configuration service locator could not be initialized for any of the environments. The configuration framework is not available.
My problem is that the repository service factory can't give me any service, i tried with MimeHandlerService an also got a null pointer when i was using a method of the service.
Could you please give me a hand on this one?
Thanks in advance
Hi,
Have you specified a sharing reference to this "<i>PropertyConfigurationService</i>" in the build path?
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luis,
IConfigManager configManager =
Configuration.getInstance().getConfigManager(IConfigClientContext.createContext(someUser));
IConfigPlugin catPlugin = configManager.getConfigPlugin("/cm/[...]");
...
... should lead into the right direction. Also see /thread/145673 [original link is broken]
Hope it helps
Detlev
Hi Detlev
Another question is, how can i get the user for the sentence:
Configuration.getInstance().getConfigManager(IConfigClientContext.createContext(someUser));
Because i've been trying this way:
public IUser getResourceUser() throws Throwable
{
//return ResourceFactory.getInstance().getServiceContext("cmadmin_service").getUser();
// Get EP5 user
com.sap.security.api.IUser sapUser = com.sap.security.api.UMFactory.getAuthenticator().getLoggedInUser();
sapUser.getAccessibilityLevel();
com.sapportals.portal.security.usermanagement.IUser ep5User = com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);
if (ep5User == null)
{
//NetCon.warning.println("Using null user " + ep5User);
}
else
{
if (!ep5User.isAuthenticated())
{
//NetCon.warning.println("Using not authenticated user " + ep5User);
}
}
return ep5User;
}
But is not working, i get nothing on the log, no errors, nothing, by the way, how can i use the log.severe inside an ejb?
I'm trying to get an array with the full metadata property list from the portal with this code
try{
IConfigurationAccess icAccess = Configuration.getInstance();
icAccess.initialize();
IConfigClientContext confContext = IConfigClientContext.createContext(this.getResourceUser());
IConfigManager icManager = icAccess.getConfigManager(confContext);
IConfigPlugin icPlugin = icManager.getConfigPlugin("/cm/services/properties_metadata");
IMutableConfigurable[] imc = icPlugin.getConfigurables();
for (int x = 0; x < imc.length; x++){
WSIMetaName propertyData = new WSIMetaName();
propertyData.setName(imc[x].getIdName());
}
}
catch(InitialConfigException e){
}
catch(CannotAccessConfigException e){
}
catch(Throwable e){
}
return propertyList;
I suppose i get nothing because it's throwing an exception, but the log says nothing.
Thanks in advance
Hi Luis,
In your code above, the log statements in the first fragement are commented out!?! In the second fragment, you habe no logging in the catch blocks, so you cannot see any exceptions...
You can also try to debug your code, which may be easier then extensive logging.
For debugging see http://help.sap.com/saphelp_nw04/helpdata/en/cc/9cb34d9d11f74c98644df2b96b90f1/frameset.htm
For logging see http://help.sap.com/saphelp_nw04/helpdata/en/d2/5c830ca67fd842b2e87b0c341c64cd/frameset.htm
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!
I read the logging guide, thanks it help me a lot!
Sure i'll remember the points but i have another question with the code you gave me, it's giving me an InitialConfigException
IConfigurationAccess icAccess = Configuration.getInstance();
icAccess.initialize();
IUser user = PUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
IConfigClientContext confContext = IConfigClientContext.createContext(user);
IConfigManager icManager = icAccess.getConfigManager(confContext);
IConfigPlugin icPlugin = icManager.getConfigPlugin("/cm/services/properties_metadata");
IMutableConfigurable[] imc = icPlugin.getConfigurables();
Any suggestions?
Thanks in advance
Ok guys problem solved! I used to get this error message:
InitialConfigException: The configuration service locator could not be initialized for any of the environments. The configuration framework is not available.#
In order to solve this you have to add this reference:
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="application">com.sap.km.application</reference-target>
</reference>
To your application-j2ee-engine.xml
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.