玻璃鱼 3.1 + MyFaces - 类格式错误

发布于 2024-12-13 08:36:30 字数 2154 浏览 3 评论 0原文

我正在尝试使用 MyFaces 覆盖 Glassfish 中的 Mojarra。我已将 myfaces-impl 依赖项放入 Maven 中,并删除了 RI 依赖项 - jsf-api.jarjsf-impl.jar。我还很好地要求 Glassfish 使用捆绑的 JSF 实现,如 此处< /a> 在 glassfish-web.xml 中使用这些行:

<glassfish-web-app error-url="">
    <context-root>/Grandis</context-root>
    <class-loader delegate="false" />
    <property name="useBundledJsf" value="true"/>
</glassfish-web-app>

但是,当我尝试部署应用程序时,出现以下错误:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:927)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1486)

我还尝试下载 MyFaces罐子(myfaces-2.1.3.jarmyfaces-api-2.1.3.jarmyfaces-bundle-2.1.3.jar和一堆 apache commons 库)手动并将它们放入应用程序的类路径中。相同的结果。

有什么想法吗?

更新:当我通过maven添加依赖项时,在WAR内发布WEB-INF/lib的内容(仅不包括我自己的jar):

commons-beanutils-1.8.3.jar
commons-codec-1.3.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-logging-1.1.1.jar
javaee-api-6.0.jar
jstl-1.1.2.jar
log4j-1.2.16.jar
myfaces-api-2.1.3.jar
myfaces-impl-2.1.3.jar
org.eclipse.persistence.antlr-2.0.0.jar
org.eclipse.persistence.asm-2.0.0.jar
org.eclipse.persistence.core-2.0.0.jar
org.eclipse.persistence.jpa-2.0.0.jar
prettyfaces-jsf2-3.3.0.jar
primefaces-3.0.M4-SNAPSHOT.jar
standard-1.1.2.jar
xpp3_min-1.1.4c.jar
xstream-1.3.1.jar

I am trying to override Mojarra in Glassfish with MyFaces. I have put myfaces-impl dependency in maven and removed the RI dependencies - jsf-api.jar and jsf-impl.jar. I've also asked Glassfish nicely to use bundled JSF implementation as shown in here using these lines in glassfish-web.xml:

<glassfish-web-app error-url="">
    <context-root>/Grandis</context-root>
    <class-loader delegate="false" />
    <property name="useBundledJsf" value="true"/>
</glassfish-web-app>

However, when I try to deploy the application I get the following error:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:927)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1486)

I also tried downloading MyFaces jars(myfaces-2.1.3.jar, myfaces-api-2.1.3.jar, myfaces-bundle-2.1.3.jar and a bunch of apache commons libraries) manually and putting them in the classpath of application. Same result.

Any ideas?

UPDATE: Posting the contents of WEB-INF/lib inside WAR when I add dependency through maven (excluding only my own jars):

commons-beanutils-1.8.3.jar
commons-codec-1.3.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-logging-1.1.1.jar
javaee-api-6.0.jar
jstl-1.1.2.jar
log4j-1.2.16.jar
myfaces-api-2.1.3.jar
myfaces-impl-2.1.3.jar
org.eclipse.persistence.antlr-2.0.0.jar
org.eclipse.persistence.asm-2.0.0.jar
org.eclipse.persistence.core-2.0.0.jar
org.eclipse.persistence.jpa-2.0.0.jar
prettyfaces-jsf2-3.3.0.jar
primefaces-3.0.M4-SNAPSHOT.jar
standard-1.1.2.jar
xpp3_min-1.1.4c.jar
xstream-1.3.1.jar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2024-12-20 08:36:30

/WEB-INF/lib 中的 JAR 列表中:

  • javaee-api-6.0.jar

删除它。不仅 Glassfish 已经 附带了它(我不使用 Maven,但从我读到的内容来看,您应该将其标记为 provided),而且它还包含Mojarra(JSF 参考实现)库也解释了您的问题。它与 MyFaces 库冲突。

此外,Glassfish 还已经附带 JPA 和 JSTL(1.2!),因此也将它们从构建中删除。

  • jstl-1.1.2.jar
  • org.eclipse.persistence.antlr-2.0.0.jar
  • org.eclipse.persistence.asm-2.0.0.jar
  • org.eclipse.persistence.core-2.0.0.jar
  • org.eclipse.persistence.jpa-2.0.0.jar
  • 标准-1.1.2.jar

From your JAR listing in /WEB-INF/lib:

  • javaee-api-6.0.jar

Remove this. Not only Glassfish already ships with it (I don't do Maven, but from what I've read is that you should mark it as provided), but this also contains Mojarra (the JSF reference implementation) libraries as well which in turn explains your problem. It was conflicting with MyFaces libraries.

Further, Glassfish also already ships with JPA and JSTL (1.2!), so remove them from the build as well.

  • jstl-1.1.2.jar
  • org.eclipse.persistence.antlr-2.0.0.jar
  • org.eclipse.persistence.asm-2.0.0.jar
  • org.eclipse.persistence.core-2.0.0.jar
  • org.eclipse.persistence.jpa-2.0.0.jar
  • standard-1.1.2.jar
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文