Problem with pax exam test using repository

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with pax exam test using repository

Christian Schneider
I am trying the test some code that works on the sling repository.

I have problems getting the pax exam test working. I get the exception
below:

java.lang.AbstractMethodError:
org.apache.jackrabbit.core.XASessionImpl.getItemOrNull(Ljava/lang/String;)Ljavax/jcr/Item;
at org.apache.sling.jcr.resource.internal.helper.jcr.JcrItemResourceFactory.getItemOrNull(JcrItemResourceFactory.java:184)

Full exception:
https://gist.github.com/cschneider/d01d087244dc0650b3751e99a70b6a72

This might be some incompatibility between the jackrabbit core bundle and
the sling bundles.
I use:
oak 1.7.6
jackrabbit 2.15.4

mavenBundle("org.apache.sling", "org.apache.sling.jcr.resource", "2.9.2"),

mavenBundle("org.apache.sling", "org.apache.sling.resourceresolver",
"1.5.22"),

mavenBundle("org.apache.sling", "org.apache.sling.serviceusermapper",
"1.2.4"),

Any idea what is wrong with my setup and which versions I should combine to
avoid this issue?

Christian

--
--
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with pax exam test using repository

Oliver Lietz
On Tuesday 16 January 2018 18:22:41 Christian Schneider wrote:
> I am trying the test some code that works on the sling repository.

Hi Christian,

> I have problems getting the pax exam test working. I get the exception
> below:
>
> java.lang.AbstractMethodError:
> org.apache.jackrabbit.core.XASessionImpl.getItemOrNull(Ljava/lang/String;)Lj
> avax/jcr/Item; at
> org.apache.sling.jcr.resource.internal.helper.jcr.JcrItemResourceFactory.ge
> tItemOrNull(JcrItemResourceFactory.java:184)
>
> Full exception:
> https://gist.github.com/cschneider/d01d087244dc0650b3751e99a70b6a72
>
> This might be some incompatibility between the jackrabbit core bundle and
> the sling bundles.
> I use:
> oak 1.7.6
> jackrabbit 2.15.4

don't use odd (minor) versions (even not in tests). Those are cut from
unstable branches.

> mavenBundle("org.apache.sling", "org.apache.sling.jcr.resource", "2.9.2"),
>
> mavenBundle("org.apache.sling", "org.apache.sling.resourceresolver",
> "1.5.22"),
>
> mavenBundle("org.apache.sling", "org.apache.sling.serviceusermapper",
> "1.2.4"),
>
> Any idea what is wrong with my setup and which versions I should combine to
> avoid this issue?

You can try with Sling's Pax Exam support (Sling Testing PaxExam):
http://sling.apache.org/documentation/development/testing-paxexam.html

At least look at Sling's Karaf Features[1] or Testing PaxExam's
VersionResolver[2] to see which versions play together (backed by lots of
ITs).

Regards,
O.

[1] https://github.com/apache/sling-org-apache-sling-karaf-features/blob/master/src/main/feature/feature.xml

[2] https://github.com/apache/sling-org-apache-sling-testing-paxexam/blob/master/src/main/java/org/apache/sling/testing/paxexam/SlingVersionResolver.java

> Christian

Reply | Threaded
Open this post in threaded view
|

Re: Problem with pax exam test using repository

Christian Schneider
I found the solution to my problem with AbstractMethodError:
org.apache.jackrabbit.core.XASessionImpl.getItemOrNull

The problem was that I loaded org.apache.sling.jcr.jackrabbit.server whioch
bundles parts of jackrabbit core .. so this way XASessionImpl was used
instead of the correct org.apache.jackrabbit.oak.jcr.session.SessionImpl
Not sure why I had that bundle at all but removing it solved the issue.

Christian

2018-01-16 20:58 GMT+01:00 Oliver Lietz <[hidden email]>:

> On Tuesday 16 January 2018 18:22:41 Christian Schneider wrote:
> > I am trying the test some code that works on the sling repository.
>
> Hi Christian,
>
> > I have problems getting the pax exam test working. I get the exception
> > below:
> >
> > java.lang.AbstractMethodError:
> > org.apache.jackrabbit.core.XASessionImpl.getItemOrNull(
> Ljava/lang/String;)Lj
> > avax/jcr/Item; at
> > org.apache.sling.jcr.resource.internal.helper.jcr.
> JcrItemResourceFactory.ge
> > tItemOrNull(JcrItemResourceFactory.java:184)
> >
> > Full exception:
> > https://gist.github.com/cschneider/d01d087244dc0650b3751e99a70b6a72
> >
> > This might be some incompatibility between the jackrabbit core bundle and
> > the sling bundles.
> > I use:
> > oak 1.7.6
> > jackrabbit 2.15.4
>
> don't use odd (minor) versions (even not in tests). Those are cut from
> unstable branches.
>
> > mavenBundle("org.apache.sling", "org.apache.sling.jcr.resource",
> "2.9.2"),
> >
> > mavenBundle("org.apache.sling", "org.apache.sling.resourceresolver",
> > "1.5.22"),
> >
> > mavenBundle("org.apache.sling", "org.apache.sling.serviceusermapper",
> > "1.2.4"),
> >
> > Any idea what is wrong with my setup and which versions I should combine
> to
> > avoid this issue?
>
> You can try with Sling's Pax Exam support (Sling Testing PaxExam):
> http://sling.apache.org/documentation/development/testing-paxexam.html
>
> At least look at Sling's Karaf Features[1] or Testing PaxExam's
> VersionResolver[2] to see which versions play together (backed by lots of
> ITs).
>
> Regards,
> O.
>
> [1] https://github.com/apache/sling-org-apache-sling-karaf-
> features/blob/master/src/main/feature/feature.xml
>
> [2] https://github.com/apache/sling-org-apache-sling-
> testing-paxexam/blob/master/src/main/java/org/apache/
> sling/testing/paxexam/SlingVersionResolver.java
>
> > Christian
>
>


--
--
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with pax exam test using repository

Oliver Lietz
On Wednesday 17 January 2018 11:47:17 Christian Schneider wrote:
> I found the solution to my problem with AbstractMethodError:
> org.apache.jackrabbit.core.XASessionImpl.getItemOrNull
>
> The problem was that I loaded org.apache.sling.jcr.jackrabbit.server whioch
> bundles parts of jackrabbit core .. so this way XASessionImpl was used
> instead of the correct org.apache.jackrabbit.oak.jcr.session.SessionImpl
> Not sure why I had that bundle at all but removing it solved the issue.

Therefore we have (Pax Exam) Options:

slingQuickstartOakTar(string, int)[1]

You will have every bundle and configuration in situ for running Sling with
Oak Tar repository.

Regards,
O.

[1] https://github.com/apache/sling-org-apache-sling-testing-paxexam/blob/master/src/main/java/org/apache/sling/testing/paxexam/SlingOptions.java#L940

> Christian
>
[...]