Announcement Announcement Module
Collapse
No announcement yet.
Errors on spring-beans and spring-context JARs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Errors on spring-beans and spring-context JARs

    Hi, first of all i have to say that english is not my first language, so, i'm sorry if i write something wrong.

    I dont have much knowlege about spring, only the basics in IoD. But seems to me that my Spring JAR's are corrupted or something. After Roo crated all the stuff for my web project, the generated code has the following problems:

    Code:
    Referenced file contains errors (jar:file:/C:/Users/DCLICK/.m2/repository/org/springframework/spring-beans/3.1.0.RELEASE/spring-beans-3.1.0.RELEASE.jar!/org/springframework/beans/factory/xml/spring-beans-3.0.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."	
    Referenced file contains errors (jar:file:/C:/Users/DCLICK/.m2/repository/org/springframework/spring-beans/3.1.0.RELEASE/spring-beans-3.1.0.RELEASE.jar!/org/springframework/beans/factory/xml/spring-beans-3.0.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."	
    Referenced file contains errors (jar:file:/C:/Users/DCLICK/.m2/repository/org/springframework/spring-beans/3.1.0.RELEASE/spring-beans-3.1.0.RELEASE.jar!/org/springframework/beans/factory/xml/spring-tool-3.0.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."
    Referenced file contains errors (jar:file:/C:/Users/DCLICK/.m2/repository/org/springframework/spring-beans/3.1.0.RELEASE/spring-beans-3.1.0.RELEASE.jar!/org/springframework/beans/factory/xml/spring-tool-3.0.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."
    Referenced file contains errors (jar:file:/C:/Users/DCLICK/.m2/repository/org/springframework/spring-context/3.1.0.RELEASE/spring-context-3.1.0.RELEASE.jar!/org/springframework/context/config/spring-context-3.0.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."
    Referenced file contains errors (jar:file:/C:/Users/DCLICK/.m2/repository/org/springframework/spring-context/3.1.0.RELEASE/spring-context-3.1.0.RELEASE.jar!/org/springframework/context/config/spring-context-3.0.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."
    all of them is in applicationContext-jpa.xml.

    The "Show Details" of the problems above show several problems, i took a screenshot:

    Attachment

    The main fact the makes me thinking that's something wrong with the jars, is that i run the bikeshop.roo script, that cames on the "samples" folder of Roo instalation. And the result was exactly the same.
    And this JAR's came from maven's repository.

    I really need help because I have no idea of how to solve this problem, and I need solve it.

    Some specs of my project and the files below:
    (Everything was generated by Roo)

    My IDE is:

    STS-2.8.1.RELEASE
    spring-roo-1.2.0.RELEASE

    And the version of spring framework is: 3.1.0.RELEASE

    I created all entities, then the repository interfaces and services and set the web project by this commands:

    Code:
    web jsf setup
    web jsf all --package ~.web
    my applicationContext-jpa.xml:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/data/jpa"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
    
      <repositories base-package="br.com.dclick" />
    
    </beans:beans>
    my applicationContext.xml:

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
        <!--
            This will automatically locate any and all property files you have
            within your classpath, provided they fall under the META-INF/spring
            directory. The located property files are parsed and their values can
            then be used within application context files in the form of
            ${propertyKey}.
        -->
        <context:property-placeholder location="classpath*:META-INF/spring/*.properties"/>
        <!--
            Turn on AspectJ @Configurable support. As a result, any time you
            instantiate an object, Spring will attempt to perform dependency
            injection on that object. This occurs for instantiation via the "new"
            keyword, as well as via reflection. This is possible because AspectJ
            is used to "weave" Roo-based applications at compile time. In effect
            this feature allows dependency injection of any object at all in your
            system, which is a very useful feature (without @Configurable you'd
            only be able to dependency inject objects acquired from Spring or
            subsequently presented to a specific Spring dependency injection
            method). Roo applications use this useful feature in a number of
            areas, such as @PersistenceContext injection into entities.
        -->
        <context:spring-configured/>
        <!--
            This declaration will cause Spring to locate every @Component,
            @Repository and @Service in your application. In practical terms this
            allows you to write a POJO and then simply annotate the new POJO as an
            @Service and Spring will automatically detect, instantiate and
            dependency inject your service at startup time. Importantly, you can
            then also have your new service injected into any other class that
            requires it simply by declaring a field for your service inside the
            relying class and Spring will inject it. Note that two exclude filters
            are declared. The first ensures that Spring doesn't spend time
            introspecting Roo-specific ITD aspects. The second ensures Roo doesn't
            instantiate your @Controller classes, as these should be instantiated
            by a web tier application context. Refer to web.xml for more details
            about the web tier application context setup services.
            
            Furthermore, this turns on @Autowired, @PostConstruct etc support. These 
            annotations allow you to use common Spring and Java Enterprise Edition 
            annotations in your classes without needing to do any special configuration. 
            The most commonly used annotation is @Autowired, which instructs Spring to
            dependency inject an object into your class.
        -->
        <context:component-scan base-package="br.com.dclick">
            <context:exclude-filter expression=".*_Roo_.*" type="regex"/>
            <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
        </context:component-scan>
        <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
            <property name="driverClassName" value="${database.driverClassName}"/>
            <property name="url" value="${database.url}"/>
            <property name="username" value="${database.username}"/>
            <property name="password" value="${database.password}"/>
            <property name="testOnBorrow" value="true"/>
            <property name="testOnReturn" value="true"/>
            <property name="testWhileIdle" value="true"/>
            <property name="timeBetweenEvictionRunsMillis" value="1800000"/>
            <property name="numTestsPerEvictionRun" value="3"/>
            <property name="minEvictableIdleTimeMillis" value="1800000"/>
            <property name="validationQuery" value="SELECT version();"/>
        </bean>
        <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
            <property name="entityManagerFactory" ref="entityManagerFactory"/>
        </bean>
        <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
        <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
            <property name="persistenceUnitName" value="persistenceUnit"/>
            <property name="dataSource" ref="dataSource"/>
        </bean>
    </beans>
    The bikeshop script is in the attachments.

    Well, thank you for reading, and i hope that anyone can helps me!
    Bye!
    Attached Files

  • #2
    So, the problem was solved!

    In this post on Spring Web Forum, http://forum.springsource.org/showth...070#post400070
    where another user had this same problem, the user Madkinder wrote this:

    The problem is that spring-jpa-1.0.xsd hardcoded the version of spring-context to 3.0. That is the cause of the problems. Looks like this issue was fixed a while ago: https://jira.springsource.org/browse/DATAJPA-160. Unfortunately the fix is not in spring-data-jpa-1.0.2.RELEASE
    Then i've changed my spring-data-jpa version on pom.xml to 1.1.0.BUILD-SNAPSHOT, add this repositorty:

    Code:
    <repository>
    	<id>spring-snapshot</id>
    	<name>Spring Maven SNAPSHOT Repository</name>
    	<url>http://s3.amazonaws.com/maven.springframework.org/snapshot</url>
    </repository>
    And all worked just fine!

    Comment

    Working...
    X