Ws tag prevents startup outside servlet-container environment
alexvigdor opened this issue · 0 comments
alexvigdor commented
The Ws websocket client tag depends on the java websocket API and will break startup if that API is not present, which may be the case outside of a servlet container.
com.disney.groovity.Taggable: Provider com.disney.groovity.tags.Ws could not be instantiated: java.util.ServiceConfigurationError
java.util.ServiceConfigurationError: com.disney.groovity.Taggable: Provider com.disney.groovity.tags.Ws could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at com.disney.groovity.Taggables.init(Taggables.java:75)
at com.disney.groovity.Groovity.init(Groovity.java:381)
at com.disney.groovity.Groovity.start(Groovity.java:441)
at com.disney.groovity.GroovityBuilder.build(GroovityBuilder.java:342)
at com.disney.groovity.GroovityBuilder.build(GroovityBuilder.java:251)
at com.disney.groovity.aws.lambda.GroovityAwsLambda.<init>(GroovityAwsLambda.java:70)
at com.disney.groovity.aws.lambda.GroovityAwsLambda.<init>(GroovityAwsLambda.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
Caused by: java.lang.NoClassDefFoundError: javax/websocket/ClientEndpointConfig$Configurator
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 13 more
Caused by: java.lang.ClassNotFoundException: javax.websocket.ClientEndpointConfig$Configurator
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 18 more
While this can be worked around by explicitly importing javax.websocket-client-api as a dependency, it might make sense to move the Ws tag out of groovity-core, either into groovity-servlet or a standalone module.