Expand my Community achievements bar.

SOLVED

ResourceResolver Session and java.lang.LinkageError: javax/jcr/Session Help

Avatar

Level 8

Hey all,

I'm having some issues retrieving a session from the resourceResolver and also using the repository to log in to a session.

With the resourceResolver, i'm passing the ResourceResolver object from a JSP file over to a class file and then performing an adaptTo(Session.class).  Once this is done, the session is returned as NULL and i'm obviously unable to utilize it.  Any ideas as to why?

Since that issue came up, i switched over to using a @Component and @Service annotations and accessing the session via the SlingRepository.  Taking this approach, i get an error "java.lang.LinkageError: javax/jcr/Session Help" when i try to call a method on the session object.  Any insight to this would also be helpful.

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Employee

It looks like there's something wrong with your bundle. Can you verify that you are importing the javax.jcr package and not embedding it?

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

It looks like there's something wrong with your bundle. Can you verify that you are importing the javax.jcr package and not embedding it?

Avatar

Level 8

I had it in my pom file, added <scope>provided</scope> to the dependency and all is now good.  Thank you!