1
votes

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
1
Please list the JARs which have ended up in /WEB-INF/lib of the WAR build.BalusC

1 Answers

0
votes

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