I have grails 2.0.4 application with rendering plugin 0.44. It works fine in dev environment, however, fails in production with IncompatibleClassChangeError.
Looked into the jars to see if there are any duplicates or incompatibilities, couldn't trace anything suspicious.
Tried with clean war (grails clean, war) but didn't help.
Both production and development test are running similar setup except java minor versions - java 1.6.0_65 (dev test/mac os) and java 1.6.0_30 (production/cent os).
Any help much appreciated, thanks!
Here is my BuildConfig.groovy:
plugins{
------
compile ":qrcode:0.3"
compile ":rendering:0.4.4"
}
Here is the stack trace:
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [our function] of controller [com.x.ourcontroller] caused exception: Runtime error executing action
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:46)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at java.lang.Thread.run(Thread.java:701)
Caused by: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Runtime error executing action
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
... 7 more
Caused by: java.lang.IncompatibleClassChangeError
at grails.plugin.rendering.document.RenderEnvironment.init(RenderEnvironment.groovy:37)
at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:75)
at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:67)
at grails.plugin.rendering.document.XhtmlDocumentService.generateXhtml(XhtmlDocumentService.groovy:64)
at grails.plugin.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:34)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:36)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:35)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:65)
at RenderingGrailsPlugin$_closure3.doCall(RenderingGrailsPlugin.groovy:59)
at com.xx.yy..
... 7 more
2014-03-19 20:55:52,025 [TP-Processor16] ERROR servlet.GrailsDispatcherServlet - HandlerInterceptor.afterCompletion threw exception
java.lang.IncompatibleClassChangeError
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:46)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at java.lang.Thread.run(Thread.java:701)
2014-03-19 20:55:52,026 [TP-Processor16] ERROR servlet.GrailsDispatcherServlet - HandlerInterceptor.afterCompletion threw exception
java.lang.IncompatibleClassChangeError
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:46)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891) at java.lang.Thread.run(Thread.java:701)
java.lang.IncompatibleClassChangeError was happening due to a conflict between classes across different plugins with respect to MockHttpServletRequest and MockHttpServletResponse classes coming for jax-rs plugin. Tried the latest jax-rs plugin (0.9 for 2.0.x grails) which mentions in release notes that these are removed. However, this version of plugin didn't fix the problem. Manually removed the mock directory under jax-rs plugin from the war and repackaging it as a workaround for now. Removing the mock/* files fixed the problem.
Related
I am migrating grails-2.4.0 from 2.3.2 and jdk-1.8 from 1.7.
I am using this article for migration.
BuildConfig.groovy
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
runtime 'org.springframework:spring-test:3.1.0.RELEASE'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.52.1"
// Default plugins for the compile step
compile ":scaffolding:2.1.0"
compile ':cache:1.1.3'
// Persistency plugins
runtime ":hibernate:3.6.10.14"
// Styling plugins
runtime ':twitter-bootstrap:3.3.4'
runtime ":resources:1.2.14"
runtime ":jquery:1.11.0.2"
// PDF rendering plugins
compile ":rendering:1.0.0"
// Spring security plugins
compile ":spring-security-core:2.0-RC5"
// Uncomment these (or add new ones) to enable additional resources capabilities
runtime ":zipped-resources:1.0.1"
runtime ":cached-resources:1.1"
compile ":cache-headers:1.1.7"
}
Removed grailsResourceLoader from applicationContext.xml
Removed sitemesh filter details from web.xml
When I run the application using grails run-app it is working fine. But when I use update,Sort etc at that time below errors are occur.
Stacktrace
ERROR org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /wba-web/airline/index - parameters:
mode:
modeId:
Stacktrace follows:
org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag <sitemesh:captureContent>: Error executing tag <g:render>: null
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:189)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:53)
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:62)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <sitemesh:captureContent>: Error executing tag <g:render>: null
at airline_index$_run_closure10.doCall(index:26)
at airline_index.run(index:57)
... 8 more
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <g:render>: null
at airline_index$_run_closure10_closure16.doCall(index:25)
... 10 more
Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at grails.util.CacheEntry.getValue(CacheEntry.java:141)
at grails.util.CacheEntry.getValue(CacheEntry.java:81)
... 11 more
Does I miss something to upgrade? or this is bug in my code?
Quick help will highly appreciate.!!!
Please find log here log.txt.
Based on the stacktrace the error is you are passing null value to the render function, when you are hitting /wba-web/airline/index. please copy the full stacktrace for more information.
The latest version of Java have issues with Grails. However 1.8.0_25, 1.8.0_31 versions support 2.4.0. Those above 1.8.0_40 might have issues.
Actually this was the error regarding filter. Every time filter block my request. I made some changes in my custom filter and it works.!
If I leave the "spring-boot-starter-tomcat" plugin dependency set to compile in the gradle build file I get the following error messages deploying to a standalone Tomcat 7 server:
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-core-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Aug 18, 2016 2:51:19 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-el-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
If I change the dependency to provided I can deploy to Tomcat but get the following error attempting to run or debug within IntelliJ IDEA 15:
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [orderserver.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
...
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
How can I exclude these dependencies from the war file generation while retaining the ability to run/debug within IDEA?
Even better is there a way to generate a single war file that has embedded Tomcat for standalone execution that can also be deployed to a Tomcat container?
This issue was resolved by changing the dependency to provided and using a "Grails" run/debug configuration instead of the "Application" configuration that was set when I created the project with IDEA 15.
I trying to run geb and spock tests on Jenkins with grails 2.3.4 but I get error
Error |
Error executing script TestApp: startup failed:
Could not instantiate global transform class
geb.transform.AttributeAccessingMetaClassRegisteringTransformation specified at
jar:file:/var/lib/jenkins/.m2/repository/org/gebish/geb-ast/0.12.0/geb-ast-0.12.0.jar!/
META-INF/services/org.codehaus.groovy.transform.ASTTransformation
because of exception java.lang.ClassNotFoundException:
geb.transform.AttributeAccessingMetaClassRegisteringTransformation
Could not instantiate global transform class
geb.transform.implicitassertions.ImplicitAssertionsTransformation specified at
jar:file:/var/lib/jenkins/.m2/repository/org/gebish/geb-implicit-assertions/0.12.0/
geb-implicit-assertions-0.12.0.jar!/META-INF/services/org.codehaus.groovy.transform.
ASTTransformation because of exception java.lang.ClassNotFoundException:
geb.transform.implicitassertions.ImplicitAssertionsTransformation
How I figure out my Jenkins was using java 6 and grails 2.3.4. When I update java version from 6 to 7 and grails from 2.3.4 to 2.4.5 version all was worked correctly.
I'm using the Grails AWS Plugin: https://github.com/grails-aws/grails-aws on Grails 2.2.2. I can't get the basic S3 File upload to work. I receive the error below:
Error Log:
ERROR (SLF4JBridgeHandler.java:225) - Servlet.service() for servlet [default] in context with path [] threw exception [org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/params/SyncBasicHttpParams] with root cause
java.lang.ClassNotFoundException: org.apache.http.params.SyncBasicHttpParams
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.jets3t.service.utils.RestUtils.createDefaultHttpParams(RestUtils.java:574)
at org.jets3t.service.utils.RestUtils.initHttpConnection(RestUtils.java:298)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.initHttpConnection(RestStorageService.java:209)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.initializeDefaults(RestStorageService.java:166)
at org.jets3t.service.StorageService.<init>(StorageService.java:125)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.<init>(RestStorageService.java:153)
at org.jets3t.service.S3Service.<init>(S3Service.java:91)
at org.jets3t.service.impl.rest.httpclient.RestS3Service.<init>(RestS3Service.java:157)
at org.jets3t.service.impl.rest.httpclient.RestS3Service.<init>(RestS3Service.java:131)
at org.jets3t.service.impl.rest.httpclient.RestS3Service.<init>(RestS3Service.java:109)
at grails.plugin.aws.s3.S3FileUpload.inputStreamUpload(S3FileUpload.groovy:85)
at grails.plugin.aws.util.MetaClassInjector$_injectS3UploadMethods_closure3.doCall(MetaClassInjector.groovy:46)
Here is the BuildConfig:
compile ":aws:1.6.7.5"
Controller:
file.inputStream.s3upload(newFilename) {
path "pictures/"
}
So there's nothing special going on here, just basic configuration, but it doesn't work. Any ideas?
UDPATE:
Ran the dependency report to make sure the app is using HTTPClient 4.2 and it is:
httpclient by org.apache.httpcomponents 4.2 4.1.2
Thanks
The the Grails AWS plugin uses AWS SDK 1.6.7 which is dependent on Apache HttpClient 4.2 as you can tell from Maven.
Please add the following dependency to your BuildConfig.groovy:
runtime 'org.apache.httpcomponents:httpclient:4.2'
I was finally able to get it to work by adding the following to the BuildConfig.groovy:
build 'org.apache.httpcomponents:httpcore:4.2'
build 'org.apache.httpcomponents:httpclient:4.2'
runtime 'org.apache.httpcomponents:httpcore:4.2'
runtime 'org.apache.httpcomponents:httpclient:4.2'
I've followed this tutorial successfully and works good on localhost. It's about using the using the grails rendering plugin. It works good and all on LOCALHOST, but when I deploy the app, or even just run grails run-war, the rendering plugin no longer works. It's giving some weird error. :(
I'm using grails 2.0.0 with rendering plugin 0.4.3 and this is what my BuildConfig.groovy contains:
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.1"
runtime ":resources:1.1.5"
compile ":rendering:0.4.3"
build ":tomcat:$grailsVersion"
}
The error is this:
2012-09-27 17:08:47,714 [http-8643-1] ERROR errors.GrailsExceptionResolver - ClassNotFoundException occurred when processing request: [GET] /profile/renderFormPDF/1
org.springframework.mock.web.MockHttpServletRequest. Stacktrace follows:
java.lang.ClassNotFoundException: org.springframework.mock.web.MockHttpServletRequest
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at grails.plugin.rendering.document.RenderEnvironment.init(RenderEnvironment.groovy:33)
at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:69)
at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:61)
at grails.plugin.rendering.document.XhtmlDocumentService.generateXhtml(XhtmlDocumentService.groovy:68)
at grails.plugin.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:38)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:34)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:33)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:63)
at com.icodeya.ProfileController.renderFormPDF(ProfileController.groovy:108)
at net.stax.appserver.webapp.RequestMonitorValve.invoke(RequestMonitorValve.java:35)
at net.stax.appserver.admin.StaxApplicationQueryValve.invoke(StaxApplicationQueryValve.java:49)
at net.stax.appserver.webapp.RequestSetupValve.invoke(RequestSetupValve.java:31)
at java.lang.Thread.run(Thread.java:662)
That's in the spring-test jar which is in the dev environment but isn't included in the WAR file. Add
runtime 'org.springframework:spring-test:3.1.0.RELEASE'
to the dependencies section of BuildConfig.groovy.