Glassfish4 EE JSF java.lang.ClassNotFoundException: javax.faces.webapp.JSFServlet - jsf-2

I can't seem to figure this one out...
When deploying a JSF web app Glassfish complains about not being able to find JSFSServlet.
It's Glassfish 4 EE and I checked that c:/glassfish4/glassfish/modules contains javax.faces.jar.
My webapp doesn't have a JSF jar included in the WEB-INF/lib so there is no clash with the jar on the glassfish server.
I've re-installed my JDK and re-set my JAVA_HOME & path environment variables. Confirmed these are working by running java -version & javac -version from the command prompt which indicate I am running JDK1.7.25.
I've tried running Glassfish by:
1) Using eclipse (pointing to the correct JDK)
2) Standalone with WAR
And I get the same result!
What may be related is the install failed for Glassfish with the "requires version 1.6 or above" message and I had to install using glassfish-4-install.exe -j %JAVA_HOME%
Any help would be much appreciated! Here is the stack trace from glassfish:
2013-10-28T11:35:36.815+0200|SEVERE: Exception during lifecycle processing
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.ClassNotFoundException: javax.faces.webapp.JSFServlet
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)

SOLVED! Eclipse was listing javax.faces.JSFServlet as the class for JSF.
Changed this to javax.faces.webapp.FacesServlet!

Related

Cannot `run-app` from intellij

Cannot run-app from intellij 14, I am using grails 2.5.0
run-app outside intellij works!!
Error
"C:\Program Files\Java\jdk1.8.0_45\bin\java" -Dgrails.home=C:\opt\grails-2.5.3 -Dbase.dir=C:\Projects\SIM "-Dtools.jar=C:\Program Files\Java\jdk1.8.0_45\lib\tools.jar" -Dgroovy.starter.conf=C:\opt\grails-2.5.3/conf/groovy-starter.conf -Djline.WindowsTerminal.directConsole=false -javaagent:C:\opt\grails-2.5.3\lib\org.springframework\springloaded\jars\springloaded-1.2.4.RELEASE.jar -noverify -Dspringloaded=profile=grails;cacheDir=. -Dgrails.project.fork.run.debugArgs=-Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=1326 -Dgrails.project.fork.test.debugArgs=-Xrunjdwp:transport=dt_socket,server=n,suspend=n,address=1326 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\lib\util.jar" -Dfile.encoding=UTF-8 com.intellij.rt.execution.CommandLineWrapper C:\Users\shay\AppData\Local\Temp\classpath0.tmp org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\opt\grails-2.5.3/conf/groovy-starter.conf "run-app -plain-output"
java.lang.NoClassDefFoundError: org/springsource/loaded/ri/ReflectiveInterceptor
Error starting Grails: org/springsource/loaded/ri/ReflectiveInterceptor
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:224)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:46)
Caused by: java.lang.ClassNotFoundException: org.springsource.loaded.ri.ReflectiveInterceptor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more
Process finished with exit code 1
Re-importing the project and changing to grails 2.5.3 fixed it.
In my case I could not change grails version due to project requirements.
When changed version from latest to jdk1.8.0_65 all became normal. So have a look if you did upgrade java or having latest one (8.0_111 in my case).
I have the same problem, I just click event log (in the button right angle) and click Configure Grails SDK select grails SDK and it start work.

Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.grails.cli.support.GrailsStarter in Intellij using grails 3.0.0

I imported a Grails project in IntelliJ 14.1 and I got this exception when I tried to run the project using run-app command:
C:\Program Files\Java\jdk1.8.0_40\bin\java" -Dgrails.home=C:\grails-3.0.0 -Dbase.dir=E:\Aurora\Cloned\funned\src300\papafund-web "-Dtools.jar=C:\Program Files\Java\jdk1.8.0_40\lib\tools.jar" -Dgroovy.starter.conf=C:\grails-3.0.0/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -Djline.WindowsTerminal.directConsole=false -javaagent:C:\grails-3.0.0\lib\org.springframework\springloaded\jars\springloaded-1.2.3.RELEASE.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.1\bin" -Dfile.encoding=windows-1252 -classpath "C:\grails-3.0.0\dist\grails-bootstrap-3.0.0.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\grails-3.0.0/conf/groovy-starter.conf "run-app -plain-output"
Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.grails.cli.support.GrailsStarter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0
Process finished with exit code 1
IntelliJ doesn't support Grails 3 yet - it has been requested in their bug tracker.
You can easily run the app from a commandline and use the IDE as an editor.
Intellij Idea 15 supports Grails 3 or higher. You can see from the following:
https://www.jetbrains.com/help/idea/2016.1/getting-started-with-grails-3.html

