unable to find the soln: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'

0

Using Sprint 4.2.2.RELEASE+Hibernate+Maven 3.1.0+Eclipse Kepler. I found multiple blogs related to this issues and tried all the different solutions, but that didn't help me. Tried with

  • Removing all the versions from all the xsd paths.
  • Adding the 4.2 version to all the xsds
  • Adding the 4.2, 3.0, 2.0 to spring-tx.xsd
  • Adding the spring-tx.xsd file in the eclipse Preferences --> XML
  • Observed different version of the spring-tx.xsd file there in the project dependencies, then excluded the different version from the poms
  • Modified to
  • Modified

etc. None of the soln worked for me.

Configuration xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.0.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.xsd">

<tx:annotation-driven/>

<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="reportTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactoryForReportIssue"/>
</bean>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
    <property name="url" value="jdbc:derby:C:\MyDB" />
    <property name="username" value="name" />
    <property name="password" value="pwd" />
</bean>

<bean id="sessionFactory"              
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource"  ref="dataSource" />
    <property name="packagesToScan" value="com.persistence.vo" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop>
            <prop key="hibernate.default_schema">SCHEMA1</prop>
            <prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
            <prop key="hibernate.search.autoregister_listeners">false</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.connection.autocommit">true</prop>
        </props>
    </property>
</bean>

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="persistenceDAO" class="com.persistence.dao.impl.PersistenceDAOImpl">
    <constructor-arg>
        <ref bean="hibernateTemplate" />
    </constructor-arg>
</bean>

<bean id="userDataPersistenceDAO" class="com.persistence.dao.impl.UserDataPersistenceDAOImpl">
    <constructor-arg>
        <ref bean="hibernateTemplate" />
    </constructor-arg>
</bean>

<bean id="reportDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
    <property name="url" value="jdbc:derby:C:\MyDB" />
    <property name="username" value="name" />
    <property name="password" value="pwd" />
</bean> 

<bean id="sessionFactoryForReportIssue"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="reportDataSource" />
    <property name="packagesToScan" value="com.persistence.vo" />
    <property name="hibernateProperties">
        <props>             
            <prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop>
            <prop key="hibernate.default_schema">SCHEMA1</prop>
            <prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
            <prop key="hibernate.search.autoregister_listeners">false</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.connection.autocommit">true</prop>
        </props>
    </property>
</bean>

<bean id="hibernateTemplateForReportIssue" class="org.springframework.orm.hibernate4.HibernateTemplate">
    <property name="sessionFactory" ref="sessionFactoryForReportIssue" />
</bean>
<bean id="reportIssuePersistenceDAO" class="com.persistence.dao.impl.ReportIssuePersistenceDAOImpl">
    <constructor-arg>
        <ref bean="hibernateTemplateForReportIssue" />
    </constructor-arg>
</bean>


<bean id="persistenceService"
    class="com.persistence.service.impl.PersistenceServiceImpl">
    <constructor-arg ref ="persistenceDAO" />
    <constructor-arg ref ="reportIssuePersistenceDAO" />
</bean>

Complete Error:

