Grails-Plugin-Consortium / grails-cxf

CXF Plugin for the Grails web framework
http://grails.org/plugin/cxf
38 stars 46 forks source link

plugin breaks with grails 3.3.0.M1 #63

Closed tyagiakhilesh closed 6 years ago

tyagiakhilesh commented 7 years ago

I am trying to use this plugin with grails 3.3.0.M1, but because of spring upgrade there, this plugin seems borken. Can we have a fix please ?

java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ServletRegistrationBean
    at grails.cxf.CxfGrailsPlugin$_doWithSpring_closure1.doCall(CxfGrailsPlugin.groovy:59) ~[cxf-3.1.1.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[groovy-2.4.10.jar:2.4.10]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2.4.10.jar:2.4.10]
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) ~[groovy-2.4.10.jar:2.4.10]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027) ~[groovy-2.4.10.jar:2.4.10]
    at groovy.lang.Closure.call(Closure.java:414) ~[groovy-2.4.10.jar:2.4.10]
    at groovy.lang.Closure.call(Closure.java:408) ~[groovy-2.4.10.jar:2.4.10]
    at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:759) ~[grails-spring-3.3.0.M1.jar:3.3.0.M1]
    at grails.spring.BeanBuilder.beans(BeanBuilder.java:588) ~[grails-spring-3.3.0.M1.jar:3.3.0.M1]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:531) ~[grails-spring-3.3.0.M1.jar:3.3.0.M1]
    at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:559) ~[grails-core-3.3.0.M1.jar:3.3.0.M1]
    at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:167) ~[grails-core-3.3.0.M1.jar:3.3.0.M1]
    at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:171) ~[grails-core-3.3.0.M1.jar:3.3.0.M1]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at grails.boot.GrailsApp.run(GrailsApp.groovy:83) [grails-core-3.3.0.M1.jar:3.3.0.M1]
    at grails.boot.GrailsApp.run(GrailsApp.groovy:388) [grails-core-3.3.0.M1.jar:3.3.0.M1]
    at grails.boot.GrailsApp.run(GrailsApp.groovy:375) [grails-core-3.3.0.M1.jar:3.3.0.M1]
    at grails.boot.GrailsApp$run.call(Unknown Source) [grails-core-3.3.0.M1.jar:3.3.0.M1]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.10.jar:2.4.10]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.10.jar:2.4.10]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) [groovy-2.4.10.jar:2.4.10]
    at com.hp.ilm.db.webconsole.Application.main(Application.groovy:8) [main/:?]
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.ServletRegistrationBean
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_121]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_121]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[?:1.8.0_121]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_121]

Quoting from here: org.springframework.boot.context.embedded.ServletRegistrationBean which is no more available on Spring Boot 1.5.0 and onwards releases.

I searched the code of this plugin, and this ineeded is being used.

jarekwas commented 7 years ago

import org.springframework.boot.context.embedded.ServletRegistrationBean Does not exist anymore

You need to change the import to import org.springframework.boot.web.servlet.ServletRegistrationBean

Can you make a change?

tyagiakhilesh commented 7 years ago

@wasowskijarek Done. Please do let me know if anything is missing.

johnkeates commented 7 years ago

This hasn't been added to a release, has it?

jvesouza commented 6 years ago

The same problem using grails 3.3.2.

jvesouza commented 6 years ago

Anyone using this plugin with grails 3.3.2?

johnkeates commented 6 years ago

@juanxo no, because it's broken and nobody is fixing it

jvesouza commented 6 years ago

Is there any other alternative? I need update my application for version 3.3.2 and the application needs to respond to a soap request. Thanks.

johnkeates commented 6 years ago

You'll need to fix grails-cxf or not use it. I got so fed up with it not working that I simply switched to plain Java and rebuilt it in Spring. Works fine.

tyagiakhilesh commented 6 years ago

Moving away to native options might be a better choice in long run. I struggled beyond limits of pain to get webflow plugin working, when I was upgrading my app. I ended up using spring webflow directly in my app. Same goes for this guy I believe.

bilgehanm commented 6 years ago

In CxfGrailsPlugin.groovy file, changing import org.springframework.boot.context.embedded.ServletRegistrationBean with import org.springframework.boot.web.servlet.ServletRegistrationBean

will fix the issue. You can clone the repository and use a local copy with that change until this plugin is updated.

tyagiakhilesh commented 6 years ago

I did raise a PR with that, but then some tests were broken. And I never went back to fix. (or never really got that much time.)