Results 1 to 4 of 4

Thread: Help with applicationContext

  1. #1
    Join Date
    Sep 2008
    Posts
    14

    Default Help with applicationContext

    Hi everyone, heres my problem, when i run my main class, it gives me this:

    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionSt oreException: Error registering bean with name 'cfg' defined in file [H:\Spring\src\hibernate\context\applicationContext .xml]: Class that bean class [org.hibernate.cfg.AnnotationConfiguration] depends on not found; nested exception is java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder


    here's my beans definition:

    <bean id="cfg" class="org.hibernate.cfg.AnnotationConfiguration">
    </bean>

    what's wrong?? im new to spring so i might have forgotten something stupid >.<
    Last edited by barbafh3; Sep 23rd, 2008 at 12:14 AM.

  2. #2

    Default

    do you have org/slf4j/impl/StaticLoggerBinder?

  3. #3
    Join Date
    Sep 2008
    Posts
    14

    Default

    No -.-, but i added to the jar list of the project, and now i get another message:

    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sFactory' defined in file [H:\Spring\src\hibernate\context\applicationContext .xml]: Initialization of bean failed; nested exception is java.lang.IncompatibleClassChangeError: class org.hibernate.cfg.FkSecondPass has interface org.hibernate.cfg.SecondPass as super class
    java.lang.IncompatibleClassChangeError: class org.hibernate.cfg.FkSecondPass has interface org.hibernate.cfg.SecondPass as super class

    and here's my sFactory definition:

    <bean id="dSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/urso" />
    <property name="username" value="root" />
    <property name="password" value="root" />
    </bean>
    <bean id="sFactory" class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dSource"/>
    <property name="annotatedClasses">
    <list>
    <value>hibernate.model.Aluno</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">${hibernate.dialect}
    </prop>
    </props>
    </property>
    </bean>

  4. #4

    Default

    AnnotationSessionFactoryBean

    you could try *.hbm.xml first ,when you are familiar with *.hbm.xml,then you could learn

    how to use annotation to replace the xml files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •