mojohaus / jaxws-maven-plugin

https://www.mojohaus.org/jaxws-maven-plugin/
Apache License 2.0
25 stars 37 forks source link

Issue with Javax Bean Validation #96

Open Dignity93 opened 3 years ago

Dignity93 commented 3 years ago

I'm using codehaus.mojo jaxws-magen-plugin in version 2.6 to generate my wsdl, goal is set to "wsgen":

       <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxws-maven-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <sei>MyWS</sei>
          <genWsdl>true</genWsdl>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>wsgen</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

I also use Javax Bean Validation for validation purposes. Now when i'm setting a "groups" Attribute on an existing Annotation (like @NotNull) everything is perfectly fine. But when i'm setting a "groups" Attribute on a self-written Constraint-Annotation, i get following Exception durcing compilation with maven:

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:508)
        at org.codehaus.mojo.jaxws.Invoker.main(Invoker.java:80)
Caused by: com.sun.xml.ws.spi.db.DatabindingException: java.lang.ArrayStoreException
        at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:75)
        at com.sun.xml.ws.spi.db.BindingContextFactory.getBindingContextFromSpi(BindingContextFactory.java:177)
        at com.sun.xml.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:146)
        at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:192)
        at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:165)
        at java.security.AccessController.doPrivileged(AccessController.java:696)
        at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:165)
        at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:80)
        at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:294)
        at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:70)
        at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:44)
        at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:28)
        at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:90)
        at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:209)
        at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:98)
        ... 5 more
Caused by: java.lang.ArrayStoreException
        at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:736)
        at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:543)
        at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:367)
        at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:298)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:132)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:84)
        at java.lang.reflect.AccessibleObject.getAnnotationsFromCache(AccessibleObject.java:313)
        at java.lang.reflect.Field.declaredAnnotations(Field.java:1167)
        at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:1160)
        at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:222)
        at com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getAllFieldAnnotations(RuntimeInlineAnnotationReader.java:43)
        at com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getAllFieldAnnotations(RuntimeInlineAnnotationReader.java:27)
        at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.findFieldProperties(ClassInfoImpl.java:351)
        at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:281)
        at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:156)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:231)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:73)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:54)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:197)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:68)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:54)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:345)
        at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:66)
        at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:43)
        at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:32)
        at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:25)
        at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:48)
        at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:46)
        at java.util.AbstractList$Itr.next(AbstractList.java:369)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:245)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:73)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:54)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:197)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:68)
        at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:54)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:345)
        at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:360)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:435)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:273)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:109)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1126)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:135)
        at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:137)
        at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:81)
        at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:83)
        at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:64)
        ... 19 more

When i either remove the plugin during maven build process or the "groups" attribute from self-written annotations, everything works like a charm.

I already asked an associcated question on Stackoverflow, for more details look up here.

Furthermore i'm working on Java 8 with maven 3.3.9 and on WIN10.