【问题标题】:use shiro with mvn jetty plugin使用 shiro 和 mvn jetty 插件
【发布时间】:2012-06-13 13:19:38
【问题描述】:

我从 apache shiro doc 页面下载了“Spring MVC + Shiro + myBatis + JSR-303 Validation”示例,我想用 maven jetty 插件运行它,所以我打开 pom.xml 并放上这样的东西

<plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.10</version>
                    <configuration>
                            <scanIntervalSeconds>10</scanIntervalSeconds>
                            <stopKey>foo</stopKey>
                            <stopPort>9999</stopPort>
                            <webAppConfig>
                            <contextPath>/</contextPath>
                            </webAppConfig>
                            <scanIntervalSeconds>10</scanIntervalSeconds>
                            <!-- <webAppSourceDirectory></webAppSourceDirectory> -->
                    </configuration>
                    <executions>
                            <execution>
                                    <id>start-jetty</id>
                                    <phase>pre-integration-test</phase>
                                    <goals>
                                            <goal>run</goal>
                                    </goals>
                                    <configuration>
                                            <scanIntervalSeconds>0</scanIntervalSeconds>
                                            <daemon>true</daemon>
                                    </configuration>
                            </execution>
                            <execution>
                                    <id>stop-jetty</id>
                                    <phase>post-integration-test</phase>
                                    <goals>
                                            <goal>stop</goal>
                                    </goals>
                            </execution>
                    </executions>
            </plugin>

在我使用 mvn jetty:run 启动应用程序之后,我尝试在示例中注册一个用户,我得到一个异常,例如: “java.lang.ClassCastException: org.apache.shiro.web.servlet.ShiroHttpSession 不能转换为 org.mortbay.jetty.servlet.AbstractSessionManager$SessionIf”,谁能告诉我为什么,谢谢很多。

【问题讨论】:

    标签: session jetty shiro maven-jetty-plugin


    【解决方案1】:

    很可能 ShiroHttpSession 不能转换为 AbstractSessionManager$SessionIf 因为它不是它的实例。这看起来像 Jetty 中的一个错误。我复制了这个,然后将码头插件升级到版本 6.1.26 并且错误消失了。

    【讨论】:

      猜你喜欢
      • 2010-11-08
      • 2016-05-18
      • 2020-09-07
      • 2017-10-09
      • 2012-04-13
      • 2012-12-13
      • 1970-01-01
      • 2012-01-27
      • 2012-12-15
      相关资源
      最近更新 更多