Announcement Announcement Module
Collapse
No announcement yet.
bean error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • bean error

    I'm trying to make a login form with spring 3 mvc

    But I keep getting this error:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.engine.ConfigurationImpl
    This is my bean-servlet
    Code:
    <?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:context="http://www.springframework.org/schema/context"
    
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    
    xsi:schemaLocation="
    
    http://www.springframework.org/schema/beans
    
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    
    http://www.springframework.org/schema/context
    
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
    
    http://www.springframework.org/schema/mvc
    
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    
    ">
    
    <!-- Enable annotation driven controllers, validation etc... -->
    
    <mvc:annotation-driven />
    
    <context:component-scan base-package="org.allmystuff.controllers" />
    
    <bean id="viewResolver"
    
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    
    <property name="prefix">
    
    <value>/WEB-INF/jsp/</value>
    
    </property>
    
    <property name="suffix">
    
    <value>.jsp</value>
    
    </property>
    
    </bean>
    
    <bean id="messageSource"
    
    class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    
    <property name="basename" value="/WEB-INF/messages" />
    
    </bean>
    
    </beans>
    Hope someone can help me.

  • #2
    NoClassDefFoundError could be:

    - you're missing a required jar on your classpath (maybe Hibernate jar?);

    - you have an incompatibility between two of the jars you're using (like using too old version of hibernate with new version of spring, or viceversa, or something like that);

    - you have classloader issues, determined by double jar definition with different versions, jars shipped with the container, etc.

    I suggest you:

    - activate log4j by putting a log4j.xml or log4j.properties with log4j configuration in your /WEB-INF/classes folder and redeploy the application;

    - looking at the logs you will find the name and package of the class that is required and isn't found;

    - check that this class exists in one of the jars in WEB-INF/lib, and that it's correctly exported when you generate the war/ear;

    - look at the libraries shipped with your container, and double-check that there are no "doubles". Also check for doubles in your application classpath.

    ...OR...

    use Maven to handle your dependencies; once you've learned using it well, you'll never have problems like this again.

    Comment

    Working...
    X