on 05-12-2011 12:17 PM
Hi
I am trying to capture the portal security question and answer by using below code,but when i run this it is giving java Null pointer exception.can one please correct the code.
import aspp.wdp.IPrivateTest;
import com.sap.security.api.IUser;
import com.sap.security.api.IUserAccount;
import com.sap.security.api.IUserAccountFactory;
import com.sap.security.api.UMException;
import com.sap.security.api.UMFactory;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDUMException;
import com.sap.security.api.persistence.*;
try {
try {
IUserAccountFactory account = UMFactory.getUserAccountFactory();
IUser user =WDClientUser.getCurrentUser().getSAPUser();
IUserAccount[] user_account = user.getUserAccounts();
IUserAccount maint = account.getMutableUserAccount(user_account[0].getUniqueID());
String uid = user_account[0].getUniqueID();
String namespace[] = maint.getAttributeNamespaces();
//
String ques[] = maint.getAttribute("com.sap.security.core.persistence","securityquestion");
String pwd = maint.getHashedPassword();
wdComponentAPI.getMessageManager().reportSuccess(namespace[0]);
wdComponentAPI.getMessageManager().reportSuccess(ques[0]);
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (UMException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Thanks in advance
Deepika.M
Edited by: deepika_indian on May 13, 2011 8:41 AM
Hi Deepika,
Use this code at starting of Init method.
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
if (wdClientUser.isAnonymousUser()) {
wdClientUser = WDClientUser.forceLoggedInClientUser();
}
You are running the application without login credentials, so it is giving null pointer exception. when u use this code it asks for login credentials.
Regards,
Pradeep Kumar G
Edited by: pradeep_546 on May 13, 2011 2:05 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Deepika,
Can u please paste the Exception Trace?
Regards,
Pradeep Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Pradeep
Please find it
500 Internal Server Error
SAP NetWeaver Application Server 7.00/Java AS 7.00
Failed to process request. Please contact your system administrator.
[Hide]
Error Summary
While processing the current request, an exception occured which could not be handled by the application or the framework.
If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
Root Cause
The initial exception that caused the request to fail, was:
java.lang.NullPointerException
at aspp.Test.wdDoInit(Test.java:129)
at aspp.wdp.InternalTest.wdDoInit(InternalTest.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
... 26 more
See full exception chain for details.
System Environment
Client
Web Dynpro Client Type HTML Client
User agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Version null
DOM version null
Client Type ns7
Client Type Profile nn7
ActiveX disabled
Cookies enabled
Frames enabled
Java Applets enabled
JavaScript enabled
Tables enabled
VB Script enabled
Server
Web Dynpro Runtime Vendor: SAP, build ID: 7.0103.20081111115141.0000 (release=NW701_03_REL, buildtime=2008-12-07:13:19:14[UTC], changelist=51958, host=pwdfm246), build date: Thu Oct 21 15:31:11 IST 2010
J2EE Engine 7.01 PatchLevel 56102.
Java VM IBM J9 VM, version:2.3, vendor: IBM Corporation
Operating system Linux, version: 2.6.25.5-1.1-default, architecture: amd64
Session & Other
Session Locale en_US
Time of Failure Fri May 13 18:05:33 IST 2011 (Java Time: 1305290133819)
Web Dynpro Code Generation Infos
local/ztest
SapDictionaryGenerationCore 7.0011.20061002105236.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:18:09[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
SapDictionaryGenerationTemplates (unknown)
SapGenerationFrameworkCore 7.0011.20060719095755.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:06:02[UTC], changelist=411255, host=PWDFM101.wdf.sap.corp)
SapIdeWebDynproCheckLayer 7.0011.20061002110128.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:23:37[UTC], changelist=419396, host=PWDFM101.wdf.sap.corp)
SapMetamodelCommon 7.0011.20061002105432.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:06:50[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
SapMetamodelCore 7.0011.20061002105432.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:06:44[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
SapMetamodelDictionary 7.0011.20060719095619.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:15:47[UTC], changelist=411251, host=PWDFM101.wdf.sap.corp)
SapMetamodelWebDynpro 7.0011.20061227101814.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:20:32[UTC], changelist=431317, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationCTemplates 7.0011.20061227101859.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:36:10[UTC], changelist=431321, host=pwdfm101)
SapWebDynproGenerationCore 7.0011.20061002110128.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:23:48[UTC], changelist=419396, host=PWDFM101.wdf.sap.corp)
SapWebDynproGenerationTemplates 7.0011.20061227101859.0000 (release=645_VAL_REL, buildtime=2007-01-06:15:36:10[UTC], changelist=431321, host=pwdfm101)
sap.com/tcwddispwda
No information available null
sap.com/tcwdcorecomp
No information available null
Detailed Error Information
Detailed Exception Chain
java.lang.NullPointerException
at aspp.Test.wdDoInit(Test.java:129)
at aspp.wdp.InternalTest.wdDoInit(InternalTest.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:430)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:754)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:289)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(AccessController.java:219)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
Thanks & Regards
Deepika
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.