0

I'm getting this error in some legacy code base of ours:

GER: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 74; cvc-complex-type.2.4.c: Übereinstimmungsplatzhalter ist streng, aber es kann keine Deklaration für Element 'context:component-scan' gefunden werden.

EN (I found this translation online): The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'

Causing XML

Note: I've added a comment for clarity.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:batch="http://www.springframework.org/schema/batch"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:oxm="http://www.springframework.org/schema/oxm"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
        http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm.xsd">

<!-- This is line 14 --><context:component-scan base-package="de.continentale.mss.sinfonima" />
    <bean 
        class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
        <property name="locations">
            <array>
                <bean class="org.springframework.core.io.FileSystemResource">
                    <constructor-arg>
                        <value>./sinfonima-config/sinfonima-ve.db.prod.properties</value>
                    </constructor-arg>
                </bean>
                <bean class="org.springframework.core.io.ClassPathResource">
                    <constructor-arg>
                        <value>sinfonima-ve.datasource-test.properties</value>
                    </constructor-arg>
                </bean>
            </array>
        </property>
        <property name="ignoreResourceNotFound" value="true" />
    </bean>
    <import resource="classpath:/META-INF/sinfonima/sinfonima-commandline.xml" />
    <import resource="classpath:/META-INF/sinfonima/sinfonima-datasources.xml" />
    <import resource="classpath:/META-INF/sinfonima/sinfonima-batch.xml" />
</beans>

What I've tried

When validating the XML using Eclipse's validate mechanisms, validation completes with no errors or warnings.

While researching this error I found this SO-Question, but none of the answers fixed my error: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan

While Googling the error I found lots of copycat resources that clearly scraped one or another SO-question but unfortunately none of those helped me.

Environment

C:\eclipse\jdk8\bin>java.exe -version
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_265-b01)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.265-b01, mixed mode)
C:\eclipse>type .eclipseproduct
name=Eclipse Platform
id=org.eclipse.platform
version=4.15.0
MaxRumford
  • 175
  • 10
  • And how is this related to eclipse? How is the application build? Did you change something (upgraded libraries etc.)? – M. Deinum Feb 23 '21 at 12:54
  • Thanks for your comment. I added `eclipse` as a tag due to it flagging the `xsd` as ok when `SAX` did not. I though this might also be an issue with Eclipse validation. – MaxRumford Feb 23 '21 at 13:30

1 Answers1

0

The problem was an accidentally updated dependency. Thanks to Marten for pointing me in this direction. A company specific maven goal updated my dependencies without confirmation and jumped a major version while doing so.

When returning those dependencies to their previous versions the error does not occur anymore.

MaxRumford
  • 175
  • 10