Issue #4 resolved

Error in mockito.xsd

Anonymous created an issue

Using mockito:mock exactly as described in the Wiki gives me this error in Eclipse Indigo:

Multiple annotations found at this line: - schema_reference.4: Failed to read schema document 'http://www.mockito.org/spring/mockito.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mockito:mock'.

Putting mockito.xsd right next to my applicationContext and referencing to it resolves this issue but gives me the next in mockito.xsd for spring beans:

src-resolve: Cannot resolve the name 'beans:identifiedType' to a(n) 'type definition' component.

Changing <xsd:import namespace="http://www.springframework.org/schema/beans" /> to

<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />

resolves that issue.

Comments (9)

  1. kubek2k repo owner

    Wow - what a mistake - actually my eclipse wasn't complaining at all about that 1. You're right, but schema is not in the location at all, the idea to fix that is to use raw view of bitbucket tipfile: ex:

    <beans xmlns:mockito="http://www.mockito.org/spring/mockito"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.mockito.org/spring/mockito https://bitbucket.org/kubek2k/springockito/raw/tip/springockito/src/main/resources/spring/mockito.xsd">
    ...
    

    2. Again my eclipse didn't complain about the missing schema location for the beans, but I've updated schema as You suggested.

    thanks Kuba

  2. Anonymous

    HI Kuba, I'm still getting this error. Can you please re-publish the complete xml once more?

    Thanks Matt

  3. Sarah Zebian

    Hello, with this configuration "http://www.mockito.org/spring/mockito http://www.mockito.org/spring/mockito.xsd", springockito does not seem to be doing anything at all. The bean is not being replaced with the mock. I've activated the logs at DEBUG level for the package org.kubek2k.mockito.spring and I can't see anything being logged. I'm following the instructions on this page https://bitbucket.org/kubek2k/springockito/wiki/Home. (regular springockito, without annotations). Am I missing something? Thanks, Sarah

  4. lisak

    I have this problem too. But only on a teamCity server, so I suspect that it is using remote xsd instead the one packed in jar file and there is some problem with https protocol on bitbucket.

    Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from class path resource [META-INF/spring/test.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mockito:mock'. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)

  5. Log in to comment