I am trying to deploy my application in WAS 8.5 server, but I see something very weired happending. When I use the below jar while building , the application builds along with my wsdl without any issue. But it fails during deployment in WAS 8.5 server. WAS 8.5.5.3 is using jdk 1.6.0.
Dependency used:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>provided</scope>
</dependency>
My investigation conclude that the wsdl generated from the Endpoint Service during maven build needs the validation api but have to keep the scope as provided, as this jars are provided by WAS server at runtime.
The above configuration gives the below error.
[7/24/16 10:10:25:501 IST] 00000063 WASWSDLGenera E WSWS7054E: The Web Services Description Language (WSDL) file could not be generated for the com.hex.rbm.erds.ws.endpoint.impl.EntitySearchServiceEndpoint Web service implementation class because of the following error: java.lang.ArrayStoreException
[7/24/16 10:10:25:507 IST] 00000063 WSModuleDescr E WSWS7027E: JAX-WS Service Descriptions could not be correctly built because of the following error: javax.xml.ws.WebServiceException: WSWS7054E: The Web Services Description Language (WSDL) file could not be generated for the com.hex.rbm.erds.ws.endpoint.impl.EntitySearchServiceEndpoint Web service implementation class because of the following error: java.lang.ArrayStoreException
at com.ibm.ws.websvcs.wsdl.WASWSDLGenerator.generateWsdl(WASWSDLGenerator.java:268)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.generateWSDL(EndpointDescriptionImpl.java:2084)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:449)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>(ServiceDescriptionImpl.java:401)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>(ServiceDescriptionImpl.java:297)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescriptionFromDBCMap(DescriptionFactoryImpl.java:277)
at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescriptionFromDBCMap(DescriptionFactory.java:524)
at com.ibm.ws.websvcs.desc.WSModuleDescriptorImpl.buildJAXWSServices(WSModuleDescriptorImpl.java:1345)
at com.ibm.ws.websvcs.desc.WSModuleDescriptorImpl._containsJAXWSWebServices(WSModuleDescriptorImpl.java:519)
at com.ibm.ws.websvcs.desc.WSModuleDescriptorImpl.containsJAXWSWebServices(WSModuleDescriptorImpl.java:494)
at com.ibm.ws.websvcs.deploy.WSCacheWriter.writeModuleCache(WSCacheWriter.java:571)
at com.ibm.ws.websvcs.deploy.WSCacheWriter.writeApplicationCache(WSCacheWriter.java:242)
at com.ibm.ws.websvcs.deploy.WSCacheWriter.writeApplicationCache(WSCacheWriter.java:167)
at com.ibm.ws.websvcs.deploy.PersistentStorageInstallSaveTask.performTask(PersistentStorageInstallSaveTask.java:196)
at com.ibm.ws.management.application.sync.AppBinaryProcessor$ExpandApp.expand(AppBinaryProcessor.java:1711)
at com.ibm.ws.management.application.sync.AppBinaryProcessor.postProcessSynchronousExt(AppBinaryProcessor.java:751)
at com.ibm.ws.management.bla.sync.BLABinaryProcessor.postProcess(BLABinaryProcessor.java:599)
at com.ibm.ws.management.bla.sync.BLABinaryProcessor.onChangeCompletion(BLABinaryProcessor.java:476)
at com.ibm.ws.management.bla.sync.BinaryProcessorWrapper.onChangeCompletion(BinaryProcessorWrapper.java:109)
at com.ibm.ws.management.repository.FileRepository.postNotify(FileRepository.java:1938)
at com.ibm.ws.management.repository.FileRepository.update(FileRepository.java:1442)
at com.ibm.ws.management.repository.client.LocalConfigRepositoryClient.update(LocalConfigRepositoryClient.java:189)
at com.ibm.ws.sm.workspace.impl.WorkSpaceMasterRepositoryAdapter.update(WorkSpaceMasterRepositoryAdapter.java:665)
at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.update(RepositoryContextImpl.java:1998)
at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.synch(RepositoryContextImpl.java:1946)
at com.ibm.ws.sm.workspace.impl.WorkSpaceImpl.synch(WorkSpaceImpl.java:549)
at com.ibm.ws.console.core.action.SyncWorkSpaceAction.execute(SyncWorkSpaceAction.java:271)
at org.apache.struts.action.RequestProcessor.processActionPerform(Unknown Source)
at org.apache.struts.action.RequestProcessor.process(Unknown Source)
at org.apache.struts.action.ActionServlet.process(Unknown Source)
at org.apache.struts.action.ActionServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at com.ibm.ws.console.core.servlet.WSCUrlFilter.setUpCommandAssistance(WSCUrlFilter.java:955)
at com.ibm.ws.console.core.servlet.WSCUrlFilter.continueStoringTaskState(WSCUrlFilter.java:504)
at com.ibm.ws.console.core.servlet.WSCUrlFilter.doFilter(WSCUrlFilter.java:325)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3878)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:461)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:528)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:314)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)
Caused by: java.lang.ArrayStoreException
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:665)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:472)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:298)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:234)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:81)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:64)
at com.ibm.oti.reflect.AnnotationParser.parseAnnotations(AnnotationParser.java:63)
at java.lang.Class.getDeclaredAnnotations(Class.java:1879)
at java.lang.Class.getAnnotations(Class.java:1836)
at java.lang.Class.getAnnotation(Class.java:1816)
at com.ibm.jtc.jax.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getClassAnnotation(RuntimeInlineAnnotationReader.java:106)
at com.ibm.jtc.jax.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getClassAnnotation(RuntimeInlineAnnotationReader.java:57)
at com.ibm.jtc.jax.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:329)
at com.ibm.jtc.jax.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:483)
at com.ibm.jtc.jax.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:319)
at com.ibm.jtc.jax.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1178)
at com.ibm.jtc.jax.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:194)
at com.ibm.jtc.jax.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:111)
at com.ibm.jtc.jax.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:109)
at com.ibm.jtc.jax.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:161)
at com.ibm.jtc.jax.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:154)
at java.security.AccessController.doPrivileged(AccessController.java:327)
at com.ibm.jtc.jax.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
at com.ibm.jtc.jax.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:94)
at com.ibm.jtc.jax.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:258)
at com.ibm.jtc.jax.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:248)
at com.ibm.jtc.jax.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:123)
at com.ibm.jtc.jax.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactoryImpl.java:61)
at com.ibm.jtc.jax.tools.ws.spi.WSToolsObjectFactory.wsgen(WSToolsObjectFactory.java:107)
at com.ibm.ws.websvcs.wsdl.WASWSDLGenerator.wsgen(WASWSDLGenerator.java:610)
at com.ibm.ws.websvcs.wsdl.WASWSDLGenerator.generateWsdl(WASWSDLGenerator.java:245)
... 62 more
But when I remove the provided scope , I am able to deploy without error. But we not suppose to use the validation api jar due to the requirement.
Can anyone help me what can be done to make this work with the scope as provided , I tried to use higher version of this jar but that did'nt help.
Temporarily I disabled the com.ibm.ws.beanvalidation
but that is not the correct way.
Hi Scott, Tried to generate wsdl using the wsgen where I use: %Java_Home% as \IBM\WebSphere\AppServer\java. But no issue during the build and it geneates without any issue.
%Java_Home%\bin\wsgen -d target\classes -cp target\classes;%Nexus_Home%\org\springframework\spring-web\3.0.4.RELEASE\spring-web-3.0.4.RELEASE.jar;%Nexus_Home%\org\springframework\spring-beans\3.0.4.RELEASE\spring-beans-3.0.4.RELEASE.jar;%Nexus_Home%\com\hex\cobam\rds\cobam-rds-services\2.14.0-SNAPSHOT\cobam-rds-services-2.14.0-SNAPSHOT.jar;%Nexus_Home%\com\hex\cobam\core\cobam-core-domain\1.0.64\cobam-core-domain-1.0.64.jar;%Nexus_Home%\com\hex\cobam\rds\cobam-rds-domain\2.4.0-SNAPSHOT\cobam-rds-domain-2.4.0-SNAPSHOT.jar;%Nexus_Home%\com\hex\cobam\core\cobam-core-exception\1.0.20\cobam-core-exception-1.0.20.jar;%Nexus_Home%\joda-time\joda-time\2.9.4\joda-time-2.9.4.jar;%Java_Home%\jre\..\lib\tools.jar -wsdl -r target\classes com.hex.cobam.rds.ws.endpoint.impl.EntitySearchServiceEndpoint
The endpoint internally calls this class which uses validation api:
import javax.validation.ConstraintViolation;
import javax.xml.ws.WebFault;
@WebFault(faultBean = "com.hex.bam.core.exception.BusinessError", name = "searchRequestValidationException", targetNamespace = RDS_SERVICE_NAMESPACE)
public class SearchRequestValidationException extends BamBusinessException {
public SearchRequestValidationException(Set<ConstraintViolation<Criteria>> constraintViolations) {
super(constraintViolations);
}
Adding some more details to it:
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
public abstract class BamBusinessException extends Exception {
private static final long serialVersionUID = 1L;
protected <C> BamBusinessException(Set<ConstraintViolation<C>> constraintViolations) {
error = ErrorFactory.buildBusinessError(this, constraintViolations);
}
}
public class ErrorFactory {
public static <T extends BamBusinessException, C> BusinessError buildBusinessError(
T exception, Set<ConstraintViolation<C>> constraintViolations) {
BusinessError error = buildBusinessError(exception);
List<BasicConstraintViolation> violations = new ArrayList<BasicConstraintViolation>();
if (constraintViolations != null) {
for (ConstraintViolation<C> violation : constraintViolations) {
violations.add(parse(violation));
}
}
error.setConstraintViolationList(violations);
return error;
}
}
import static com.hex.bam.core.dto.NamespaceConstants.CORE_DTO_NAMESPACE;
import javax.xml.bind.annotation.XmlType;
@XmlType(namespace = CORE_DTO_NAMESPACE)
public class BasicConstraintViolation {
private String propertyPath;
private String resourceKey;
public void setPropertyPath(String propertyPath) {
this.propertyPath = propertyPath;
}
public void setResourceKey(String resourceKey) {
this.resourceKey = resourceKey;
}
public String getResourceKey() {
return resourceKey;
}
public String getPropertyPath() {
return propertyPath;
}
@Override
public String toString() {
return "{" + getPropertyPath() + ":::" + getResourceKey() + "}";
}
import javax.jws.HandlerChain;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
@HandlerChain(file = "../../../../../../../handler-chain.xml")
@javax.jws.WebService(endpointInterface = ENDPOINT_INTERFACE, targetNamespace = RDS_SERVICE_NAMESPACE, serviceName = SERVICE_NAME, portName = PORT_NAME)
@XmlSeeAlso({ com.hex.bam.rds.domain.Organisation.class, com.hex.bam.rds.domain.Individual.class })
public class EntitySearchServiceEndpoint extends SpringBeanAutowiringSupport implements EntitySearchService {
@Autowired
private SearchService searchService;
@Autowired
private AuthenticationService authenticationService;
@Autowired
private ModelSupportService defaultModelSupportService;
@Autowired
private RegulatoryClassificationService regulatoryClassificationService;
@Override
public IndividualSearchResults findIndividuals(IndividualSearchCriteria individualSearchCriteria,
ClientIdentification clientIdentification) throws CobamSystemException, SearchRequestValidationException {
try {
authenticationService.authenticateOnBehalfOfUser(clientIdentification);
assertParameterSuppliedThrowsSearchRequestValidationException(individualSearchCriteria);
defaultModelSupportService.initialiseReferenceDatum(individualSearchCriteria, TreeWalker.MAX_DEPTH);
return searchService.findIndividuals(individualSearchCriteria);
} catch (RuntimeException runtimeException) {
throw ErrorFactory.buildAndLogCobamSystemException(runtimeException);
}
}
}
@WebService(name = "EntitySearchService", targetNamespace = RDS_SERVICE_NAMESPACE)
@SOAPBinding(parameterStyle = ParameterStyle.BARE)
@XmlSeeAlso({ Individual.class, Organisation.class })
public interface EntitySearchService {
@WebMethod(operationName = "findOrganisations", action = RDS_SERVICE_NAMESPACE + "findOrganisations")
@WebResult(name = "organisationSearchResults", targetNamespace = ERDS_SERVICE_NAMESPACE)
OrganisationSearchResults findOrganisations(
@WebParam(name = "organisationSearchCriteria") OrganisationSearchCriteria organisationSearchCriteria,
@WebParam(name = "findOrganisationsClientIdentification", header = true) ClientIdentification clientIdentification)
throws BamSystemException, SearchRequestValidationException;
}
import java.util.Date;
import java.util.List;
import javax.xml.bind.annotation.XmlType;
import com.hex.bam.core.dto.BasicConstraintViolation;
@XmlType(name = "businessError", namespace = EXCEPTION_NAMESPACE)
public class BusinessError extends Error {
private final List<BasicConstraintViolation> constraintViolationList;
public BusinessError(Date occuredAt, String resourceKey, String guid,
List<BasicConstraintViolation> constraintViolationList) {
super(occuredAt, resourceKey, guid);
this.constraintViolationList = constraintViolationList;
}
public List<BasicConstraintViolation> getConstraintViolationList() {
return constraintViolationList;
}
@Override
public String toString() {
String violations = constraintViolationList != null ? constraintViolationList.toString() : " none ";
return getGuid() + " - Business Error - " + getResourceKey() + " [" + violations + "]";
}
}