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

Thread: Error creating bean with name 'daoAuthenticationProvider'

  1. #1
    Join Date
    Dec 2005
    Posts
    11

    Default Error creating bean with name 'daoAuthenticationProvider'

    I am getting a:
    SEVERE: Context initialization failed
    error when Tomcat failed to start my webapp.

    I am using acegi. I believe the error occurs when creating this bean:

    <bean id="authenticationDao"
    class="net.sf.acegisecurity.providers.dao.jdbc.Jdb cDaoImpl">
    <property name="dataSource">
    <ref bean="dataSource"/>
    </property>
    <property name="usersByUsernameQuery">
    <value>select login,password,'true' from User where login = ?</value>
    </property>
    <property name="authoritiesByUsernameQuery">
    <value>SELECT u.login, a.authority FROM user u, authorities a WHERE u.login = ? and u.UserId = a.loginId</value>
    </property>

    </bean>

    The tomcat log reveals:
    Error creating bean with name 'daoAuthenticationProvider' defined in resource [/WEB-INF/proto-security.xml] of Servlet Context: initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/util/Assert...

    Does anyone have an idea what is causing this to occur?

    Thanks for any help.

  2. #2

    Default

    Hi, you are probably missing required Spring classes from your classpath. Try including spring.jar on your classpath.

  3. #3
    Join Date
    Dec 2005
    Posts
    11

    Default

    Thanks for responding.

    I have spring.jar in both the Web-inf/lib directory and the <tomcat-home>/server/lib directory.

  4. #4
    Join Date
    Aug 2004
    Location
    The Netherlands
    Posts
    160

    Default

    You do not need it in your server/lib folder. It might even give your problems if you have it in both locations.

    If that does not help I would try it first without the two queries, just to see if these two properties give the problem.
    Jettro Coenradie
    http://www.gridshore.nl

  5. #5

    Default

    yeah, including same .jar twice (with same name) is just asking for trouble

    looks like you're using Acegi version < 1.0? package path's imply so. If not, change those
    to org.acegisecurity.

  6. #6
    Join Date
    Dec 2005
    Posts
    11

    Default

    I removed spring.jar from <tomcat-home>/server/lib and removed the 2 queries from <bean id="authenticationDao"...>.

    I still get the same exception. Here is part of the exception:

    nit>
    INFO: SQLErrorCodes loaded: [HSQL Database Engine, Oracle, Sybase SQL Server, Mi
    crosoft SQL Server, Informix Dynamic Server, PostgreSQL, DB2*, MySQL]
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Looking up default SQLErrorCodes for DataSource
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Database Product Name is MySQL
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Driver Version is mysql-connector-java-3.0.15-ga ( $Date: 2004/08/09 22:15
    :11 $, $Revision: 1.27.2.43 $ )
    Dec 28, 2005 9:27:05 AM org.springframework.beans.factory.support.Abstract BeanFa
    ctory getBean
    INFO: Creating shared instance of singleton bean 'requirementDaoManager'
    Dec 28, 2005 9:27:05 AM org.springframework.beans.factory.support.Abstract BeanFa
    ctory getBean
    INFO: Creating shared instance of singleton bean 'securityEnforcementFilter'
    Dec 28, 2005 9:27:05 AM org.springframework.beans.factory.support.Abstract BeanFa
    ctory getBean
    INFO: Creating shared instance of singleton bean 'filterInvocationInterceptor'
    Dec 28, 2005 9:27:05 AM org.springframework.beans.factory.support.Abstract BeanFa
    ctory getBean
    INFO: Creating shared instance of singleton bean 'authenticationManager'
    Dec 28, 2005 9:27:05 AM org.springframework.beans.factory.support.Abstract BeanFa
    ctory getBean
    INFO: Creating shared instance of singleton bean 'daoAuthenticationProvider'
    Dec 28, 2005 9:27:05 AM org.springframework.beans.factory.support.Abstract BeanFa
    ctory getBean
    INFO: Creating shared instance of singleton bean 'authenticationDao'
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Looking up default SQLErrorCodes for DataSource
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Database product name found in cache for DataSource [org.springframework.j
    dbc.datasource.DriverManagerDataSource@15d616e]. Name is 'MySQL'.
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Looking up default SQLErrorCodes for DataSource
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Database product name found in cache for DataSource [org.springframework.j
    dbc.datasource.DriverManagerDataSource@15d616e]. Name is 'MySQL'.
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.object.RdbmsOperation compile
    INFO: RdbmsOperation with SQL [SELECT username,password,enabled FROM users WHERE
    username = ?] compiled
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Looking up default SQLErrorCodes for DataSource
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.support.SQLErrorCodesFact ory ge
    tErrorCodes
    INFO: Database product name found in cache for DataSource [org.springframework.j
    dbc.datasource.DriverManagerDataSource@15d616e]. Name is 'MySQL'.
    Dec 28, 2005 9:27:05 AM org.springframework.jdbc.object.RdbmsOperation compile
    INFO: RdbmsOperation with SQL [SELECT username,authority FROM authorities WHERE
    username = ?] compiled
    Dec 28, 2005 9:27:05 AM org.springframework.beans.factory.support.Abstract BeanFa
    ctory destroySingletons
    INFO: Destroying singletons in factory {org.springframework.beans.factory.suppor
    t.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transacti
    onManager,requirementDao,requirementDaoManager,mes sageSource,securityEnforcement
    Filter,authenticationProcessingFilter,integrationF ilter,authenticationEntryPoint
    ,filterInvocationInterceptor,authenticationManager ,daoAuthenticationProvider,aut
    henticationDao,accessDecisionManager,roleVoter]; Root of BeanFactory hierarchy}
    Dec 28, 2005 9:27:05 AM org.springframework.orm.hibernate.LocalSessionFact oryBea
    n destroy
    INFO: Closing Hibernate SessionFactory
    Dec 28, 2005 9:27:05 AM net.sf.hibernate.impl.SessionFactoryImpl close
    INFO: closing
    Dec 28, 2005 9:27:05 AM org.springframework.web.context.ContextLoader initWebApp
    licationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean wit
    h name 'securityEnforcementFilter' defined in resource [/WEB-INF/proto-security.
    xml] of ServletContext: Can't resolve reference to bean 'filterInvocationInterce
    ptor' while setting property 'filterSecurityInterceptor'; nested exception is or
    g.springframework.beans.factory.BeanCreationExcept ion: Error creating bean with
    name 'filterInvocationInterceptor' defined in resource [/WEB-INF/proto-security.
    xml] of ServletContext: Can't resolve reference to bean 'authenticationManager'
    while setting property 'authenticationManager'; nested exception is org.springfr
    amework.beans.factory.BeanCreationException: Error creating bean with name 'auth
    enticationManager' defined in resource [/WEB-INF/proto-security.xml] of ServletC
    ontext: Can't resolve reference to bean 'daoAuthenticationProvider' while settin
    g property 'providers[0]'; nested exception is org.springframework.beans.factory
    .BeanCreationException: Error creating bean with name 'daoAuthenticationProvider
    ' defined in resource [/WEB-INF/proto-security.xml] of ServletContext: Initializ
    ation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/sp
    ringframework/util/Assert
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean wit
    h name 'filterInvocationInterceptor' defined in resource [/WEB-INF/proto-securit
    y.xml] of ServletContext: Can't resolve reference to bean 'authenticationManager
    ' while setting property 'authenticationManager'; nested exception is org.spring
    framework.beans.factory.BeanCreationException: Error creating bean with name 'au
    thenticationManager' defined in resource [/WEB-INF/proto-security.xml] of Servle
    tContext: Can't resolve reference to bean 'daoAuthenticationProvider' while sett
    ing property 'providers[0]'; nested exception is org.springframework.beans.facto
    ry.BeanCreationException: Error creating bean with name 'daoAuthenticationProvid
    er' defined in resource [/WEB-INF/proto-security.xml] of ServletContext: Initial
    ization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/
    springframework/util/Assert
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean wit
    h name 'authenticationManager' defined in resource [/WEB-INF/proto-security.xml]
    of ServletContext: Can't resolve reference to bean 'daoAuthenticationProvider'
    while setting property 'providers[0]'; nested exception is org.springframework.b
    eans.factory.BeanCreationException: Error creating bean with name 'daoAuthentica
    tionProvider' defined in resource [/WEB-INF/proto-security.xml] of ServletContex
    t: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundE
    rror: org/springframework/util/Assert
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean wit
    h name 'daoAuthenticationProvider' defined in resource [/WEB-INF/proto-security.
    xml] of ServletContext: Initialization of bean failed; nested exception is java.
    lang.NoClassDefFoundError: org/springframework/util/Assert
    java.lang.NoClassDefFoundError: org/springframework/util/Assert
    at net.sf.acegisecurity.providers.dao.DaoAuthenticati onProvider.afterPro
    pertiesSet(DaoAuthenticationProvider.java:200)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.invokeInitMethods(AbstractAutowireCapableB eanFactory.java:991)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.createBean(AbstractAutowireCapableBeanFact ory.java:288)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.createBean(AbstractAutowireCapableBeanFact ory.java:208)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
    (AbstractBeanFactory.java:204)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
    (AbstractBeanFactory.java:136)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.resolveReference(AbstractAutowireCapableBe anFactory.java:903)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.resolveValueIfNecessary(AbstractAutowireCa pableBeanFactory.java:844)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.resolveManagedList(AbstractAutowireCapable BeanFactory.java:921)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.resolveValueIfNecessary(AbstractAutowireCa pableBeanFactory.java:849)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.applyPropertyValues(AbstractAutowireCapabl eBeanFactory.java:785)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.populateBean(AbstractAutowireCapableBeanFa ctory.java:637)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.createBean(AbstractAutowireCapableBeanFact ory.java:271)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.createBean(AbstractAutowireCapableBeanFact ory.java:208)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
    (AbstractBeanFactory.java:204)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
    (AbstractBeanFactory.java:136)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.resolveReference(AbstractAutowireCapableBe anFactory.java:903)
    at ...

  7. #7
    Join Date
    Dec 2005
    Posts
    11

    Default

    Here is a snippet of my proto-security.xml file:

    <!-- = = = = = = = = AUTHENTICATION = = = = = = = -->

    <bean id="authenticationManager"
    class="net.sf.acegisecurity.providers.ProviderMana ger">
    <property name="providers">
    <list>
    <ref bean="daoAuthenticationProvider"/>
    </list>
    </property>
    </bean>

    <bean id="daoAuthenticationProvider"
    class="net.sf.acegisecurity.providers.dao.DaoAuthe nticationProvider">
    <property name="authenticationDao"><ref bean="authenticationDao"/></property>
    </bean>

    <bean id="authenticationDao"
    class="net.sf.acegisecurity.providers.dao.jdbc.Jdb cDaoImpl">
    <property name="dataSource">
    <ref bean="dataSource"/>
    </property>
    <!--
    <property name="usersByUsernameQuery">
    <value>select login,password,enabled as 'true' from User where login = ?</value>
    </property>
    <property name="authoritiesByUsernameQuery">
    <value>SELECT u.login, a.authority FROM user u, authorities a WHERE u.login = ? and u.UserId = a.loginId</value>
    </property>
    -->
    </bean>

    I have acegi-security-0.8.2.jar in my web-inf/lib directory. This jar has package names beginning with: net\sf\acegisecurity\...

    I also have acegi-security.jar and acegi-security-catalina-server.jar in my <tomcat-home>/server/lib directory. The acegi-security.jar has package names also beginning with: net\sf\acegisecurity\...

    Is there a newer jar file I should be using which supports package: org.acegisecurity ?

    Thanks for your help.

  8. #8
    Join Date
    Aug 2004
    Location
    The Netherlands
    Posts
    160

    Default

    I would definitely start with acegi 1.0.0rc1, another thing I would NOT do is place jars into the server/lib folder. I would always place them into your web-inf lib folder. This is much easier to deploy and use. If you want to run multiple applications in your server you could run into problems if you must use different versions.
    Jettro Coenradie
    http://www.gridshore.nl

  9. #9
    Join Date
    Dec 2005
    Posts
    11

    Default

    I am now using acegi-security-1.0.0.0-RC1.jar. I modified my xml file to the new package name: org.acegisecurity.*. Tomcat throws the following exception when it is trying to load the spring context:

    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registerin
    g bean with name 'authenticationDao' defined in ServletContext resource [/WEB-IN
    F/proto-security.xml]: Bean class [org.acegisecurity.providers.dao.jdbc.JdbcDaoI
    mpl] not found; nested exception is java.lang.ClassNotFoundException: org.acegis
    ecurity.providers.dao.jdbc.JdbcDaoImpl
    java.lang.ClassNotFoundException: org.acegisecurity.providers.dao.jdbc.JdbcDaoIm
    pl
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoa
    der.java:1332)
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoa
    der.java:1181)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)


    Are you guys seeing the org.acegisecurity.providers.dao.jdbc.JdbcDaoImpl class file in the acegi-security-1.0.0.0-RC1.jar file?

    Your help is appreciated.

  10. #10

    Default

    JdbcDaoImpl's package is relocated as org.acegisecurity.userdetails.jdbc

    see also
    http://acegisecurity.sourceforge.net...e-080-090.html
    http://acegisecurity.sourceforge.net...e-090-100.html

Posting Permissions

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