Announcement Announcement Module
Collapse
No announcement yet.
Problem: AnnotationSessionFactoryBean not found when deployed on tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem: AnnotationSessionFactoryBean not found when deployed on tomcat

    Having some problem to instantiate AnnotationSessionFactoryBean when deploying on tomcat, though it works fine in running local jUnit test.
    Spring 2.0.2
    Hibernate 3.2 (annotations 3.2.1GA)

    applicationContext
    <beans>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
    <property name="annotatedClasses">
    <list>
    <value>com.company.storage.customerinventorymanage ment.domain.AddressAttribute</value>
    <value>com.company.storage.customerinventorymanage ment.domain.ContactMedium</value>
    <value>com.company.storage.customerinventorymanage ment.domain.Customer</value>
    <value>com.company.storage.customerinventorymanage ment.domain.Individual</value>
    <value>com.company.storage.customerinventorymanage ment.domain.IndividualName</value>
    <value>com.company.storage.customerinventorymanage ment.domain.SocSecNrId</value>
    </list>
    </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory">
    <ref bean="sessionFactory"/>
    </property>
    </bean>

    <bean id="transactionProxyTemplate" abstract="true"
    class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref bean="transactionManager"/>
    </property>
    <property name="target">
    <ref bean="cimDao"/>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
    <property name="sessionFactory">
    <ref bean="sessionFactory"/>
    </property>
    </bean>

    <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.Hibernat eInterceptor">
    <property name="sessionFactory">
    <ref bean="sessionFactory"/>
    </property>
    </bean>

    <bean id="databaseManager" class="com.company.storage.customerinventorymanage ment.database.DatabaseManager">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    </property>
    <property name="hibernateTemplate">
    <ref bean="hibernateTemplate"/>
    </property>
    </bean>

    <bean id="cimDao" class="com.company.storage.customerinventorymanage ment.dao.CIMDao">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    </property>
    <property name="hibernateTemplate">
    <ref bean="hibernateTemplate"/>
    </property>
    </bean>

    </beans>




    Stack trace


    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.Anno tationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.dom4j.DocumentException
    Caused by: org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.Anno tationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.dom4j.DocumentException
    Caused by: java.lang.NoClassDefFoundError: org.dom4j.DocumentException
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java: 59)
    at java.lang.J9VMInternals.initialize(J9VMInternals.j ava:120)
    at java.lang.Class.forNameImpl(Native Method)
    at java.lang.Class.forName(Class.java:127)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.class$(LocalSessionFactoryBean.java:157)
    at org.springframework.orm.hibernate3.LocalSessionFac toryBean.<init>(LocalSessionFactoryBean.java:157)
    at org.springframework.orm.hibernate3.annotation.Anno tationSessionFactoryBean.<init>(AnnotationSessionF actoryBean.java:64)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:67)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:521)
    at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:84)
    at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:60)
    at org.springframework.beans.factory.support.SimpleIn stantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:45)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:701)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:687)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:388)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 50)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:141)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:247)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:161)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:270)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:346)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:92)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:77)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:68)
    at com.ericsson.spm.storage.customerinventorymanageme nt.service.ws.CustomerInventoryManagementService.< init>(CustomerInventoryManagementService.java:23)
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1243)
    at org.codehaus.xfire.service.invoker.LocalFactory.cr eate(LocalFactory.java:51)
    at org.codehaus.xfire.util.factory.CachingPool.getIns tance(CachingPool.java:28)
    at org.codehaus.xfire.util.factory.SingletonPool.getI nstance(SingletonPool.java:17)
    at org.codehaus.xfire.util.factory.PooledFactory.crea te(PooledFactory.java:20)
    at org.codehaus.xfire.service.invoker.FactoryInvoker. getServiceObject(FactoryInvoker.java:30)
    at org.codehaus.xfire.service.invoker.AbstractInvoker .invoke(AbstractInvoker.java:25)
    at org.codehaus.xfire.service.invoker.ObjectInvoker.i nvoke(ObjectInvoker.java:45)
    at org.codehaus.xfire.service.binding.ServiceInvocati onHandler.sendMessage(ServiceInvocationHandler.jav a:271)
    at org.codehaus.xfire.service.binding.ServiceInvocati onHandler$1.run(ServiceInvocationHandler.java:84)
    at org.codehaus.xfire.service.binding.ServiceInvocati onHandler.execute(ServiceInvocationHandler.java:13 2)
    at org.codehaus.xfire.service.binding.ServiceInvocati onHandler.invoke(ServiceInvocationHandler.java:107 )
    at org.codehaus.xfire.handler.HandlerPipeline.invoke( HandlerPipeline.java:131)
    at org.codehaus.xfire.transport.DefaultEndpoint.onRec eive(DefaultEndpoint.java:64)
    at org.codehaus.xfire.transport.AbstractChannel.recei ve(AbstractChannel.java:38)
    at org.codehaus.xfire.transport.http.XFireServletCont roller.invoke(XFireServletController.java:301)
    at org.codehaus.xfire.transport.http.XFireServletCont roller.doService(XFireServletController.java:130)
    at org.codehaus.xfire.transport.http.XFireServlet.doP ost(XFireServlet.java:116)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:799)


    /anon

  • #2
    dom4j isn't on the classpath. You need to make sure it's in the lib directory in the webapp.
    java.lang.NoClassDefFoundError: org.dom4j.DocumentException

    Comment

    Working...
    X