Hello,
I'm working with UWL.
I am getting the following exception:
com.sap.netweaver.bc.uwl.UWLException:Thu Sep 14 10:17:09 CEST 2006(Default) Logged in users context or session doesn't exist.
I'm using EJB to attain data through IUWLService. Here is my code:
// obtain user
String callerPrincipalName = myContext.getCallerPrincipal().getName();
IUserFactory userFactory = UMFactory.getUserFactory();
IUser sapUser = userFactory.getUserByUniqueName( callerPrincipalName );
// obtain IUWLService, it works fine
IUWLService uwlService = (IUWLService) WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY);
UWLContext uwlContext = new UWLContext();
uwlContext.setUser(sapUser);
IUWLSession uwlSession = uwlService1.beginSession(uwlContext, 6000);
uwlContext.setSession(uwlSession);
uwlContext.setAllowBackEndConnections(true);
IUWLViewManager viewMngr = uwlService.getViewManager(uwlContext);
IUWLItemManager itemMngr = uwlService.getItemManager(uwlContext);
UWLView currentView = viewMngr.getViewForItemType(arg1, uwlContext);
// the following throws exception
QueryResult res = itemMngr.getItemsForItemType(uwlContext,arg1,null, null);
I've implemented this functionality using HttpServlet and i have not got any problems, but I've obtained user another way :
IAuthentication authentication = UMFactory.getAuthenticator();
IUser user = authentication.forceLoggedInUser(request, response);
In this way "QueryResult res = itemMngr.getItemsForItemType(uwlContext,arg1,null, null);" works fine.
Can anybody help me to solve this problem in EJB SessionBean?
Help in this regard is highly rewarded.