-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Error creating bean "sfName" - springs ContextLoad
PostPosted: Thu Apr 20, 2006 10:19 am 
Regular
Regular

Joined: Sat Nov 06, 2004 5:20 pm
Posts: 54
Location: Collierville, TN
Hibernate3.1
MyFaces1.1.2
Spring2.0-m3
Tomcat5.0.28
jdk1.4.2_09

I have a scenario where I've created JUNIT tests for my daoManagers using a given SessionFactory. Tests run as expected - CRUD tasks work.

However, when I put a JSF front end on the app and deploy it to tomcat, I get an error on startup (see stack trace).

Having the same jars in WEB-INF/lib, if I deploy a stripped down version with no managed beans and no db access, things work ok in TC.

Here is the datasource and session factory I'm using for both JUNIT and deployment:


Code:
<bean id="DataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource">
      <property name="driverClassName">
         <value>${db.driverClassName}</value>
      </property>
      <property name="url">
         <value>${db.url}</value>
      </property>
      <property name="username">
         <value>${db.username}</value>
      </property>
      <property name="password">
         <value>${db.password}</value>
      </property>
   </bean>
   
      
   <!-- Hibernate SessionFactory (jruffinSF)-->
   <bean id="jruffinSF"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource">   <ref local="DataSource" /> </property>
      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.dialect">${db.dialect}</prop>
            <prop key="hibernate.connection.pool_size">1</prop>
            <prop key="hibernate.default_schema">${db.defaultSchema}</prop>
         </props>
      </property>
      <property name="mappingDirectoryLocations">
         <list>
            <value>classpath:com/jruffin/model</value>
         </list>
      </property>
   </bean>


Here is relevant stuff from web.xml

Code:
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
</context-param>

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>

<filter>
        <filter-name>SpringHibernateFilter</filter-name>             <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
        <init-param>
          <param-name>sessionFactoryBeanName</param-name>
          <param-value>jruffinSF</param-value>
        </init-param>
    </filter>
   
      <filter-mapping>
        <filter-name>SpringHibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

<listener>        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<listener>        <listener-class>net.sourceforge.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>


Here is the stack trace from tomcat log
[java.lang.NoClassDefFoundError: null java.lang.NoClassDefFoundError ] ???
Code:
2006-04-20 02:00:12 StandardContext[/ach]Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jruffinSF' defined in ServletContext resource [/WEB-INF/applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: null
java.lang.NoClassDefFoundError
at org.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:362)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1145)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:871)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:797)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:856)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:825)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:418)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:152)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:247)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:331)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:155)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)


Thanks in advance for your feedback.


Top
 Profile  
 
 Post subject: solved - use cglib-nodep-2.1_3.jar
PostPosted: Fri Apr 21, 2006 9:47 am 
Regular
Regular

Joined: Sat Nov 06, 2004 5:20 pm
Posts: 54
Location: Collierville, TN
I haven't figure out why but switching out cglib.jar with cglib-nodep solved this problem.

If anyone knows why and cares to share, please do.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.