Editing an xpage universal ID - xpages

I have an xpage that has a view (Orders by Order Date).
I have an xpage that the user chooses the customer ordering the product on one section of the xpage. Another section of the xpage they order the products. As soon as they add the first product, the customer info is saved (data source: form "fOrderForm"/document1 on xpage). Each product ordered is stored as separate Notes documents (fOrderLineItem/docLineItem) with the order ID as lookup on the data grid on the combined xpage.
On the view xpage, when I click on one of the orders, the system is giving me an invalid Universal ID error even though the ID is in the URL. Do I have to manually load each field on the document1 data source in the after/before page load event and set the scope variable that the data grid uses? If I remove the xpage associated with the Notes form, it opens correctly but that isn't going to work.
A URL from the view is
http://localhost/SalesOrders.nsf/xOrderForm.xsp?documentId=CADCB3E38FF310EA85257F8100493670&action=editDocument
Error log:
com.ibm.xsp.FacesExceptionEx: Could not open the document
com.ibm.xsp.model.domino.DominoDocumentData.doOpenDocument(DominoDocumentData.java:509)
com.ibm.xsp.model.AbstractDocumentDataSource.openDocument(AbstractDocumentDataSource.java:148)
com.ibm.xsp.model.AbstractDocumentDataSource.load(AbstractDocumentDataSource.java:100)
com.ibm.xsp.model.AbstractDataSource.getDataContainer(AbstractDataSource.java:474)
com.ibm.xsp.model.domino.DominoDocumentData.getDataObject(DominoDocumentData.java:145)
com.ibm.xsp.model.AbstractDataSource.pushData(AbstractDataSource.java:576)
com.ibm.xsp.util.DataPublisher.publishControlData(DataPublisher.java:181)
com.ibm.xsp.component.UIViewRootEx.publishControlData(UIViewRootEx.java:1288)
com.ibm.xsp.component.UIViewRootEx.initBeforeContents(UIViewRootEx.java:1615)
com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:333)
com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256)
com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(AbstractCompiledPage.java:167)
com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(ViewHandlerExImpl.java:521)
com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(ViewHandlerExImpl.java:567)
com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(ViewHandlerExImpl.java:142)
com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:90)
com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:251)
com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853)
com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:350)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:306)
com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
NotesException: Invalid universal id
lotus.domino.local.Database.NgetDocumentByUNID(Native Method)
lotus.domino.local.Database.getDocumentByUNID(Unknown Source)
com.ibm.xsp.model.domino.DominoUtils.getDocumentById(DominoUtils.java:456)
com.ibm.xsp.model.domino.DominoUtils.getDocumentById(DominoUtils.java:477)
com.ibm.xsp.model.domino.DominoDocumentData.doOpenDocument(DominoDocumentData.java:489)
com.ibm.xsp.model.AbstractDocumentDataSource.openDocument(AbstractDocumentDataSource.java:148)
com.ibm.xsp.model.AbstractDocumentDataSource.load(AbstractDocumentDataSource.java:100)
com.ibm.xsp.model.AbstractDataSource.getDataContainer(AbstractDataSource.java:474)
com.ibm.xsp.model.domino.DominoDocumentData.getDataObject(DominoDocumentData.java:145)
com.ibm.xsp.model.AbstractDataSource.pushData(AbstractDataSource.java:576)
com.ibm.xsp.util.DataPublisher.publishControlData(DataPublisher.java:181)
com.ibm.xsp.component.UIViewRootEx.publishControlData(UIViewRootEx.java:1288)
com.ibm.xsp.component.UIViewRootEx.initBeforeContents(UIViewRootEx.java:1615)
com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:333)
com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256)
com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(AbstractCompiledPage.java:167)
com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(ViewHandlerExImpl.java:521)
com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(ViewHandlerExImpl.java:567)
com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(ViewHandlerExImpl.java:142)
com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:90)
com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:251)
com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853)
com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:350)
com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:306)
com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)

I suspect it is a question of sequence. A new document in memory gets a temporary UNID only. Once it is saved a UNID based on the time of the first save is created.
It looks like you capture the UNID to put it somewhere before you save the document for the first time.
You need to change the sequence of events to update the UNID wherever you store it.

Related

Domino Document cannot be opened twice on public access xpage