Cannot build maven application on Jenkins with JDK1.5

I am trying to build a maven 2.2.1 project on Jenkins ver. 1.596. The project uses JDK 1.5 and it is not an option to upgrade to a newer JDK.
When building the project I get the following stacktrace:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at hudson.maven.agent.Main.main(Main.java:143)
at hudson.maven.agent.Main.main(Main.java:68)
I have seen a lot of posts about this issue with Jenkins and JDK1.5, but noone has come up with a solution. Hope that somebody has found a workaround.
Regards
Steffen

How To Run Grails 2.4.1 With Servlet 2.5

Grails version 2.4.1 was recently released. One of the bugs fixed was restoring the ability to use servlet version 2.5. See https://jira.grails.org/browse/GRAILS-11466
I created a new grails app. Without changing anything, I was able to compile it and run it. When I changed the grails.servlet.version to "2.5", I was able to compile but when I ran it I got the the following stack trace error.
Does anyone know if there are other settings I need to change to get Grails 2.4.1 to run on a servlet 2.5 container? Specifically, tomcat 6.
Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
Caused by: java.lang.reflect.InvocationTargetException
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1002)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Lorg/codehaus/groovy/grails/plugins/web/async/api/ControllersAsyncApi;
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredFields(ReflectiveInterceptor.java:1593)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.plugins.web.async.api.ControllersAsyncApi
... 21 more
Error |
Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
Error |
Forked Grails VM exited with error
Process finished with exit code 1
This error would happen if you didn't do a grails clean prior to running Grails after changing the version to 2.5
What happens is that when the version is 3.0 Grails adds extra dependencies to the classpath that result in new behaviour being added to the compiled classes.
If you then change the version to 2.5 and just do run-app the extra dependencies are gone, but the new behaviour is still compiled into the classes. Doing a clean resolve this.

workspace corrupted grails 2.2.4, Intellij Idea 12.1.4, Windows 7

Somehow my workspace is corrupted. When I try to run my app in the intellij IDEA I get the following error:
"C:\Program Files\Java\jdk1.7.0_40\bin\java" -Dgrails.home=C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4 -Dbase.dir=C:\catalysts\src\mediacenter\mm-web "-Dtools.jar=C:\Program Files\Java\jdk1.7.0_40\lib\tools.jar" -Dgroovy.starter.conf=C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -Djline.WindowsTerminal.directConsole=false -javaagent:C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4\lib\org.springsource.springloaded\springloaded-core\jars\springloaded-core-1.1.3.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\bin" -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\lib\util.jar" -Dfile.encoding=UTF-8 com.intellij.rt.execution.CommandLineWrapper C:\Users\Catalysts\AppData\Local\Temp\classpath4359768120270928639.tmp com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\catalysts\sdks\grails\grails-2.2.4\grails-2.2.4/conf/groovy-starter.conf run-app
Exception in thread "main" java.lang.reflect.InvocationTargetException
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:606)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1259)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:121)
Caused by: java.lang.NoClassDefFoundError: org/springsource/loaded/ri/ReflectiveInterceptor
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.springsource.loaded.ri.ReflectiveInterceptor
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Process finished with exit code 1
Test cases work fine, I also can start the app with run-app in the intellij console (CTRL+Alt+G).
I hope you might can help me.
delete folder ~/.grails/.slcache
I recently was getting the exact same error (latest versions at this time: IDEA 14/grails 2.4.4). After fighting with it for a bit I recalled being asked a question earlier (by IDEA) something about the classpath, which I just blindly answered yes to. Trying to find this setting led me to this question: What does the dynamic.classpath flag do? (IntelliJ project settings)
After editing my .iws file and setting dynamic classpath back to false the 'ClassNotFoundException: org.springsource.loaded.ri.ReflectiveInterceptor' went away.
IntelliJ Idea needs to be upgraded to the last version

Resources