Java EE / OmniFaces:项目设置 - 使用WildFly的LinkageError

时间:2014-05-12 09:42:52

标签: java-ee jboss wildfly omnifaces

尝试将OmniFaces集成到Java EE Web项目中。

实现以下简单侦听器方法时,我收到链接错误。我正在使用WebSphere应用程序服务器。

这里发生了什么?

public void useCreditCardChanged(javax.faces.event.ValueChangeEvent event) {
    Boolean oldVal = (Boolean) event.getOldValue();
    Boolean newVal = (Boolean) event.getNewValue();
    if (oldVal!=null) {
        this.useCreditCard = newVal;
    }
    FacesContext.getCurrentInstance().renderResponse();
}

和日志文件:

11:25:48.806 S [ConfigureListene  257] Critical error during deployment: : 
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.omnifaces.taghandler.ValidateUniqueColumn.processValueChange(Ljavax/faces/event/ValueChangeEvent;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/omnifaces/taghandler/ValidateUniqueColumn, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/faces/event/ValueChangeListener have different Class objects for the type (Ljavax/faces/event/ValueChangeEvent;)V used in the signature
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_51]
at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_51]
at com.sun.faces.util.Util.loadClass(Util.java:325) [jsf-impl-2.2.5-jbossorg-3.jar:]
at com.sun.faces.config.processor.AbstractConfigProcessor.loadClass(AbstractConfigProcessor.java:376) [jsf-impl-2.2.5-jbossorg-3.jar:]
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass(FaceletTaglibConfigProcessor.java:427) [jsf-impl-2.2.5-jbossorg-3.jar:]
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:378) [jsf-impl-2.2.5-jbossorg-3.jar:]
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:321) [jsf-impl-2.2.5-jbossorg-3.jar:]
at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:270) [jsf-impl-2.2.5-jbossorg-3.jar:]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:437) [jsf-impl-2.2.5-jbossorg-3.jar:]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214) [jsf-impl-2.2.5-jbossorg-3.jar:]
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:187) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:86)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:71)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

11:25:48.808 E [ServiceControlle 1955] MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./my-app: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./my-app: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.omnifaces.taghandler.ValidateUniqueColumn.processValueChange(Ljavax/faces/event/ValueChangeEvent;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/omnifaces/taghandler/ValidateUniqueColumn, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/faces/event/ValueChangeListener have different Class objects for the type (Ljavax/faces/event/ValueChangeEvent;)V used in the signature
    at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:216)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:86)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:71)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
    ... 3 more

Caused by: java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.omnifaces.taghandler.ValidateUniqueColumn.processValueChange(Ljavax/faces/event/ValueChangeEvent;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/omnifaces/taghandler/ValidateUniqueColumn, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/faces/event/ValueChangeListener have different Class objects for the type (Ljavax/faces/event/ValueChangeEvent;)V used in the signature
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:273)
    at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
    at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:187)
    ... 7 more

Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.omnifaces.taghandler.ValidateUniqueColumn.processValueChange(Ljavax/faces/event/ValueChangeEvent;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/omnifaces/taghandler/ValidateUniqueColumn, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/faces/event/ValueChangeListener have different Class objects for the type (Ljavax/faces/event/ValueChangeEvent;)V used in the signature
    at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_51]
    at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_51]
    at com.sun.faces.util.Util.loadClass(Util.java:325)
    at com.sun.faces.config.processor.AbstractConfigProcessor.loadClass(AbstractConfigProcessor.java:376)
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass(FaceletTaglibConfigProcessor.java:427)
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:378)
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:321)
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:270)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:437)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
    ... 9 more

1 个答案:

答案 0 :(得分:1)

  

引起:java.lang.RuntimeException:java.lang.RuntimeException:java.lang.LinkageError:接口itable初始化中的加载器约束违规:解析方法时“org.omnifaces.taghandler.ValidateUniqueColumn.processValueChange(Ljavax / faces / event / ValueChangeEvent;)V“当前类的类加载器(org / jboss / modules / ModuleClassLoader的实例),org / omnifaces / taghandler / ValidateUniqueColumn,以及类加载器(org / jboss / modules / ModuleClassLoader的实例)接口javax / faces / event / ValueChangeListener 具有不同的类对象(Ljavax / faces / event / ValueChangeEvent;)签名中使用的V

您在webapp的运行时类路径中有多个不同版本的JSF API类。在这个特殊问题中,特别是对于javax.faces.event.ValueChangeEvent类,在webapp的运行时类路径中找到了多个不同的版本。换句话说,webapp的运行时类路径是脏的。很可能你在webapp的/WEB-INF/lib中有不属于那里的JAR,因为appserver本身已经开箱即用,例如Java EE和JSF。

然后你的问题还有另外一件奇怪的事情。您正在谈论IBM WebSphere并且您已标记[websphere],但堆栈跟踪中列出的appserver特定类清楚地告诉它是JBoss WildFly,这是一个完全不同的服务器,但也许解释了您添加[jboss]标记的原因。同样,这是两个完全不同的服务器。知道你在用什么。

无论如何,请浏览webapp的/WEB-INF/lib并删除已由应用服务器本身提供的库,例如javaee.jarjsf-api.jar等。