title: Changing Java EE server from GlassFish to Tomcat
body: <p>I developed an applications using Netbeans with JSF, JPA and Primefaces and works fine in GlassFish server. I wanted to deploy in Tomcat server. I changed the server through properties, but the project can not be clean and built successfully. How can I change the server properly?</p>
  
  <p>Details :</p>
  
  <p>Netbeans 7.3</p>
  
  <p>GlassFish 3.1</p>
  
  <p>Tomcat 7</p>
  
  <p>I opened the project with Netbeans.
  Right click the project and the GlassFish is selected as the Server.
  Right clicked and select Clean and Build. It comes as successful.
  Right clicked and select Run. The web applications starts running perfectly.</p>
  
  <p>Then I stopped GlassFish and Started Tomcat through Netbeans servers window.</p>
  
  <p>The righted clicked and select Project Properties. Changed the server to Tomcat.
  Right click and select Clean and Build
  And this error comes. No Dist folder creation as well.</p>
  
  <p>The stack trace is listed below.</p>
  
  <pre><code>An annotation processor threw an uncaught exception.
  Consult the following stack trace for details.
  java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.faces.event.AjaxBehaviorEvent not found
  at     org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407)
  at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
  at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
  at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
  at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
  at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
  at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
  at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
  at com.sun.tools.javac.main.Main.compile(Main.java:439)
  at com.sun.tools.javac.main.Main.compile(Main.java:353)
  at com.sun.tools.javac.main.Main.compile(Main.java:342)
  at com.sun.tools.javac.main.Main.compile(Main.java:333)
  at com.sun.tools.javac.Main.compile(Main.java:76)
  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.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
  at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1153)
  at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:930)
  at org.netbeans.modules.java.source.ant.JavacTask.execute(JavacTask.java:145)
  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  at org.apache.tools.ant.Task.perform(Task.java:348)
  at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  at org.apache.tools.ant.Task.perform(Task.java:348)
  at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
  at org.apache.tools.ant.Task.perform(Task.java:348)
  at org.apache.tools.ant.Target.execute(Target.java:392)
  at org.apache.tools.ant.Target.performTasks(Target.java:413)
  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
  at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
  at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
  at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:283)
  at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:541)
  at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
  Caused by: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.faces.event.AjaxBehaviorEvent not found
  C:\Users\Buddhika\Documents\ho\HealthOffice\nbproject\build-impl.xml:887: The following error occurred while executing this line:
  C:\Users\Buddhika\Documents\ho\HealthOffice\nbproject\build-impl.xml:309: Compile failed; see the compiler error output for details.
  BUILD FAILED (total time: 2 seconds)
  </code></pre>