Results 1 to 7 of 7

Thread: java.lang.NoClassDefFoundError

  1. #1
    Join Date
    Nov 2005
    Posts
    28

    Default 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. #2
    Join Date
    Dec 2005
    Posts
    13

    Default

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

  3. #3
    Join Date
    Nov 2005
    Posts
    28

    Default

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

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  5. #5
    Join Date
    Nov 2005
    Posts
    28

    Default

    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)

  6. #6
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  7. #7
    Join Date
    Nov 2005
    Posts
    28

    Default

    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

Posting Permissions

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