我有一个使用 struts 1 和扭矩的遗留应用程序。上周我努力对其进行了一些重构,并尝试将一些类组解耦并引入单元测试。由于我无法通过单元测试来测试应用程序的所有区域,我想添加 HtmlUnit 测试。
为此,我将 maven-failsafe-plugin 和 jetty 添加到我的项目中,如下所示:
<build>
...
<plugins>
...
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.16</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
<contextPath>/</contextPath>
</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>
</plugins>
</build>
问题是,当我运行 mvn verify 时,出现以下异常:
java.lang.SecurityException: sealing violation: can't seal package javax.naming: already loaded
我在某些类中使用 javax.naming,但找不到任何覆盖 javax.naming 的依赖项!
有人知道如何解决这个问题吗?