Announcement Announcement Module
Collapse
No announcement yet.
spring annotation problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring annotation problem

    hi! I have a problem when configuring spring annotation in application-context.xml.I'm setting a Spring 2.5 + Hibernate 3 project in Eclipse Eclipse Java EE IDE for Web Developers.Version Kepler Release 1.When I add the code <tx:annotation-driven transaction-manager="transactionManager"/> to my context I start getting the following error in my my application-context.xml :
    Multiple annotations found at this line:
    - Invalid NamespaceHandler class [org.springframework.transaction.config.TxNamespace Handler] for namespace
    [http://www.springframework.org/schema/tx]: problem with handler class file or dependent class.
    Does anyone knows what I’m missing (incompatible versions?
    And when I run my jsf I'm getting the following error:

    org.hibernate.LazyInitializationException: could not initialize proxy - no Session
    Here is my application-context.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
    <property name="url" value="jdbc:mysql://localhost/capitolacademy"></property>
    <property name="username" value="root"></property>
    <property name="password" value=""></property>
    </bean>

    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="annotatedClasses">
    <list>
    <value>com.capitol.academy.model.Employee</value>
    <value>com.capitol.academy.model.News</value>
    <value>com.capitol.academy.model.EmployeeNews</value>
    <value>com.capitol.academy.model.Currency</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LInnoDBDialect</prop>
    </props>
    </property>
    </bean>
    <bean id="txManager"
    class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <tx:annotation-driven transaction-manager="txManager"></tx:annotation-driven>
    <context:annotation-config />
    <context:component-scan base-package="com.capitol.academy" />

    </beans>

    and my lib :

    antlr-2.7.6
    asm-2.2.3
    asm-commons-2.2.3
    aspectjrt
    aspectjweaver
    cglib-nodep-2.1_3
    common-annotations
    commons-beanutils
    commons-beanutils-bean-collections
    commons-beanutils-core
    commons-collections
    commons-dbcp
    commons-digester
    commons-logging
    commons-pool
    dom4j-1.6.1
    ejb3-persistence
    hibernate3
    hibernate-annotations
    hibernate-commons-annotations
    spring
    spring-test

    Please Help me!!!
Working...
X