Announcement Announcement Module
Collapse
No announcement yet.
Spring Data JPA Problm PLz Solve Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data JPA Problm PLz Solve

    HI Guyss....
    I want to do this without using Mave
    I m getting this error at this line <jpa:repositories base-package="com.qatar.capacity.Repository"/>

    error ------Multiple annotations found at this line:
    - cvc-complex-type.2.4.c: The matching wildcard is strict, but no
    declaration can be found for element 'jpa:repositories'.
    - schema_reference.4: Failed to read schema document 'http://
    http://www.springframework.org/schem...spring-jpa.xsd', because 1) could not
    find the document; 2) the document could not be read; 3) the root element of the
    document is not <xsd:schema>.

    MY XML FILE..
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...-beans-3.2.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schem...ontext-3.2.xsd
    http://www.springframework.org/schema/data/jpa
    http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">

    <context:component-scan base-package="com.qatar.capacity"/>

    <jpa:repositories base-package="com.qatar.capacity.Repository"/>

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://127.0.0.1:3306/dev?autoReconnect=true"/>
    <property name="username" value="root"/>
    <property name="password" value="root"/>
    </bean>
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="persistenceUnitName" value="springJpaPersistenceUnit"/>
    <property name="dataSource" ref="dataSource"/>
    <property name="persistenceXmlLocation" value="persistence.xml"/>
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter" />
    </property>
    <property name="jpaProperties">
    <props>
    <prop key="hibernate.hbm2ddl.auto">update</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
    </props>
    </property>
    </bean>
    <!-- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="persistenceXmlLocation" value="persistence.xml"/>
    <property name="persistenceUnitName" value="springJpaPersistenceUnit"/>
    </bean> -->
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>
    </beans>


    I have invluded jar to slove this problm which are as follows
    antlr-2.7.6.jar
    antlr-runtime-3.0.1.jar
    com.springsource.org.aopalliance-1.0.0.jar
    commons-collections-3.1.jar
    commons-dbcp-1.4.jar
    commons-logging.jar
    commons-logging-1.1.1.jar
    commons-pool-1.6.jar
    dom4j-1.6.1.jar
    eclipselink-2.3.0.jar
    eclipselink-jpa-modelgen-2.3.0.jar
    hibernate3.jar
    hibernate-jpa-2.0-api-1.0.1.Final.jar
    javassist-3.12.0.GA.jar
    javax.annotation.jar
    javax.persistence-2.0.jar
    jaxb-api-osgi.jar
    jstl-1.1.2.jar
    jta-1.1.jar
    mysql-connector-java-5.1.14-bin.jar
    mysql-connector-java-5.1.5.jar
    org.apache.commons.fileupload.jar
    org.eclipse.persistence.jpa.jpql_1.0.0.jar
    org.springframework.aop-3.1.1.RELEASE.jar
    org.springframework.asm-3.1.1.RELEASE.jar
    org.springframework.beans-3.1.1.RELEASE.jar
    org.springframework.context.support-3.1.1.RELEASE.jar
    org.springframework.context-3.1.1.RELEASE.jar
    org.springframework.core-3.1.1.RELEASE.jar
    org.springframework.expression-3.1.1.RELEASE.jar
    org.springframework.jdbc-3.1.1.RELEASE.jar
    org.springframework.orm-3.1.1.RELEASE.jar
    org.springframework.transaction-3.1.1.RELEASE.jar
    org.springframework.web.servlet-3.1.0.RELEASE.jar
    org.springframework.web.servlet-3.1.1.RELEASE.jar
    org.springframework.web-3.1.1.RELEASE.jar
    org-netbeans-modules-java-j2seproject-copylibstask.jar
    slf4j-api-1.6.1.jar
    slf4j-api-1.6.4.jar
    slf4j-simple-1.6.4.jar
    spring-data-commons-core-1.1.0.M2.jar
    spring-data-commons-core-1.2.0.RELEASE-sources.jar
    spring-data-jpa-1.0.0.M1.jar
    spring-data-jpa-1.0.1.RELEASE.jar
    spring-data-jpa-1.1.0.RELEASE.jar
    spring-data-jpa-1.1.1.RELEASE.jar
    spring-data-jpa-1.2.0.RELEASE.jar
    spring-data-jpa-1.2.1.RELEASE-sources.jar
    spring-data-jpa-1.3.1.RELEASE.jar
    standard-1.1.2.jar
    webservices-api-osgi.jar

  • #2
    First, please wrap your code next time in code element. it's hard to read it like this...


    Is com.qatar.capacity.Repository a class or a package? You need it to be a package..

    something like
    Code:
        <jpa:repositories base-package="com.zao.data.repository" />
    and my component scans are

    Code:
    	<context:component-scan base-package="com.zao.data.services"/>

    second - why do you have so many duplicates jars?

    both slf4j 1.6.4 and 1.6.1?

    all the releases of spring data? keep only the latest of spring-data-jpa-xx.jar and spring-data-commons-xx.jar
    also - why both hibernate and eclipse link? from what i see you wanna work with hibernate... then delete the eclipse one.
    same goes for mysql and org.springframework.web.servlet


    HTH,
    Yoni

    Comment

    Working...
    X