5

I am using JSF 2.0 with Primefaces 3.4.2, Hibernate 4 Final and Spring 3.

When I am deploying an application to Weblogic 10.3.6 using Maven 3 I am getting the following excpetions. How can I resolve this issue?

Any help is highly appreciable.

Target state: deploy failed on Server mgdserver
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/faces/webapp/FacesServlet, method=<init>()V, pc=0
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBu
ilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBu
ilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter
.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Jacob
  • 14,463
  • 65
  • 207
  • 320
  • Indicates that your build references code constructs that don't have the actual code in them. [This article](http://www.mkyong.com/hibernate/java-lang-classformaterror-absent-code-attribute-in-method-that-is-not-native-or-abstract-in-class-file/) gives further direction. Ultimately, you'll need to install the proper JavaEE SDK – kolossus May 29 '13 at 12:33
  • @kolossus I am deploying to our Weblogic Apps Server and it is using IBM JDK 1.7. Does that cause any issues? – Jacob May 29 '13 at 12:39
  • @kolossus When I changed from `compile` to `provided` then problem resolved and [this](http://stackoverflow.com/questions/16811674/error-while-deployment-java-lang-classnotfoundexception-org-hibernate-ejb-hiber) issue occured. – Jacob May 29 '13 at 12:43
  • @kolossus if I would want to use javee for 5 which version of JavaEE SDK should I download? – Jacob May 29 '13 at 12:49
  • I don't think JavaEE 5 is still supported. [Use 6](http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-downloads-439814.html) instead. But it seems you've resolved the issue with the compile directive anyway – kolossus May 29 '13 at 16:40
  • @kolossus If you post as an answer I will be glad to accept it. Thanks – Jacob May 30 '13 at 09:46
  • 1
    Thanks, but I can't take credit for the `` directive fix. That was all you man :) – kolossus May 30 '13 at 13:17

2 Answers2

1

I had the same exception when I tried to run unit tests, the solution for me was to exclude javaee-api from dependencies:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <classpathDependencyExcludes>
            <classpathDependencyExclude>javax:javaee-api</classpathDependencyExclude>
          </classpathDependencyExcludes>
        </configuration>
      </plugin>
rgrebski
  • 2,354
  • 20
  • 29
0

Not exactly related to JSF, but what worked for me was to move the javax.javaee-api dependency below the container implementation dependency.

charlb
  • 1,076
  • 9
  • 18
  • 2
    In the maven POM? I doubt that was the real solution. Might be that changing this forced maven to reload things. But this being the answer to the problem in the question is difficult to understand or believe – Kukeltje Jul 20 '16 at 10:28