I have an Xpage with access set to public for clients to fill in a form. When I send the client the link to the page and they open it for the first time. Everything runs smoothly. However, if they close the browser and click on the link again they receive this error:
{Unexpected runtime error
The runtime has encountered an unexpected error.
Error source
Page Name:/xpClientForm.xsp
Exception
Could not open the document
Invalid universal id}
I am using a switch facet to cycle between forms depending on the client type.
The domino document id is being stored in a sessionScope beforepageload and the document dynamically computes it based on that sessionScope variable.
Here is the code:
SessionScope assignment on beforepageload
var cData = getClientData(id);
sessionScope.docId = cData.docID;
Document datasource
<xp:panel style="height:100px" id="pnlDocData">
<xp:this.data>
<xp:dominoDocument var="document1"
formName="frmA" action="editDocument"
documentId="#{javascript:sessionScope.docID;}" scope="request">
</xp:this.data>
</xp:panel>
However when i execute this custom control on a page that does not have public access. It runs fine with no issues irrespective of how many times i open the link.
Any help will be greatly appreciated.
You need to set ignoreRequestParams="true" on the dominoDocument datasource. Otherwise it's using the document ID in the URL or trying to create a new document, which the user probably doesn't have access to do.
Computing the document ID is the less common scenario, which is using the URL for document location is the default.

Xpages Extension library name picker shows SyntaxError: expected expression, got '< when clicked

ok so I got this issue that's been a big question mark to me, I'm currently using Notes version 9.0.1 both on server and designer. I created a custom control that has a field and a name picker next to it. I created a main xsp and put the custom control there. I did not change any setting in namepicker other than the provider which I set to dominoNAB... I leave the other settings as default. I ran the main xsp and clicked on the name picker but it throws a dialog box that says SyntaxError: expected expression, got '< , the namepicker is blank and there's nothing in the notes log. Does someone experienced this? Thank you in advance for the help.
Update: This is the exact code of my namepicker
<xp:inputText
value="#{accountDocument.AcctMngr}" id="acctMngr1"
style="width:267.0px" showReadonlyAsDisabled="true">
</xp:inputText>
<xe:namePicker id="namePicker1"
for="acctMngr1" dialogTitle="Account Manager">
<xe:this.dataProvider>
<xe:dominoNABNamePicker
addressBookSel="all-public" nameList="peopleByLastName">
</xe:dominoNABNamePicker>
</xe:this.dataProvider>
</xe:namePicker></xp:td>
This is the error that shows when I click the namepicker's icon.
I used firebug to check the error and this is what I saw.
Is the user logged in to the application, and do they have access to the NAB that is being accessed? I can reproduce the dialog you are seeing when trying to use the name picker as an Anonymous user. But everything works fine when logged in as a user with sufficient NAB access.
Looking at the response from the server in Firebug, as Anonymous user it responds with the login page for the NAB. And this response can't be handled somewhere in the process of rendering the name picker. It's not a very helpful error though, it should really tell you that access is denied or something like that.
As an addendum to that, you may be better off being more explicit about what NAB to use in your picker. Instead of the generic "all-public", use something like this for example:
<xe:namePicker id="namePicker1" for="acctMngr1">
<xe:this.dataProvider>
<xe:dominoNABNamePicker nameList="peopleByLastName"
addressBookDb="names.nsf" addressBookSel="db-name">
</xe:dominoNABNamePicker>
</xe:this.dataProvider>
</xe:namePicker>

Random JSF error: no saved view state could be found

