You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2016/09/29 15:34:20 UTC

[jira] [Resolved] (SLING-6069) Error: Multiple matches found for unary reference 'factory'

     [ https://issues.apache.org/jira/browse/SLING-6069?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert resolved SLING-6069.
-----------------------------------
    Resolution: Duplicate

duplicate of SLING-6077

> Error: Multiple matches found for unary reference 'factory' 
> ------------------------------------------------------------
>
>                 Key: SLING-6069
>                 URL: https://issues.apache.org/jira/browse/SLING-6069
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing Sling Mock 2.1.0, Testing Sling Mock Oak 2.0.2
>            Reporter: Christoph Thodte
>
> When starting with a simple test using a the special rs type ResourceResolverType.JCR_OAK
> {code:java}
> public class FormularServiceTest {
>     @Rule
>     public final SlingContext slingContext = new SlingContext(ResourceResolverType.JCR_OAK);
>     @Test
>     public void testFormService() {
>         FormularService formularService = slingContext.registerInjectActivateService(new FormularService());
>         FormModel form = formularService.findFormByFormId("331");
>         Assert.assertNotNull(form);
>     }
> ...
> {code}
> I get the error 
> org.apache.sling.testing.mock.osgi.ReferenceViolationException: Multiple matches found for unary reference 'factory' for class de.htsolutions.formver.service.FormularService
> 	at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.injectServiceReference(OsgiServiceUtil.java:416)
> 	at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.injectServices(OsgiServiceUtil.java:389)
> 	at org.apache.sling.testing.mock.osgi.MockOsgi.injectServices(MockOsgi.java:146)
> I debug the code and I find that the reason is that there are two resourceresolver in context not only one.
> What's the problem here? Is it a bug? Problem in setup?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)