|
I'm having a problem that I don't understand after upgrading an app from 1.3.7 to 2.0.1. The app includes SOAP client code that was generated with CXF 2.1.x. One of the CXF generated classes looks like this:
@XmlType(name = "CharSet") @XmlEnum public enum CharSet { @XmlEnumValue("1046") CHARSET_1046("1046"), @XmlEnumValue("437") CHARSET_437("437"), .... // 500+ more lines of @XmlEnumValues not shown This code is referenced during bootstrap when the CXF port is created and causes this exception: at javax.xml.ws.Service.getPort(Service.java:40) at com.foo.mailingservice.cxf.generated.MailingService_Service.getMailingServicePort(MailingService_Service.java:62) at com.foo.webserviceclient.cxf.ClientSetup.createService(ClientSetup.java:85) at com.foo.proserv.soap.client.MessageStudioService.initMailingService(MessageStudioService.groovy:121) at BootStrap.initMessageStudioService(BootStrap.groovy:63) at BootStrap$_closure1.doCall(BootStrap.groovy:52) ... 8 more Caused by: java.lang.NullPointerException at com.foo.mailingservice.cxf.generated.objects.CharSet.<clinit>(CharSet.java:759) ... 84 more The error is reported at about the 200th of the 500 or so enums in the class. I have no idea what is causing this error, or how to troubleshoot or fix. If anyone has any clues I would appreciate suggestions. As I mentioned above, this code executes fine with Grails 1.3.7 but fails with 2.0.1. Thanks, Brad |
|
You say CahrSet is around 500+ lines but NPE is at line 759 of that
CharSet generated class. Is it possible your class and code are out of sync? I would try to remove all the .class files from grails caches and try to re-generate and re-compile. Otherwise, could you show us CharSet.java (I guess is the file if you generated it with wsdl2java) at line 759. On Wed, Mar 14, 2012 at 2:30 AM, Brad Whitaker <[hidden email]> wrote: > I'm having a problem that I don't understand after upgrading an app from > 1.3.7 to 2.0.1. The app includes SOAP client code that was generated with > CXF 2.1.x. One of the CXF generated classes looks like this: > > @XmlType(name = "CharSet") > @XmlEnum > public enum CharSet { > > @XmlEnumValue("1046") > CHARSET_1046("1046"), > @XmlEnumValue("437") > CHARSET_437("437"), > .... > // 500+ more lines of @XmlEnumValues not shown > > This code is referenced during bootstrap when the CXF port is created and > causes this exception: > > at javax.xml.ws.Service.getPort(Service.java:40) > at > com.foo.mailingservice.cxf.generated.MailingService_Service.getMailingServicePort(MailingService_Service.java:62) > at > com.foo.webserviceclient.cxf.ClientSetup.createService(ClientSetup.java:85) > at > com.foo.proserv.soap.client.MessageStudioService.initMailingService(MessageStudioService.groovy:121) > at BootStrap.initMessageStudioService(BootStrap.groovy:63) > at BootStrap$_closure1.doCall(BootStrap.groovy:52) > ... 8 more > Caused by: java.lang.NullPointerException > at > com.foo.mailingservice.cxf.generated.objects.CharSet.<clinit>(CharSet.java:759) > ... 84 more > > > The error is reported at about the 200th of the 500 or so enums in the > class. I have no idea what is causing this error, or how to troubleshoot or > fix. If anyone has any clues I would appreciate suggestions. As I mentioned > above, this code executes fine with Grails 1.3.7 but fails with 2.0.1. > > Thanks, > > Brad > > -- > View this message in context: http://grails.1312388.n4.nabble.com/cxf-generated-XmlEnum-class-throws-ExceptionInInitializerError-tp4470794p4470794.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Alex,
Thanks for the response. I tried various things and looked a bit deeper at the stack traces and found myself looking at cglib, asm, jaxb, etc. I think I have some incompatible versions of various libraries. (CXF has a lot of dependencies.) I suspect that I need to upgrade to a newer CXF version to be compatible with Grails 2.x. I'm going to stick with 1.3.7 for this app for now and try to upgrade later. Brad |
|
I finally got around to looking into this issue again and determined that the problem is strictly due to "too many" @XmlEnumValue items in the @XmlEnum class. The cxf generated class has 450 entries. If I comment out some entries so that there are only 369 then I have no problem. If I try 370 or more then I get the clinit NPE. I determined through trial and error that it is not any specific entry, but only the total number. (I did not rule out the possibility that the problem is number of characters rather than number of entries.)
I also determined that the problem does not occur with Grails 1.3.x, but only with 2.x. (I created new apps in each version that did nothing beyond instantiating one the enums. It succeeds in the 1.3.x app, but fails in the 2.1.x app.) I tried both apps against JDK 1.6 and 1.7, but the JDK version made no difference. I'm at a total loss to explain this. I can work around this by commenting out 120 entries that aren't likely to be used, but I have no idea what the underlying cause could be. |
|
This issue is finally resolved with Grails 2.1.3 and 2.2.0.RC4 (and perhaps earlier 2.2.0 versions). The root issue was in Spring Loaded and is described in https://issuetracker.springsource.com/browse/STS-2189. The "Trouble loading really big Enums" likely exists in all Grails 2.x versions less than 2.1.3. It does not exist in 1.x.x versions of Grails.
|
|
This bug seems to be a zombie -- it keeps coming back even after it has been killed. I'm having trouble again with this very same large enum class when running in a 2.2.1 Grails app in dev mode using either command line or IntelliJ 12. The same app runs fine with IntelliJ 11. This totally confuses me! I don't even know where to start looking. Any suggestions would be appreciated.
The exception that I get is different from before but it still seems to be a class size issue. Simply instantiating an enum results in this error output: | Server running. Browse to http://localhost:8080/largeEnumBug =============== DEBUG MESSAGE: unimplemented bytecode ================ | Error 2013-03-26 14:44:13,282 [http-bio-8080-exec-9] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /largeEnumBug/problem/charset Stacktrace follows: Message: null Line | Method ->> 760 | <clinit> in mailingservice.cxf.generated.CharSet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 11 | charset in mailingservice.ProblemController | 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Thread |
| Powered by Nabble | Edit this page |