I have a very strange error: No saved view state could be found for the view identifier: /mypage.xhtml
The problem is that it appears randomly, to just ~10% of the users/executions.
Application server: Apache Tomee 1.5.2 stable / 1.6.0-2013.09.20 dev (It happens on both). I use the MyFaces distribution that comes with each of them, so 2.1.10 / 2.1.12, so nothing new added.
Part of web.xml:
<context-param>
<param-name>org.apache.myfaces.USE_ENCRYPTION</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
So, no state view exception shouldn't happen, because state is on client. It was set on server before, but I thought maybe client will fix it, but nothing. There was actually no difference in the occurrence of that error.
Execution flow:
1. Client opens xhtml page (JSF).
2. Client clicks on an command button to do various things, button connected to a public void method of a JSF #ViewScoped ManagedBean.
3. Yes, the method is void because I don't need to return a String to redirect to another page. I need to redirect to /page/id (example: /market/24, /profile/43), therefore methods that return a String as navigation destinations are useless, because I use: FacesContext.getCurrentInstance().getExternalContext().redirect(path);
4. In ~90% of the cases, everything works perfectly and users are redirected to each specific page. In the rest of ~10 (randomly), they get No saved view state could be found for the view identifier: /pagename.xhtml
I would really appreciate some help here, because I have no idea how to get it fixed.
Thanks a lot in advance.
PS. I use PrimeFaces and I also have a couple of my own filters in web.xml, but that shouldn't be a problem, I hope so.
Stack trace for one of the pages:
25-Sep-2013 07:39:26.380 SEVERE [http-bio-80-exec-15] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Faces Servlet] in context with path [] threw exception [/dashboard/edit-profile.xhtmlNo saved view state could be found for the view identifier: /dashboard/edit-profile.xhtml] with root cause
javax.faces.application.ViewExpiredException: /dashboard/edit-profile.xhtmlNo saved view state could be found for the view identifier: /dashboard/edit-profile.xhtml
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:199)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.pingushare.boundary.filter.ActivateAccountFilter.doFilter(ActivateAccountFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.pingushare.boundary.filter.SecurityFilter.doFilter(SecurityFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.pingushare.boundary.filter.ForceFreshPageAndWWWFilter.doFilter(ForceFreshPageAndWWWFilter.java:49)
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.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
This issue is well understood and it happens because if the server is restarted or the application is redeployed, a new encryption key is generated by default. The solution is generate your own key and set it up in your web.xml file. In that way, MyFaces will use the same key at all times. See http://wiki.apache.org/myfaces/Secure_Your_Application
The description claims that encryption is disabled, and I have checked the code and it is ok, it works as expected (the encryption is effectively disabled). If the encryption is not the problem, my opinion is there is an error in your application logic. Don't call redirect in that way, use the standard form using mypage.xhtml?faces-redirect=true . The problem could be caused by a session expiration (note only view scope beans goes to the client in 2.0/2.1, but session scope beans are expired).
After long discussions on MyFaces and Tomee forums/mailing lists, this is how I managed to eliminate this problem: I switched the JSF implementation in this project to Majorra 2.1.26. The error didn't appear anymore until now.
As this bug didn't make any sense (after checking source of both my project and MyFaces) and couldn't be reproduced, we couldn't actually find a fix for it, but at least it doesn't happen in Majorra, so this could be helpful if someone else gets this error.
Mention: this is not the basic "no saved view state could be found" that many JSF developers get. That's something else hiding somewhere.

NullPointerException from RestoreViewPhase.notifyAfter

I'm getting the following error whenever I try to view JSF pages that contain forms.
java.lang.NullPointerException
com.sun.faces.lifecycle.RestoreViewPhase.notifyAfter(RestoreViewPhase.java:288)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
What does this mean?
This problem started when I tried to use validators on my form fields. So I removed all the validators, but still the problem is not going away.
Thanks for the help.
Could be this logged issue: http://java.net/jira/browse/JAVASERVERFACES-1764
If that is the case then it should be fixed in JSF version 2.1.

After rich:extendedDataTable sortby, other actions are not getting executed

I have several tabs and one of the tabs uses rich:extendedDataTable. If sortBy is clicked in the page where table is used and if I navigate to another page, it looks for the bean of the old page and throws an error saying that sortyBy of the column is undefined.
E.g. If I use sortBy on userId in tab1 (where the column must have sortBy="#{data.userId}") and then I click on tab2, it looks for the data.userId and throws an error. I am using Richfaces version 3.2.2SR1.
Can anyone help me on this?
Here is the complete trace:
javax.el.PropertyNotFoundException: /amendapplication/historyDetails.xhtml #33,174 sortBy="#{data.statusChangeTime}": Property 'statusChangeTime' not found on type uk.gov.wales.rpd.domain.applicationmanagement.ApplicationAttributeEntity
com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
org.richfaces.model.impl.expressive.ValueBindingExpression.evaluate(ValueBindingExpression.java:59)
org.richfaces.model.impl.expressive.ObjectWrapperFactory.wrapObject(ObjectWrapperFactory.java:189)
org.richfaces.model.ModifiableModel$RowKeyWrapperFactory.wrapObject(ModifiableModel.java:57)
org.richfaces.model.impl.expressive.ObjectWrapperFactory$2.convert(ObjectWrapperFactory.java:177)
org.richfaces.model.impl.expressive.ObjectWrapperFactory.convertList(ObjectWrapperFactory.java:138)
org.richfaces.model.impl.expressive.ObjectWrapperFactory.wrapList(ObjectWrapperFactory.java:175)
org.richfaces.model.ModifiableModel.sort(ModifiableModel.java:235)
org.richfaces.model.ModifiableModel.modify(ModifiableModel.java:206)
org.richfaces.component.UIExtendedDataTable.createDataModel(UIExtendedDataTable.java:310)
org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:339)
org.ajax4jsf.component.UIDataAdaptor.iterate(UIDataAdaptor.java:1034)
org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1158)
org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1168)
javax.faces.component.UIForm.processDecodes(UIForm.java:209)
org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:392)
org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Look like as if you've bound multiple different datatables to the same UIData property, or that you're reusing the same bean property to supply different datamodels depending on the displayed tab/table.
You can and should not reuse the one and the same bean property for different components and/or different value purposes. Verify if anything is right in your beans.

Resources