我正在尝试使用maven tomcat插件在同一个版本中运行两组集成测试(两个不同的模块)。第一组在第一个模块上完美运行。但是tomcat无法为第二个模块部署战争。而是提供以下异常
com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: com.sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/localhost/test-module2/WEB-INF/faces-config.xml': Illegal class loader binding
at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:760)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:349)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5014)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: com.sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/localhost/test-module2/WEB-INF/faces-config.xml': Illegal class loader binding
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:758)
... 11 more
Caused by: com.sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/localhost/test-module2/WEB-INF/faces-config.xml': Illegal class loader binding
at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:1009)
at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:953)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:746)
... 11 more
Caused by: java.lang.IllegalStateException: Illegal class loader binding
at org.apache.naming.resources.DirContextURLStreamHandler.get(DirContextURLStreamHandler.java:228)
at org.apache.naming.resources.DirContextURLStreamHandler.openConnection(DirContextURLStreamHandler.java:90)
at java.net.URL.openConnection(URL.java:971)
at com.sun.faces.config.ConfigManager$ParseTask.getInputStream(ConfigManager.java:1230)
at com.sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.java:1030)
at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:1000)
... 14 more
两个maven项目的pom.xml中的插件配置如下所示:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
<configuration>
<path>/test-module2</path>
<port>8081</port>
</configuration>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
有人知道为什么会出现这个错误吗?
答案 0 :(得分:0)
在这些模块中为JNDI资源使用不同的名称。我之前也遇到过这个问题的变种。似乎有某种静态导致这种情况。 Maven插件执行在同一个JVM中 - 即Maven。如果它们是在分叉的Java-s中执行的,那么你很可能不会得到它。
我认为切换到Jetty不会有所帮助,尽管可能确实如此。但是,我的印象是,这对Maven本身来说有点问题。
我认为这可能与某个地方有一个静态ServiceLocator有关(就像这个one显示的很多例子)。