1

在应用必要的更改以从 JSF 2/RichFaces 4 迁移到 JSF 1.2/RichFaces 3 后,出现了这些错误,我无法解决它们:

请问这些异常的原因是什么

09:45:17,231 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class javax.faces.render.ClientBehaviorRenderer in Module "deployment.project-web.war:main" from Service Module Loader: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/render/ClientBehaviorRenderer
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_15]
at java.lang.ClassLoader.defineClass(ClassLoader.java:787) [rt.jar:1.7.0_15]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_15]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_15]
at java.lang.ClassLoader.defineClass(ClassLoader.java:787) [rt.jar:1.7.0_15]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_15]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at org.jboss.as.web.deployment.jsf.JsfAnnotationProcessor.deploy(JsfAnnotationProcessor.java:111)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_15]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_15]

09:45:17,252 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.richfaces.renderkit.ComponentControlBehaviorRenderer in Module "deployment.project-web.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/richfaces/renderkit/ComponentControlBehaviorRenderer (Module "deployment.project-web.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at org.jboss.as.web.deployment.jsf.JsfAnnotationProcessor.deploy(JsfAnnotationProcessor.java:111)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_15]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_15]
Caused by: java.lang.NoClassDefFoundError: javax/faces/render/ClientBehaviorRenderer
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_15]
at java.lang.ClassLoader.defineClass(ClassLoader.java:787) [rt.jar:1.7.0_15]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_15]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
... 15 more
Caused by: java.lang.ClassNotFoundException: javax.faces.render.ClientBehaviorRenderer from [Module "deployment.project-web.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
... 20 more

09:45:17,275 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."project-web.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."project-web.war".INSTALL: Failed to process phase INSTALL of deployment "project-web.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_15]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_15]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018045: Failed to load annotated class: org.richfaces.renderkit.ComponentControlBehaviorRenderer
at org.jboss.as.web.deployment.jsf.JsfAnnotationProcessor.deploy(JsfAnnotationProcessor.java:113)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more

09:45:17,326 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "project-web.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"project-web.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"project-web.war\".INSTALL: Failed to process phase INSTALL of deployment \"project-web.war\""}}
09:45:17,328 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) 
JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."project-web.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."project-web.war".INSTALL: Failed to process phase INSTALL of deployment "project-web.war"

09:45:17,330 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"project-web.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"project-web.war\".INSTALL: Failed to process phase INSTALL of deployment \"project-web.war\""}}}

提前致谢。

编辑:应用程序服务器是 JBoss AS 7

4

1 回答 1

1

此错误取决于您的 Web 应用程序服务器,您应该将java-web-app jar 替换为服务器的实现。通常通过更改maven配置文件中的一些参数就足够了。

在您的情况下,对于Jboss ,您应该有这样的东西(在使用jboss-tools构建项目时自动构建):

<!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill
    of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
    of artifacts. We use this here so that we always get the correct versions
    of artifacts. Here we use the jboss-javaee-6.0-with tools stack (you can read this as
    the JBoss stack of the Java EE 6 APIs, with some extras tools for your project, such
    as Arquillian for testing) -->
<dependency>
    <groupId>org.jboss.bom</groupId>
    <artifactId>jboss-javaee-6.0-with-tools</artifactId>
    <version>${javaee6.with.tools.version}</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

Oracle 页面

通过加载标准 Maven 原型所包含的 Java EE 6 API 类,您将得到一个奇怪的错误(参见清单 6)。

 <dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
 </dependency>

清单 6:对 API 的不可用引用

Maven 存储库中的标准 Java EE 6 API 由一个工具处理,该工具从字节码中删除方法主体实现,并使 javaee-web-api 依赖项无法用于单元测试。任何从 Java EE 6 API 加载类的尝试都会导致如下错误:

Absent Code attribute in method that is not native or abstract in class file javax/enterprise/util/TypeLiteral

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/enterprise/util/TypeLiteral
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

清单 7:从 Java EE 6 API 加载类导致的错误

您应该用应用程序供应商实现替换 Java EE 6 API 类。对于 GlassFish v3.1,最方便的方法是使用对嵌入式容器的单一依赖:

 <dependency>
    <groupId>org.glassfish.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>3.1</version>
    <scope>provided</scope>
 </dependency>

清单 8:Java EE 6 API 替换

问候,

于 2013-04-19T11:47:54.293 回答