【问题标题】:Running Spring Roo PIzzashop sample运行 Spring Roo PIzzashop 示例
【发布时间】:2015-11-27 08:27:04
【问题描述】:

我确实使用过 Spring,但对 Spring Roo 不熟悉,所以我下载了 1.3.2 并想运行 Pizzashop 示例。 我已经安装了 Maven 3.2.1,JDK8。我从命令行启动 Roo 并想在新创建的目录中执行“script Pizzashop.roo”,但是我遇到了几个错误:

  1. tailor activate web-simple 失败,因为我没有 web-simple 配置。我通过删除线解决了这个问题,但没有找到 发布包中的裁缝.xml 或通过 Google。
  2. 执行测试失败,因为“未能加载 ApplicationContext”。 我该如何解决这个问题?
  3. 我运行了perform package,成功了,之后我尝试了mvn tomcat:从命令行运行,失败:

    2015-11-27 09:10:03,645 [main] 错误 org.springframework.web.context.ContextLoader - 上下文 初始化失败 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 配置问题:读取候选组件类失败: 文件 [c:\development\components\roo_pizza\target\classes\com\springsource\pizzashop\domain\PizzaOrderPk.class]; 嵌套异常是 org.springframework.core.NestedIOException: ASM ClassReader 无法解析类文件 - 可能是由于新的 Java 尚不支持的类文件版本:类路径资源 [java/io/Serializable.class]

在我看来,Java 8 似乎不受支持,尽管我读过 Roo 1.3 添加了 Java8 支持。 (我对 ApplicationContext 问题一无所知。) 我想在下周做一个 Roo 的演示,感谢任何帮助。

谢谢

茶蜂

【问题讨论】:

    标签: maven spring-roo


    【解决方案1】:

    Spring Roo 是一个非常灵活的工具,但这意味着它也很复杂和麻烦。超过 50% 在我使用时,我必须手动解决问题才能使其运行。但另一方面,你有一个强大的工具。 如果您不打算使用 spring,我建议您希望可以使用更轻量级和更稳定的工具,例如 JBoss Forge 或 Generjee。如果你真的需要弹簧,或者检查 springfuse。

    【讨论】:

      【解决方案2】:

      所以,我开始解决问题: 首先,我降级到Java7,然后升级到maven 3.3.9。 起初,roo 命令“执行测试”未能运行。这需要通过将 mvnXXX.cmd 文件(在 maven\bin 中)复制到 mvnXXX.bat 来修复。看起来 roo 正在寻找“bat”文件。 现在,一切运行良好。 我还注意到,通过运行 mvn tomcat:run,Catalina 6.0.29 会启动。于是我改成了mvn tomcat7:run。我将恢复到 Java8,并发布结果。

      【讨论】:

        【解决方案3】:

        所以,升级到 Java8 后,roo 控制台抱怨无法加载 ApplicationContext。 尝试添加:

        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/test/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                </includes>
                <excludes>
                    <exclude>**/*local.properties</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        

        到 pom.xml,但没有帮助。

        【讨论】:

          【解决方案4】:

          所以,这是我为启用 Java8 所做的修改。 java设置为1.8 aspectj 设置为 1.8.3 sprint 设置为 4.2.3.RELEASE

          抱怨:

          The method installFormatters(FormatterRegistry) of type ApplicationConversionServiceFactoryBean must override or implement a supertype method in ApplicationConversionServiceFactoryBean.java
          

          因为 installFormatters 在 Spring 4 中已被弃用。 注释掉 installFormatters Override 部分。

          将 aspectj-maven-plugin 升级到 1.8.3 将 1.8 添加到 pom.xml 到 aspectj-maven-plugin

          [WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
          c:\development\components\roo_pizza\org\springframework\mock\staticmock\AnnotationDrivenStaticEntityMockingControl.aj:117
          
          [INFO] 
          [INFO] --- aspectj-maven-plugin:1.8:test-compile (default) @ pizzashop ---
          [INFO] Showing AJC message detail for messages of types: [error, warning, fail]
          [WARNING] this affected type is not exposed to the weaver: com.springsource.pizzashop.domain.PizzaOrderPk [Xlint:typeNotExposedToWeaver]
          c:\development\components\roo_pizza\org\springframework\beans\factory\aspectj\AnnotationBeanConfigurerAspect.aj:82
          
          [WARNING] this affected type is not exposed to the weaver: com.springsource.pizzashop.domain.PizzaOrderPk [Xlint:typeNotExposedToWeaver]
          c:\development\components\roo_pizza\org\springframework\beans\factory\aspectj\AnnotationBeanConfigurerAspect.aj:88
          
          [WARNING] this affected type is not exposed to the weaver: com.springsource.pizzashop.domain.PizzaOrderPk [Xlint:typeNotExposedToWeaver]
          c:\development\components\roo_pizza\org\springframework\beans\factory\aspectj\AbstractInterfaceDrivenDependencyInjectionAspect.aj:100
          

          我仍然对这些警告感到不舒服,但测试通过了,而且似乎 PizzaShop 运行了。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2018-01-31
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2018-06-07
            • 1970-01-01
            相关资源
            最近更新 更多