Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Error creating bean with name 'myManager' defined in ...

  1. #1
    Join Date
    Aug 2004
    Location
    Brazil
    Posts
    21

    Default Error creating bean with name 'myManager' defined in ...

    Hi folks, 8)

    I'm using Spring, Hibernate and Struts on Jbuilder X. :shock:
    I created a testCase and when run this test I receive the following message:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'myManager' defined in class path resource [......./applicationContext.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null :?
    my applicationContext.xml is:

    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName"><value>org.firebirdsql.jdbc .FBDriver</value></property>
    <property name="url"><value>jdbc:firebirdsql:localhost:...</value></property>
    <property name="username"><value>SYSDBA</value></property>
    <property name="password"><value>masterkey</value></property>
    </bean>

    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="dataSource"><ref local="dataSource" /></property>
    <property name="mappingResources">
    <list>
    <!-- Add list of .hbm.xml files here -->
    <value>...</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">net.sf.hibernate.dialect.F irebirdDialect</prop>

    <!-- Hibernate Connection Pool -->
    <prop key="hibernate.connection.pool_size">1</prop>
    <prop key="hibernate.dbcp.maxActive">100</prop>
    <prop key="hibernate.dbcp.whenExhaustedAction">1</prop>
    <prop key="hibernate.dbcp.maxWait">120000</prop>
    <prop key="hibernate.dbcp.maxIdle">10</prop>

    <!-- prepared statement cache -->
    <prop key="hibernate.dbcp.ps.maxActive">100</prop>
    <prop key="hibernate.dbcp.ps.whenExhaustedAction">1</prop>
    <prop key="hibernate.dbcp.ps.maxWait">120000</prop>
    <prop key="hibernate.dbcp.ps.maxIdle">10</prop>

    <prop key="hibernate.connection.provider_class">net.sf.h ibernate.connection.DBCPConnectionProvider</prop>

    <!-- Second-level Cache -->
    <prop key="hibernate.cache.provider_class">net.sf.hibern ate.cache.HashtableCacheProvider</prop>
    <prop key="hibernate.cache.use_minimal_puts">true</prop>
    <prop key="hibernate.cache.region_prefix">hibernate.test </prop>
    <prop key="hibernate.cache.use_query_cache">true</prop>
    </props>
    </property>
    </bean>

    <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate.Hibernate TransactionManager">
    <property name="sessionFactory"><ref local="sessionFactory" /></property>
    </bean>

    <!-- Add DAOs here -->
    <bean id="hibernateDAO" class="...HibernateDAO">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>

    <!-- Add Managers Target Proxies here -->
    <bean id="myManagerTarget" class="...myManager">
    <property name="hibernateDAO"><ref local="hibernateDAO" /></property>
    </bean>

    <!-- Add Managers Proxies here -->
    <bean id="myManager" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref local="transactionManager" />
    </property>
    <property name="target">
    <ref local="myManagerTarget" />
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="insert">PROPAGATION_REQUIRED</prop>
    <prop key="update">PROPAGATION_REQUIRED</prop>
    <prop key="delete">PROPAGATION_REQUIRED</prop>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
    </props>
    </property>
    </bean>
    </beans>
    somebody has some idea of that it is happening? :oops:

    TIA

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    is your class 'myManager' defined final? CGlib can not proxy final classes.
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3
    Join Date
    Aug 2004
    Location
    Brazil
    Posts
    21

    Default

    No, MyManager definition is:

    package ...;

    import java.util.Set;

    import ....HibernateDAO;
    import ....myVO;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;

    public class MyManager {

    private static Log log = LogFactory.getLog(MyManager.class);
    private HibernateDAO dao;

    public void setHibernateDAO(HibernateDAO dao) {
    this.dao = dao;
    }

    public myVO insert(myVO value) {
    return (myVO) dao.insert(value);
    }

    public myVO update(myVO value) {
    return (myVO) dao.update(value);
    }

    public void delete(myVO value) {
    dao.delete(value);
    }

    public myVO find(myVO value) {
    return (myVO) dao.find(value, value.getIdentificador());
    }

    public Set select(myVO value) {
    return dao.select(value);
    }
    }

  4. #4
    Join Date
    Aug 2004
    Location
    Brazil
    Posts
    21

    Default The log of execution...

    Hi again, 8)

    I caught log of execution of the test in the Jbuilder, I see that everything occurs well until the moment of the creation of the bean 'myManager'.

    C:\JBuilderX\jdk1.4\bin\javaw -classpath "..." -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=rodrigo:4281, suspend=y com.borland.jbuilder.unittest.JBTestRunner -socket localhost:4045 ...TestmyManager
    INFO - Loading XML bean definitions from class path resource [.../applicationContext.xml]
    INFO - Bean factory for application context [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=5210326]: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,hiber nateDAO,myManagerTarget,...,myManager,...]; Root of BeanFactory hierarchy

    INFO - 54 beans defined in ApplicationContext [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=5210326]
    INFO - No MessageSource found for context [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=5210326]: using empty default
    INFO - No ApplicationEventMulticaster found for context [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=5210326]: using default
    INFO - Refreshing listeners
    INFO - Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,hiber nateDAO,myManagerTarget,...,myManager,...]; Root of BeanFactory hierarchy]
    INFO - Creating shared instance of singleton bean 'dataSource'
    INFO - Loaded JDBC driver: org.firebirdsql.jdbc.FBDriver
    INFO - Creating shared instance of singleton bean 'sessionFactory'
    INFO - Hibernate 2.1.4
    INFO - hibernate.properties not found
    INFO - using CGLIB reflection optimizer
    INFO - Mapping class: myVO1 -> TABLE_1
    INFO - Mapping class: ... -> ...
    INFO - Mapping class: myVO28 -> TABLE_28
    INFO - Building new Hibernate SessionFactory
    INFO - processing one-to-many association mappings
    INFO - Mapping collection: ...myVO1.myCollection1 -> TABLE_ABC
    INFO - Mapping collection: ... -> ...
    INFO - Mapping collection: ...myVO32.myCollection1 -> TABLE_XYZ
    INFO - processing one-to-one association property references
    INFO - processing foreign key constraints
    INFO - Using dialect: net.sf.hibernate.dialect.FirebirdDialect
    INFO - Use outer join fetching: true
    INFO - Initializing connection provider: org.springframework.orm.hibernate.LocalDataSourceC onnectionProvider
    INFO - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
    INFO - Use scrollable result sets: false
    INFO - Use JDBC3 getGeneratedKeys(): false
    INFO - Optimize cache for minimal puts: true
    INFO - Query language substitutions: {}
    INFO - cache provider: net.sf.hibernate.cache.HashtableCacheProvider
    INFO - instantiating and configuring caches
    INFO - building session factory
    INFO - no JNDI name configured
    INFO - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
    INFO - starting query cache at region: net.sf.hibernate.cache.QueryCache
    INFO - Creating shared instance of singleton bean 'transactionManager'
    INFO - Using DataSource [org.springframework.jdbc.datasource.DriverManagerD ataSource@7f3b8a] of Hibernate SessionFactory for HibernateTransactionManager
    INFO - Creating shared instance of singleton bean 'myManagerTarget'
    INFO - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
    INFO - Creating shared instance of singleton bean 'DB2'
    INFO - Creating shared instance of singleton bean 'HSQL'
    INFO - Creating shared instance of singleton bean 'MS-SQL'
    INFO - Creating shared instance of singleton bean 'MySQL'
    INFO - Creating shared instance of singleton bean 'Oracle'
    INFO - Creating shared instance of singleton bean 'Informix'
    INFO - Creating shared instance of singleton bean 'PostgreSQL'
    INFO - Creating shared instance of singleton bean 'Sybase'
    INFO - SQLErrorCodes loaded: [HSQL Database Engine, Oracle, Sybase SQL Server, Microsoft SQL Server, Informix Dynamic Server, PostgreSQL, DB2*, MySQL]
    INFO - Looking up default SQLErrorCodes for DataSource
    INFO - Database Product Name is Firebird
    INFO - Driver Version is 0.1
    INFO - Error Codes for Firebird not found
    INFO - Creating shared instance of singleton bean 'myManager2Target'
    INFO - Looking up default SQLErrorCodes for DataSource
    INFO - Database product name found in cache for DataSource [org.springframework.jdbc.datasource.DriverManagerD ataSource@7f3b8a]. Name is 'Firebird'.
    INFO - Creating shared instance of singleton bean 'myManager25Target'
    INFO - Looking up default SQLErrorCodes for DataSource
    INFO - Database product name found in cache for DataSource [org.springframework.jdbc.datasource.DriverManagerD ataSource@7f3b8a]. Name is 'Firebird'.

    INFO - Creating shared instance of singleton bean 'myManager' <<<< In this point the exception occurs >>>> :roll:

    INFO - Destroying singletons in factory {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,hiber nateDAO,myManagerTarget,...,myManager,...]; Root of BeanFactory hierarchy}
    INFO - Closing Hibernate SessionFactory
    INFO - closing
    I do not know what he is happening. Somebody can help me?

    TIA

  5. #5
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    This is a pretty simple setup, similar to what others are already using.

    Can you confirm that you are up-to-date w/regards to Spring and CGLib?

    Regards,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  6. #6
    Join Date
    Aug 2004
    Location
    Brazil
    Posts
    21

    Default I am working with "spring-framework-1.0.2-with-dependen

    Hi Colin

    Quote Originally Posted by Colin Sampaleanu
    This is a pretty simple setup, similar to what others are already using.

    Can you confirm that you are up-to-date w/regards to Spring and CGLib?

    Regards,
    I am working with "spring-framework-1.0.2-with-dependencies.zip" and all jars of the lib directory are in my classpath. 8)
    It is necessary to configure more some thing?

    TIA

  7. #7
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    There were a few cglib related fixes after 1.0.2, although as I remember they were with regards to memory leaks when using prototype objects.

    However, you would be well-served by moving to the current code. What's in CVS right now is very stable, and is less than a week or two from release as 1.1 final, so you may want to try it. I've put up a snapshot from today as:

    http://web2.springframework.com/snap...s-20040823.zip

    You could also use 1.1RC2. There have been a few bugfixes since then, but I am pretty sure none of them would be in a related area.

    Regards,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  8. #8
    Join Date
    Aug 2004
    Location
    Brazil
    Posts
    21

    Default I will make the tests today

    Hi Colin,
    I will make the tests today, thanks by the attention, I'm very grateful.
    I will give notice...

    TIA

  9. #9
    Join Date
    Aug 2004
    Location
    Brazil
    Posts
    21

    Default Everything is working perfectly

    Hi Colin,

    Everything is working perfectly, one more time, thank you very much!

    Regards,

    _________________
    Eduardo Valentim

    "The best way to learn is to teach"

  10. #10
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    So the only thing you changed was dropping in the new version?

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

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