Generate Java bindings with Apache CXF error: not mapped to Enum due to EnumMemberSizeCap limit 

Joined:
04/09/2007
Posts:
784

June 04, 2014 16:56:56    Last update: June 04, 2014 16:56:56
The error was something like this:
Simple type "ExtraLongEnumListType" was not mapped to Enum due to EnumMemberSizeCap limit. 
Facets count: 298, current limit: 256. You can use customization attribute "typesafeEnumMaxMembers" to
extend the limit.


Solution: create a binding file to increase the EnumMemberSizeCap limit.

The POM file:
<dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>2.7.3</version>
</dependency>

<profiles>
	<profile>
	    <id>gen-ws-stubs</id>
	    <build>
		<plugins>
		    <plugin>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-codegen-plugin</artifactId>
			<version>${apache.cxf.version}</version>
			<executions>
			    <execution>
				<id>generate-sources</id>
				<phase>generate-sources</phase>
				<configuration>
				    <defaultOptions>
                                    <bindingFiles>
                                        <bindingFile>${basedir}/src/main/jaxb/bindings.xml</bindingFile>
                                    </bindingFiles>
                                    </defaultOptions>
				    <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
				    <includes>
					<include>**/*.wsdl</include>
				    </includes>
				</configuration>
				<goals>
				    <goal>wsdl2java</goal>
				</goals>
			    </execution>
			</executions>
		    </plugin>
		</plugins>
	    </build>
	</profile>
</profiles>


Contents of bindings.xml:
<jaxb:bindings
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    jaxb:extensionBindingPrefixes="xjc"
    jaxb:version="1.0">
    <jaxb:globalBindings typesafeEnumMaxMembers="2000">
	<xjc:serializable/>
    </jaxb:globalBindings>
</jaxb:bindings>
Share |
| Comment  | Tags