(This is XPages app for a web browser) I created a view panel for a view from another database. The view showed up empty, even though I can clearly see about 15 documents in it using the Notes client. Here is the view source...
<xp:viewPanel rows="30" id="viewPanel3">
<xp:this.facets>
<xp:pager partialRefresh="true"
layout="Previous Group Next" xp:key="headerPager" id="pager2">
</xp:pager>
</xp:this.facets>
<xp:this.data>
<xp:dominoView var="view3"
databaseName="test\Customer\part.nsf"
viewName="LkpMscParts-55EQUIPMENT">
</xp:dominoView>
</xp:this.data>
I verified the ACL, refreshed the view index, even ran fixup on the database. The page still won't show the documents. (No readers fields, btw)
So, then I added a computed field to show me what's going on.
var filepath = database.getFilePath();
var partfile = filepath.toLowerCase().replace("ereq_main","part");
var partdb = session.getDatabase(database.getServer(),partfile,false);
print("partdb views total = "+partdb.getViews().length)
for(x=0;x<partdb.getViews.length;x++){
print("v name = "+partdb.getViews[x].getName());
}
print("partdb server = "+partdb.getServer());
print("partdb title = "+partdb.getTitle())
var vname = "LkpMscParts-55EQUIPMENT";
sessionScope.PartViewName = vname;
var pview = partdb.getView(vname);
if(pview==null){
sessionScope.PartViewError = "Nothing for LkpMscParts-55EQUIPMENT.";
print("pview is null")
return null;
}
var vecol = pview.getAllEntries();
print("partdb = "+partdb.getFilePath());
print("pview = "+pview.getName());
print("pview lines = "+pview.getRowLines());
print("vecol count = "+vecol.getCount())
return vname;
I get this on the console:
11/18/2017 08:10:48 PM HTTP JVM: partdb views total = 0
11/18/2017 08:10:48 PM HTTP JVM: partdb server = CN=domsvr3/O=abc
11/18/2017 08:10:48 PM HTTP JVM: partdb title = Inventory Parts
11/18/2017 08:10:48 PM HTTP JVM: partdb = test\Customer\part.nsf
11/18/2017 08:10:48 PM HTTP JVM: pview =
and then a crash
Script interpreter error, line=27, col=46: [TypeError] Exception occurred calling method NotesView.getRowLines() Notes error: Invalid or nonexistent document (LkpMscParts-55EQUIPMENT)
Notes error: Invalid or nonexistent document (LkpMscParts-55EQUIPMENT)
Notice the length of the views array is 0 - what gives? There's probably 200 views in the db. The database server is correct, the title is correct and the path is correct. So, it appears like it can see the correct database. But, then the view name comes out blank. So, pview isn't null (cuz I checked for that) but yet it's empty. I don't get it. Such a simple thing is driving me nuts.
Just fyi, I've been working with xpages now for about 5 years, so I'm sure I'm missing something simple, but I just can't 'see the forest for the trees'. Can someone please point me in the right direction?
Do you get that database elsewhere in code in the application? If so, are you calling .recycle()
on that Database object?
One of the things I learned early in moving to Java is that if you recycle a handle to a Database, getters that return primitive values (e.g. Strings) will still return the value. Presumably it gets cached. So getTitle()
and getFilePath()
will still return a value, but anything getting something more complex will not work. It's a number of years since I did that, but I think it does just return nothing.
On the rare occasion I still have to recycle (I use ODA for virtually all projects), I only recycle in loops. The maximum handles per session is so high there's no risk of "PANIC: Lookup handles out of range" for the number of Domino objects outside of loops.