Unable to retrieve session in cms module via UserSession

Hi All,

I am unable to retrieve sesssion using “Session session = UserSession.get().getJcrSession();” as explained in [1]. It gave me “There is no application attached to current thread pool-4-thread-1 [INFO] [talledLocalContainer] at org.apache.wicket.Application.get(Application.java:238) [INFO] [talledLocalContainer] at org.apache.wicket.Session.get(Session.java:171) [INFO] [talledLocalContainer] at org.hippoecm.frontend.session.UserSession.get(UserSession.java:48)”

Also I can’t use “Session session = repository.login(“admin”, “admin”.toCharArray());”, as password may get updated.

Please let me know how can i get repository session in CMS module.

[1] https://documentation.bloomreach.com/library/concepts/content-repository/jcr-interface.html


Whatever class you are running is not in a CMS context, otherwise it would have a session in the thread. As is explained on the page you referenced, you need to get a reference to the repository and login.

HippoRepository repository = HippoRepositoryFactory.getHippoRepository("vm://")

Then you can login to get a session. This does require you to be running in the same jvm as the repository.

What are you trying to achieve? I would generally expect you to have access to a session if you are running in the cms.