Skip to Content
author's profile photo Former Member
Former Member

UWLException: (Default) Logged in users context or session doesn't exist

hi

i tried create a web dynpro project, and access uwl, like the document

Accessing UWL Notifications from Web Dynpro Using UWL API

but doesn't matter i tried

IUser loggedinuser = UMFactory.getLogonAuthenticator().getLoggedInUser();

or

IUser loggedinuser = WDClientUser.getCurrentUser().getSAPUser();

it always hit UWLException: (Default) Logged in users context or session doesn't exist

my code like follows:

	public void getInbox() {
		IWDMessageManager messageManager = wdComponentAPI.getMessageManager();
		wdContext.nodeInboxData().invalidate();
		try {
			IUWLService uwlService = (IUWLService) WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY);// PortalRuntime.getRuntimeResources().getService(IUWLService.ALIAS_KEY);//
			UWLContext uwlContext = new UWLContext();
			IUser loggedinuser =UMFactory.getLogonAuthenticator().getLoggedInUser(); 
			uwlContext.setAllowBackEndConnections(true);
			uwlContext.setUser(loggedinuser);
			uwlContext.setLocale(loggedinuser.getLocale());
			IUWLSession uwlSession = uwlService.beginSession(uwlContext, 600);
			uwlContext.setSession(uwlSession);
			IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);
			QueryResult result = itemManager.getItemsForItemType(uwlContext, ItemType.UWL_ITEM_NOTIFICATION, null, null);
			ItemCollection coll = result.getItems();
			List l = coll.list();
			Iterator iter = l.iterator();
			while (iter.hasNext()) {
				Item item = (Item) iter.next();
				if (item.getExternalType().equals("UWLNotification") && !item.getStatus().equals(StatusEnum.COMPLETED)) {
					IPrivateMyToDoCompView.IInboxDataElement data = wdContext.nodeInboxData().createInboxDataElement();
					data.setItem(item);
					data.setSubject(item.getSubject());
					data.setDescription(item.getDescription());
					data.setStatus(item.getStatus().getText());
					data.setCreatorId(item.getCreatorId());
					data.setCreatedDate(item.getCreatedDate().toString());
					wdContext.nodeInboxData().addElement(data);
				}
			}
			uwlService.endSession(uwlContext);
		} catch (Exception e) {
			e.printStackTrace();
			messageManager.reportException(" Cause:" + e.getCause() + "\n Message:" + e.getMessage());
		}
	}

can any one tell me why? and i develop with nwce 7.1 ehp1.

thank you

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2010 at 01:48 PM

    My System: CE 7.1

    Hi, it's me again. Now I found the error by myself - DAMN!

    As I have seen we have got the same error. I guess your template was also this tutorial: [Accessing UWL Notifications from Web Dynpro Using UWL API|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/802bfda2-8a85-2b10-9290-d67da32d0c01]

    The error message (in my case - maybe in yours too) was NOT due to missing user context or session. The error was thrown because

    QueryResult result = itemManager.getItemsForItemType(uwlContext, ItemType.UWL_ITEM_NOTIFICATION, null, null);

    returned nothing.

    Solution:

    Replace the tutorial code of the getInbox() method with this: [How to use UWL API for NetWeaver BPM Tasks|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/16356] [original link is broken]; and everything works fine.

    Maybe that will be your solution too!

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2010 at 09:24 AM

    Hi,

    I have the same problems.

    Did you already solved it?

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2010 at 03:51 PM

    Hi Nitin / Martin

    Could you resolve your issue? I am also facing similar problem. I have created one portal service which takes userid as input and should return UWL task count as output. After deploying the service in SAP WAS

    when I test it from wsnavigator providing userId as input I get below error in response

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><rpl:getUwlCountsResponse xmlns:rpl='urn:TestUwlSvcVi'><rpl:Response xsi:type='tns:ArrayList' xmlns:tns='java:sap/standard'><tns:List xsi:type='xs:string'>Line -2</tns:List><tns:List xsi:type='xs:string'>Line -1</tns:List><tns:List xsi:type='xs:string'>Line 0</tns:List><tns:List xsi:type='xs:string'>Line 1</tns:List><tns:List xsi:type='xs:string'>Line 2: USER.CORP_LDAP.mss02</tns:List><tns:List xsi:type='xs:string'>Line 3</tns:List><tns:List xsi:type='xs:string'>Line 4: itemManager: com.sap.netweaver.bc.uwl.core.ItemManager@7a4227c6</tns:List><tns:List xsi:type='xs:string'>Line 5: view: com.sap.netweaver.bc.uwl.config.UWLView@4a7fcbf2</tns:List><tns:List xsi:type='xs:string'>Line 6 : uwlContext: com.sap.netweaver.bc.uwl.UWLContext@24ee5934</tns:List><tns:List xsi:type='xs:string'>exception occured: Thu Apr 01 16:33:19 BST 2010
    (Default) Logged in users context or session doesn't exist null</tns:List></rpl:Response></rpl:getUwlCountsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

    I tried also using the user passed in http request to the service, still get the same error.

    Please let me know if you got any resolution to this.

    Thanks

    Sudip

    Add a comment
    10|10000 characters needed characters exceeded

    • Thanks Martin,

      Funny side, I did see the locale returning null and tried setting it up in the UME. Tried different values and it didn't help. Printed the logs and had the same error returned each time.

      I'll however try this code.

      Lets see what happens.

      Thanks again for taking time and sharing your findings.

      Regards,

      Nitin

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.