cancel
Showing results for 
Search instead for 
Did you mean: 

UWLException Logged in users context or session doesn't exist

Former Member
0 Kudos

Dear all,

I would like to read the UWL task list from java webdynpro.

I have followed this blog:

[Flashy UWL |https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5450] [original link is broken] [original link is broken] [original link is broken];

The uwl is working in the portal, there are tasks for my user.

here is my code,

IUWLService uwlService = (IUWLService) WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY);

UWLContext uwlContext = new UWLContext();

IUserFactory userfactory = UMFactory.getUserFactory();

try {

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

uwlContext.setAllowBackEndConnections(true);

uwlContext.setUser(loggedinuser);

uwlContext.setLocale(loggedinuser.getLocale());

IUWLSession mySession = uwlService.beginSession(uwlContext, 50);

// IUWLSession mySession = uwlService.getUwlSessionForWebDynproClient(uwlContext);

uwlContext.setSession(mySession);

IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);

QueryResult result = itemManager.getItems(uwlContext, null, null);

and at the last line I receive the the exception:

com.sap.netweaver.bc.uwl.UWLException: Logged in users context or session doesn't exist

mySession.isValid() gives true, logged in user is ok, even the locale attribute.

I have added tckmcbc.uwl~api into project properties library reference.

I am useing sap.authentication true wd app property to log in, but I tried portal iview as well, same result.

Please suggest, what is missing? Maybe one application is not running? Something needs to be added to the wd references?

Thank you in advance,

Tamas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear all,

my problem has been solved, I can reach the UWL from WD Java.

I just had to use this

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

instead of this

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

Does anybody know what is the difference?

Regards,

Tamas