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

  • java.lang.NoClassDefFoundError

    15:09:05,818 [ContainerBackgroundProcessor[StandardEngine[Catalina]] org.springframework.web.context.ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'ecdata.sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: null
    java.lang.NoClassDefFoundError
    at org.hibernate.tuple.EntityMetamodel.class$(EntityM etamodel.java:41)
    at org.hibernate.tuple.EntityMetamodel.<init>(EntityM etamodel.java:122)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.<init>(AbstractEntityPersister.java:412)
    at org.hibernate.persister.entity.SingleTableEntityPe rsister.<init>(SingleTableEntityPersister.java:108 )

    could anyone shed some light on what's causing this exception?
    thanks

    it's defined as the following:

    <bean id="mySessionFactory"
    class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource"><ref bean="myDataSource"/></property>
    <property name="mappingLocations">
    <list>
    <value>/WEB-INF/classes/SubscribedProduct.hbm.xml</value>
    <value>/WEB-INF/classes/Subscriber.hbm.xml</value>
    <value>/WEB-INF/classes/Subscription.hbm.xml</value>
    <value>/WEB-INF/classes/User.hbm.xml</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.Orac le9Dialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hibernate.generate_statistics">true</prop>
    <prop key="hibernate.use_sql_comments">true</prop>
    </props>
    </property>
    </bean>

  • #2
    Why do you have ecdata.sessionFactory thrown when you defined <bean id="mySessionFactory"> ? Did you check the spelling?

    Comment


    • #3
      sorry, i just removed the ecdata prefix after pasting the bean definitions.
      any idea what's causing the exception?

      Comment


      • #4
        Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: null
        java.lang.NoClassDefFoundError
        at org.hibernate.tuple.EntityMetamodel.class$(EntityM etamodel.java:41)
        at org.hibernate.tuple.EntityMetamodel.<init>(EntityM etamodel.java:122)
        at org.hibernate.persister.entity.AbstractEntityPersi ster.<init>(AbstractEntityPersister.java:412)
        at org.hibernate.persister.entity.SingleTableEntityPe rsister.<init>(SingleTableEntityPersister.java:108 )
        There might be a problem with your mappings - i.e. the class defined in there are not found on the classpath (maybe a typo or just a classpath problem). Double check them and start diagnosis by adding just one file at a time.

        Comment


        • #5
          thanks. the classes are all in WEB-INF/classes directory.
          plus, when i changed the log level to DEBUG for org.hibernate, i noticed that
          the mappings were processed without errors.
          below is a snippet of the log produced.

          10:12:14,315 [ContainerBackgroundProcessor[StandardEngine[Catalina]] net.sf.ehcache.config.Configuration$DiskStore] Disk Store Path: /home/gmoh/catalina/temp
          10:12:14,783 [ContainerBackgroundProcessor[StandardEngine[Catalina]] org.springframework.beans.factory.support.DefaultL istableBeanFactory] Destroying singletons in factory {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [ecdata.dataSource,ecdata.userDetailsService,ecdata .accessDecisionManager,ecdata.applicationListener, acegi.filterChainProxy,acegi.authenticationManager ,acegi.daoAuthenticationProvider,acegi.anonymousAu thenticationProvider,acegi.concurrentSessionContro ller,acegi.sessionRegistry,acegi.concurrentSession Filter,acegi.httpSessionContextIntegrationFilter,a cegi.anonymousProcessingFilter,acegi.securityEnfor cementFilter,acegi.filterInvocationInterceptor,ace gi.authenticationProcessingFilterEntryPoint,acegi. authenticationProcessingFilter,ecdata.credentialsR enewalFilter,ecdata.controller,handlerMapping,view Resolver,ecdata.sessionFactory]; root of BeanFactory hierarchy}
          10:12:14,791 [ContainerBackgroundProcessor[StandardEngine[Catalina]] org.springframework.web.context.ContextLoader] Context initialization failed
          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'ecdata.sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: null
          java.lang.NoClassDefFoundError
          at org.hibernate.tuple.EntityMetamodel.class$(EntityM etamodel.java:41)
          at org.hibernate.tuple.EntityMetamodel.<init>(EntityM etamodel.java:122)
          at org.hibernate.persister.entity.AbstractEntityPersi ster.<init>(AbstractEntityPersister.java:412)
          at org.hibernate.persister.entity.SingleTableEntityPe rsister.<init>(SingleTableEntityPersister.java:108 )
          at org.hibernate.persister.PersisterFactory.createCla ssPersister(PersisterFactory.java:55)

          Comment


          • #6
            IIRC this error might occur because hibernate-annotations.jar is missing. Make sure you have the latest 3.1 (which had a final release recently) and that you include all dependencies.
            I assume you might find something on the HB forum also.

            Comment


            • #7
              i'm using hibernate 3.1 but i don't see hibernate-annotations.jar.
              and by the way, i'm running the application in tomcat 5.0.x

              Comment

              Working...
              X