我是 primefaces 和 deltaspike 的新手,我们最初尝试使用 CDI 对话,但不得不退回到 deltaspike。我添加了https://deltaspike.apache.org/documentation/configure.html#config-maven-indep中提到的罐子, 但我遇到了 FacesMessages 的类加载问题。我不知道如何解决这个问题。以下是日志和 pom 文件。
11:05:14,056 WARN [org.jboss.modules] (Weld Thread Pool -- 1) Failed to define class javax.faces.application.FacesMessage in Module "javax.faces.api:main" from local module loader @66133adc (finder: local module finder @7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base)): java.lang.LinkageError: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader @66133adc (finder: local module finder @7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.jboss.weld.annotated.slim.backed.SecurityActions.getDeclaredMethods(SecurityActions.java:41)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:194)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:188)
at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:156)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:188)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:188)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:63)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:44)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:83)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:80)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:175)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:194)
at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:113)
at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.createContext(FastAnnotatedTypeLoader.java:102)
at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:81)
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:65)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
11:05:14,065 INFO [org.jboss.weld.Bootstrap](焊接线程池 -- 1)WELD-000119:未从 org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeFacesContextWrapper 生成任何 bean 定义,因为基础类加载错误:找不到类型 [未知]。如果这是意外情况,请启用调试日志记录以查看完整错误。
11:05:15,468 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."paris-ear.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."paris-ear.ear".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
造成的:
org.jboss.weld.exceptions.DeploymentException: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader @66133adc (finder: local module finder @7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
at org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:66)
at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:43)
at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:51)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createProducersAndObservers(ConcurrentBeanDeployer.java:103)
at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:401)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
... 3 more
造成的:
java.lang.LinkageError: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader @66133adc (finder: local module finder @7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.jboss.weld.security.GetDeclaredMethodsAction.run(GetDeclaredMethodsAction.java:30)
at org.jboss.weld.security.GetDeclaredMethodsAction.run(GetDeclaredMethodsAction.java:22)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.weld.util.reflection.Reflections.getNonPrivateNonStaticFinalMethod(Reflections.java:177)
at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:218)
at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:180)
at org.jboss.weld.util.Proxies.getUnproxyableTypesExceptionInt(Proxies.java:192)
at org.jboss.weld.util.Proxies.getUnproxyableTypesException(Proxies.java:174)
at org.jboss.weld.util.Proxies.isTypesProxyable(Proxies.java:162)
at org.jboss.weld.bean.ProducerMethod.<init>(ProducerMethod.java:76)
at org.jboss.weld.bean.ProducerMethod.of(ProducerMethod.java:60)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.createProducerMethod(AbstractBeanDeployer.java:214)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.createProducerMethods(AbstractBeanDeployer.java:199)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.createObserversProducersDisposers(AbstractBeanDeployer.java:176)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$4.doWork(ConcurrentBeanDeployer.java:106)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$4.doWork(ConcurrentBeanDeployer.java:103)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
我知道这是根本原因
java.lang.LinkageError: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader @66133adc (finder: local module finder @7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
这是我在 C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base\javax\faces\api\main 下的 modules.xml 的内容和它还有我的 jboss-jsf-api_2.2_spec-2.2.12.redhat-1.jar
<module xmlns="urn:jboss:module:1.3" name="javax.faces.api">
<dependencies>
<module name="com.sun.jsf-impl" />
<module name="javax.enterprise.api" export="true" />
<module name="javax.servlet.api" export="true" />
<module name="javax.servlet.jsp.api" export="true" />
<module name="javax.servlet.jstl.api" export="true" />
<module name="javax.validation.api" export="true" />
<module name="org.glassfish.javax.el" export="true" />
<module name="javax.api" />
</dependencies>
<resources>
<resource-root path="jboss-jsf-api_2.2_spec-2.2.12.redhat-1.jar" />
</resources>
</module>
这是我的 ejb 模块 pom.xml 的片段
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-api</artifactId>
<version>${deltaspike.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
<version>${deltaspike.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-api</artifactId>
<version>${deltaspike.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-impl</artifactId>
<version>${deltaspike.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
</dependency>
以下是来自 Parent pom 的片段
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- java ee/servlet/cdi/ejb dependencies -->
<version.javaee7.web.spec>7.0</version.javaee7.web.spec>
<version.jboss-servlet-api_3.1_spec>1.0.0.Final</version.jboss-servlet-api_3.1_spec>
<version.cdi-api>1.2</version.cdi-api>
<version.jboss-ejb-api>1.0.0.Final</version.jboss-ejb-api>
<version.jsf>2.2.12</version.jsf>
<version.javax.inject>1</version.javax.inject>
<version.el-api>2.2.1</version.el-api>
<version.validation>1.1.0.Final</version.validation>
<version.primefaces>6.0</version.primefaces>
<version.primefaces.extensions>6.0.0</version.primefaces.extensions>
<version.themes>1.0.10</version.themes>
<!-- <version.hibernate-c3p0>4.3.2.Final</version.hibernate-c3p0> -->
<version.hibernate-entitymanager>5.0.9.Final</version.hibernate-entitymanager>
<version.hibernate-core>5.0.9.Final</version.hibernate-core>
<version.hibernate.validator>5.2.4.Final</version.hibernate.validator>
<version.hibernate-jpa>1.0.0.Final</version.hibernate-jpa>
<version.hibernate-annotation>3.5.6-Final</version.hibernate-annotation>
<version.hibernate-commons-annotation>4.0.5.Final</version.hibernate-commons-annotation>
<!-- <version.google.generic.dao>1.2.0</version.google.generic.dao> -->
<version.commons-collections>3.2.2</version.commons-collections>
<version.commons-lang>2.6</version.commons-lang>
<version.commons-lang3>3.3</version.commons-lang3>
<!--TODO required? -->
<version.commons-config>1.10</version.commons-config>
<version.common-beanutils>1.9.2</version.common-beanutils>
<version.common-email>1.4</version.common-email>
<version.common-exec>1.3</version.common-exec>
<version.commons-fileupload>1.3</version.commons-fileupload>
<!--TODO required? -->
<version.commons-codec>1.10</version.commons-codec>
<!--TODO required? -->
<version.poi>3.12</version.poi>
<version.joda-time>2.8.1</version.joda-time>
<version.ojdbc6>12.1.0.2</version.ojdbc6>
<version.dom4j>1.6.1</version.dom4j>
<version.jxl>2.6.12</version.jxl>
<version.xerces>2.11.0</version.xerces>
<version.javaassist>3.15.0-GA</version.javaassist>
<version.picketbox>4.0.7.Final</version.picketbox>
<resteasy.version>2.3.5.Final</resteasy.version>
<version.jgroups>3.6.4.Final</version.jgroups>
<version.jbosscache>3.2.11.GA</version.jbosscache>
<!-- <version.weldcore>2.3.3</version.weldcore> -->
<version.weldcore>3.0.0.Alpha6</version.weldcore>
<version.common-jxpath>1.3-redhat-3</version.common-jxpath>
<version.javamail>1.5.4</version.javamail>
<!-- Logging -->
<version.logback>1.1.5</version.logback>
<version.slf4j>1.7.16</version.slf4j>
<!-- Unit testing -->
<version.junit>4.12</version.junit>
<version.easymock>3.1</version.easymock>
<!-- pluggins -->
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
<!-- DeltaSpike -->
<deltaspike.version>1.7.2</deltaspike.version>
</properties>
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.2_spec</artifactId>
<version>${version.jsf}</version>
</dependency>
</dependencies>
</dependencyManagement>
<!-- I did not have any delta spike dependency tags in parent pom, I mentioned them only in my ejb pom which is above this snippet -->
我想附上我完整的 pom.xml 文件,但不知道怎么做,它们太大了,无法像我上面做的 modules.xml 那样添加它们。有人可以指导我吗?