Hi,

Issue got resolved. Thank's Kicha for the offline help. Correct code
snippet is as fallows.

var omfac = org.apache.axiom.om.OMAbstractFactory;
var factory = omfac.getOMFactory();
var ns1 = factory.createOMNamespace("
http://org.wso2.securevault/configuration";, "svns");
var root = factory.createOMElement("Password", ns1);

var text = factory.createOMText(root,adminPassword);
var reslover = resFactClass.create(root,true);
var plaintxt = reslover.resolve("UserManager.AdminUser.Password");


On Mon, Feb 9, 2015 at 4:38 PM, Firzhan Naqash <firz...@wso2.com> wrote:

> Hi Udara,
>
> Yes. The secret resolver is initialized during carbon server start-up.
> Therefore You have to explicitly initialize it before hand if you are going
> to use it as a stand alone application.
>
> Regards,
> Firzhan
>
> On Mon, Feb 9, 2015 at 4:29 PM, Udara Liyanage <ud...@wso2.com> wrote:
>
>> Hi,
>>
>> I tried below Jaggery code to decrypt password field of user-mgt.xml. I
>> get the mentioned error message. It seems that SecretResolver needs to be
>> initialized before hand. However every sample I found, it hasn't explicitly
>> initialized. I guess it is initialized from Carbon level. Is it so or do I
>> have to explicitly initialize it?
>>
>>
>> var usrconf = carbon.server.loadConfig('user-mgt.xml');
>> var adminPassword =
>> usrconf.*::['Realm'].*::['Configuration'].*::['AdminUser'].*::['Password'].text();
>>
>> var omfac = org.apache.axiom.om.OMAbstractFactory;
>> var factory = omfac.getOMFactory();
>> var ns1 = factory.createOMNamespace("svns","
>> http://org.wso2.securevault/configuration";);
>> var root = factory.createOMElement("Password", ns1);
>>
>> var text = factory.createOMText(root,adminPassword);
>> print(root.toString());
>> var reslover = resFactClass.create(root,false);
>> var plaintxt = reslover.resolve("usermanager.adminuser.password");
>>
>>
>> -02-09 16:24:10,337] ERROR {org.wso2.securevault.SecretResolver} - * 
>> SecretResolver
>> has not been initialized, it requires to be initialized, with the required
>> configurations before starting*
>> [2015-02-09 16:24:10,339] ERROR
>> {org.jaggeryjs.scriptengine.engine.RhinoEngine} -
>>  org.mozilla.javascript.WrappedException: Wrapped
>> org.wso2.securevault.SecureVaultException: SecretResolver has not been
>> initialized, it requires to be initialized, with the required
>> configurations before starting (/udara//securevault.jag#25)
>> [2015-02-09 16:24:10,339] ERROR
>> {org.jaggeryjs.jaggery.core.manager.WebAppManager} -
>>  org.mozilla.javascript.WrappedException: Wrapped
>> org.wso2.securevault.SecureVaultException: SecretResolver has not been
>> initialized, it requires to be initialized, with the required
>> configurations before starting (/udara//securevault.jag#25)
>> org.jaggeryjs.scriptengine.exceptions.ScriptException:
>> org.mozilla.javascript.WrappedException: Wrapped
>> org.wso2.securevault.SecureVaultException: SecretResolver has not been
>> initialized, it requires to be initialized, with the required
>> configurations before starting (/udara//securevault.jag#25)
>> at
>> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:575)
>> at
>> org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
>> at
>> org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:435)
>> at org.jaggeryjs.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:24)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
>> at
>> org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>> at
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>> at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>> at
>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
>> at
>> org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
>> at
>> org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
>> at
>> org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
>> at
>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
>> at
>> org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
>> at
>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
>> at
>> org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
>> at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>> at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>> at
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
>> at
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>> at
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>> at java.lang.Thread.run(Thread.java:662)
>> Caused by: org.mozilla.javascript.WrappedException: Wrapped
>> org.wso2.securevault.SecureVaultException: SecretResolver has not been
>> initialized, it requires to be initialized, with the required
>> configurations before starting (/udara//securevault.jag#25)
>> at
>> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
>> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
>> at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
>> at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
>> at org.jaggeryjs.rhino.udara.c0._c_script_0(/udara//securevault.jag:25)
>> at org.jaggeryjs.rhino.udara.c0.call(/udara//securevault.jag)
>> at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
>> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
>> at org.jaggeryjs.rhino.udara.c0.call(/udara//securevault.jag)
>> at org.jaggeryjs.rhino.udara.c0.exec(/udara//securevault.jag)
>> at
>> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:570)
>>
>>
>> --
>>
>> Udara Liyanage
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>> phone: +94 71 443 6897
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to