Apr 09, 2018 3:38:52 PM java.util.prefs.WindowsPreferences <init>

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. Loading modules com.ClientApp Loading inherited module 'com.ClientApp' [WARN] Ignoring identical definition of the configuration property named gin.ginjector (originally defined in com.gwtplatform.mvp.Mvp, redefined in com.ClientApp) [WARN] Server class 'com.google.inject.servlet.GuiceServletContextListener' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/google/inject/extensions/guice-servlet/3.0/guice-servlet-3.0.jar' to the web app classpath for this session [WARN] Server class 'com.google.inject.Injector' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar' to the web app classpath for this session [WARN] Server class 'org.springframework.web.context.ContextLoader' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/org/springframework/spring-web/4.2.2.RELEASE/spring-web-4.2.2.RELEASE.jar' to the web app classpath for this session [WARN] Server class 'org.springframework.core.io.Resource' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/org/springframework/spring-core/4.2.2.RELEASE/spring-core-4.2.2.RELEASE.jar' to the web app classpath for this session [WARN] Server class 'org.springframework.context.ApplicationContextException' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/org/springframework/spring-context/4.2.2.RELEASE/spring-context-4.2.2.RELEASE.jar' to the web app classpath for this session [WARN] Server class 'org.springframework.beans.FatalBeanException' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/org/springframework/spring-beans/4.2.2.RELEASE/spring-beans-4.2.2.RELEASE.jar' to the web app classpath for this session [WARN] Server class 'com.framework.logging.AppLogger' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/app/app-logger/1.0.0/app-logger-1.0.0.jar' to the web app classpath for this session [WARN] Server class 'org.apache.logging.log4j.LogManager' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/org/apache/logging/log4j/log4j-api/2.3/log4j-api-2.3.jar' to the web app classpath for this session ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console... [WARN] Server class 'com.security.encryption.ida.SharingScheme' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/utility-toolkit/4.2.0/utility-toolkit-4.2.0.jar' to the web app classpath for this session [WARN] Server class 'com.gwtplatform.dispatch.rpc.server.guice.HandlerModule' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/gwtplatform/gwtp-dispatch-rpc-server-guice/1.4/gwtp-dispatch-rpc-server-guice-1.4.jar' to the web app classpath for this session [WARN] Server class 'com.gwtplatform.dispatch.rpc.server.AbstractDispatchImpl' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/gwtplatform/gwtp-dispatch-rpc-server/1.4/gwtp-dispatch-rpc-server-1.4.jar' to the web app classpath for this session [WARN] Server class 'javax.inject.Provider' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar' to the web app classpath for this session [WARN] Server class 'org.aopalliance.intercept.MethodInterceptor' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar' to the web app classpath for this session [WARN] Server class 'com.gwtplatform.dispatch.rpc.shared.UnsecuredActionImpl' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/gwtplatform/gwtp-dispatch-rpc-shared/1.4/gwtp-dispatch-rpc-shared-1.4.jar' to the web app classpath for this session [WARN] Server class 'com.gwtplatform.dispatch.shared.TypedAction' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/gwtplatform/gwtp-dispatch-common-shared/1.4/gwtp-dispatch-common-shared-1.4.jar' to the web app classpath for this session [WARN] Server class 'com.google.gwt.user.client.rpc.IsSerializable' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/google/gwt/gwt-servlet/2.6.1/gwt-servlet-2.6.1.jar' to the web app classpath for this session [WARN] Server class 'org.apache.commons.codec.binary.Base64' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar' to the web app classpath for this session [WARN] Server class 'com.google.common.io.BaseEncoding' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/com/google/guava/guava/14.0.1/guava-14.0.1.jar' to the web app classpath for this session [WARN] Server class 'org.apache.log4j.xml.DOMConfigurator' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar' to the web app classpath for this session log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable. log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by log4j:ERROR [sun.misc.Launcher$AppClassLoader@2d63c5bb] whereas object of type log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [WebAppClassLoader=ClientApp@67128c50]. log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator]. log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. [WARN] Server resource 'applicationContext_persistence.xml' could not be found in the web app, but was found on the system classpath [WARN] Adding classpath entry 'file:/C:/Users/repo/.m2/repository/app/app-persistence/1.0.0/app-persistence-1.0.0.jar' to the web app classpath for this session Starting Jetty on port 59162 [WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload{/,file:/C:/clientapp/target/clientapp-1.0.0/},C:\clientapp\target\clientapp-1.0.0 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 12 in XML document from class path resource [applicationContext_persistence.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 25; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:605) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:509) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328) at com.server.util.AppContextLoaderListener.contextInitialized(AppContextLoaderListener.java:47) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:541) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:162) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) at org.eclipse.jetty.server.Server.doStart(Server.java:282) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:740) at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:522) at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1104) at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844) at com.google.gwt.dev.DevMode.main(DevMode.java:322) Caused by: org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 25; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) ... 33 more

I am struck with issue.

spring
eclipse
hibernate
maven
asked on Stack Overflow Apr 9, 2018 by Kavitha Koduri • edited Apr 9, 2018 by Kavitha Koduri

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0