Spring Exception: The matching wildcard is strict, but no declaration can be found for element 'int-jpa:inbound-channel-adapter' - spring

I have the following spring-config xml file, which is generating the exception shown in the title of my post:
<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-jpa="http://www.springframework.org/schema/integration/jpa"
xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
xmlns:file="http://www.springframework.org/schema/integration/file"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/jpa
http://www.springframework.org/schema/integration/jpa/spring-integration-jpa.xsd
http://www.springframework.org/schema/integration/sftp
http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/integration/file
http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
http://www.springframework.org/schema/integration/xml
http://www.springframework.org/schema/integration/xml/spring-
integration-xml.xsd">
<int-jpa:inbound-channel-adapter
id="resultsProcessor"
channel="responseChannel"
auto-startup="true"
named-query="OpenRecords"
expect-single-result="true"
delete-after-poll="false"
entity-class="foo.Request">
<int:poller
id="responsePoller"
fixed-rate="5000"
max-messages-per-poll="10">
</int:poller>
</int-jpa:inbound-channel-adapter>
</beans>
The code I provide above has other elements removed from it, and some of the fields renamed to simplify the example. That is why you see some schema and namespace information at the top that does not apply to the example as presented.
The error actually takes place at the line corresponding to entity-class="foo.Request">, but I don't know that there is anything inherently wrong with that line, but simply that is where the termination ">" is. In other words, if I removed that line and put the ">" after delete-after-poll="false", the error would be there instead.
Am I perhaps missing a namespace and/or schema location definition? Alternatively, could it be a missing deployment dependency? Grateful for any ideas. Thank you.

Please add org.springframework.integration:spring-integration-jpa to your dependencies. You simply missing a jar in your classpath

Related

The matching wildcard is strict, but no declaration can be found for element 'batch:job' - just on a production server

I know this has been asked many times before but my production tomcat server errors on the batch:job tag. The app runs fine in IntelliJ + the tomcat plugin. The proxy won't allow the server to download any of the schemas but that doesn't seem to affect the bean or tx tags
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
<batch:job id="createCsvForJob">
<batch:step id="createCsvFile">
<batch:tasklet ref="createCsvForTasklet" />
</batch:step>
</batch:job>
I can download the schemaLocation urls so I don't think there are any weird characters or typos in them. Is there anything obvious I'm missing?
<?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:task="http://www.springframework.org/schema/task"
xmlns:tx="http://www.springframework.org/schema/tx"
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/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
">
My fix was to include the version number in the schemaLocation, ie
http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
So I now have
<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:task="http://www.springframework.org/schema/task"
xmlns:tx="http://www.springframework.org/schema/tx"
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-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
">
The reason was that because my server couldn't access the internet it needed to use the one that was included in the war file. To find the correct version number I command clicked the xmlns url in IntelliJ
xmlns:batch="http://www.springframework.org/schema/batch"
and just read the verison number.
Hope this helps someone else.

What is the cause to get Multiple annotations found in dispatcher servlet

I am working on spring 4.0. I have configured a dispatcher servlet where i have used some xml namespace. its working fine but shows below error.
Error details:
Multiple annotations found at this line:
- Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-4.0.xsd). For more information, right click on the message in the Problems View and select "Show
Details..."
- Referenced file contains errors (http://www.springframework.org/schema/context/spring-context-4.0.xsd). For more information, right click on the message in the Problems View and select "Show
Details..."
My Code:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
What is the cause of this error and how can I solve this?
I have resolved it by removing
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd from schema location.
my corrected code is:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">

Why does DTD error "White spaces are required between publicId and systemI" occur with Spring XSD

In my application context file Eclipse shows the error:
Referenced file contains errors (http://www.springframework.org/schema/integration). applicationContext.xml line 1 XML Problem
looking at the error detail in Eclipse I see:
White spaces are required between publicId and systemId
According to other people with this problem it's related to the DOCTYPE which apparently must have a SYSTEM identifier.
Why in 2014 when DOCTYPE's are pretty much obsolete since we all use XSD instead of DTDs and there is no DOCTYPE in http://www.springframework.org/schema/integration (or should there be) does this error occur?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:mail="http://www.springframework.org/schema/integration/mail"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-3.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-3.0.xsd
http://www.springframework.org/schema/context/spring-context.xsd">
Thanks
You have to move spring-context.xsd to its id:
<beans
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-3.0.xsd">

Spring-ws error on interceptor

I have an issued on my spring-ws-servlet.xml
when i start the ws i receive this error:
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'ws:interceptors'.
this is the line with error (spring-ws-servlet.xml):
<ws:interceptors><bean class="com.nin.fi.sw.schema.WSLoggingInterceptor"/></ws:interceptors>
And this is the header of these file:
<?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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:ws="http://www.springframework.org/schema/web-services"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-1.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
Libs:
I tried to attach differentes .xsd but withoud any success.
I dont know what im doing wrong.
You haven't added a schema location for web-services
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd

Spring-Data-JPA causes XSD validation error in Spring STS using XML configuration

Eclipse/STS reports errors using Spring 3.2.1 with Spring-data-jpa together.
I have some XML configuration files with the following header:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
I am using Spring 3.2.1 with Spring-Data-JPA 1.3.0 and Eclipse/STS is reporting this:
Referenced file contains errors
(http://www.springframework.org/schema/data/jpa)
This happens in every single XML configuration file that contains the data-jpa schema.
When I remove JPA from the XML config, everything is just fine.
Is my configuration wrong or what happens here?
Thanks!
Paul
Today there is not a http://www.springframework.org/schema/data/jpa/spring-jpa.xml file so you have to use http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd, but this file use http://www.springframework.org/schema/data/repository/spring-repository.xsd that does not exist too so you have to add the location of this schema in your context file:
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
http://www.springframework.org/schema/data/repository
http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.2.xsd"

Resources