OpenNTF / org.openntf.domino

Open replacement for lotus.domino package in HCL Domino
Apache License 2.0
65 stars 34 forks source link

Session.getDatabase() not working in Hybrid Xpages App #158

Closed vshashikumar closed 4 years ago

vshashikumar commented 7 years ago

I am working on xpages hybrid application, where the frontend(ui) and backend(database) are on two different on-premise servers of same domain.

Issue is, I am not able to access database using org.openntf.domino.Session in the frontend using the below code. It returns null. Session session = Factory.getSession(SessionType.FULL_ACCESS); Database database = session.getDatabase("servername", "dbpath");

Where as I am able to access the database using the lotus.domino.session as shown below. lotus.domino.Session session = ContextInfo.getUserSession(); lotus.domino.Database database = session.getDatabase("servername", "dbpath");

Is there a way to make ODA session work in this scenario.

Thanks

jesse-gallagher commented 7 years ago

Does it behave any differently when you do Factory.getSession(SessionType.CURRENT)? In theory, that session would be the equivalent to the one you're getting from ContextInfo. From there, that'd help us narrow down where the trouble is.

Additionally, it may help to enable bubbled exceptions in the session, which you could do with DominoUtils.setBubbleExceptions(true), I think. Doing that before the getDatabase call may highlight the specific issue.

vshashikumar commented 7 years ago

getDatabase('servername', 'dppath') method returns null even with session got from Factory.getSession(SessionType.CURRENT). Setting DominoUtils.setBubbleExceptions(true) did not help as it is not throwing any exception.

paulswithers commented 7 years ago

Do other session-related methods run successfully, e.g. getEffectiveUserName()? Do they return what you expect? If so, it's a problem with IP address.

I don't have much experience of Bluemix, but when developing at a workshop in May I had to use IP address to connect, so was using currSess.getDatabase(XX.XX.XX.XX!!bluemix/dev/tododata_1.nsf) - getDatabase accepts an ApiPath as well as server/filepath.

xpagedeveloper commented 7 years ago

Have you tried adding the dao bean or using code from it. I've used this with java and it have worked with an ordinary session. Haven't tried with openntf domino api. https://openntf.org/XSnippets.nsf/snippet.xsp?id=daobean-for-xsp-on-bluemix

vshashikumar commented 7 years ago

Thank you all for the responses. Actually I was using ip address in the place of servername, that is how i had to access database on Bluemix runtime, hence i used the same approach on on-permise servers too(which did not work). Now on on-premise servers, I am able to access database by replacing ip address with servername.