Announcement Announcement Module
Collapse
No announcement yet.
No default provider validation exception when adding Spring Data to maven Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No default provider validation exception when adding Spring Data to maven

    Hi. I am looking into Spring Data Neo4j, but when I add

    <dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-neo4j</artifactId>
    <version>2.0.1.RELEASE</version>
    </dependency>

    to pom.xml and deploy on the server, I get an "Unable to find a default provider" validation exception.

    I'm using SpringSource Tool Suite 2.9.1.RELEASE, and just added the dependency above and the one for neo4j to a template MVC project.

    Michael.

  • #2
    Could you please show your full stacktrace? And tell us about your environment, to which server do you deploy? How do you integrate spring there? And perhaps also share your pom.xml and spring config files

    Thanks

    Michael

    Comment


    • #3
      Thank you for looking into this.

      All I have done is opening SpringSource Tool Suite, generating a template MVC project, and added the spring data dependency. Nothing else is needed in order to replicate the error. The server is just the one preconfigured in the Tool Suite (VMware vFabric). There are no errors when I remove the dependency. The complete stack trace (copied from my browser) is

      Code:
      javax.servlet.ServletException: Servlet.init() for servlet appServlet threw exception
      	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      	com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:84)
      	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
      	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
      	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
      	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	java.lang.Thread.run(Thread.java:722)
      root cause
      
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to find a default provider
      	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
      	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
      	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
      	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
      	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
      	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
      	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
      	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
      	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
      	javax.servlet.GenericServlet.init(GenericServlet.java:160)
      	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      	com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:84)
      	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
      	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
      	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
      	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	java.lang.Thread.run(Thread.java:722)
      root cause
      
      javax.validation.ValidationException: Unable to find a default provider
      	javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
      	org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:185)
      	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
      	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
      	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
      	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
      	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
      	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
      	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
      	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
      	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
      	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
      	javax.servlet.GenericServlet.init(GenericServlet.java:160)
      	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      	com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:84)
      	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
      	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
      	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
      	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	java.lang.Thread.run(Thread.java:722)
      The forum wouldn't let be post the full length pom.xml, because that would make the messge too long. But really, it's just the one generated from the MVC template with this single dependency added.

      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      	<modelVersion>4.0.0</modelVersion>
      	<groupId>a.b</groupId>
      	<artifactId>c</artifactId>
      	<name>Test</name>
      	<packaging>war</packaging>
      	<version>1.0.0-BUILD-SNAPSHOT</version>
      	<properties>
      		<java-version>1.6</java-version>
      		<org.springframework-version>3.1.0.RELEASE</org.springframework-version>
      		<org.aspectj-version>1.6.9</org.aspectj-version>
      		<org.slf4j-version>1.5.10</org.slf4j-version>
      	</properties>
      	<dependencies>
      		<!-- Spring -->
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-context</artifactId>
      			<version>${org.springframework-version}</version>
      			<exclusions>
      				<!-- Exclude Commons Logging in favor of SLF4j -->
      				<exclusion>
      					<groupId>commons-logging</groupId>
      					<artifactId>commons-logging</artifactId>
      				 </exclusion>
      			</exclusions>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-webmvc</artifactId>
      			<version>${org.springframework-version}</version>
      		</dependency>
      		
      		<!-- This is the only thing I changed from the template file -->
      		<dependency>
      			<groupId>org.springframework.data</groupId>
      			<artifactId>spring-data-neo4j</artifactId>
      			<version>2.0.1.RELEASE</version>
      		</dependency>
      				
      		<!-- AspectJ -->
      		...
      		
      		<!-- Logging -->
      		...
      
      		<!-- @Inject -->
      		...
      				
      		<!-- Servlet -->
      		...
      	
      		<!-- Test -->
      		...     
      	</dependencies>
          <build>
              ...
          </build>
      </project>
      Last edited by MichaelHunger; Apr 15th, 2012, 07:29 AM.

      Comment


      • #4
        Do you have hibernate-validator as dependency in your project? Which is the default implementation of the jsr303 (bean validation) ?

        Michael

        Comment


        • #5
          No I just followed the description from http://www.springsource.org/spring-data/neo4j. It doesn't mention anything about hibernate, and I don't use hibernate.

          Michael.

          Comment


          • #6
            Ok, so I guess what you meant that it is supposed to be there... Adding the dependency

            <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.2.0.Final</version>
            </dependency>

            removes the problem. Why is this needed? And why doesn't it say anywhere that it is needed?

            Comment


            • #7
              It is needed b/c it contains the API and reference implementation of JSR 303 (bean validation). And that's what it is needed for in SDN.

              It is planned to make this optional but there are some code dependencies on classes of the API in the Neo4j-Configuration (to enable custom validators).

              Sorry that it's missing from the docs, that will be fixed immediately.

              Comment


              • #8
                Thank you!

                Comment

                Working...
                X