2 Replies Latest reply on Apr 23, 2009 10:48 PM by Daniel Bevenius

    JBossAS5 deployers for JBossESB 4.x

    Daniel Bevenius Master

      Background
      In the ESB you can specify that a service should be exposed as a WS. Upon deploying the service a web-app will get generated
      and deployed. As part of this process a number of files get generated, like the servlet, jaxws handlerchain, wsdl file.
      In JBoss AS 4.x this was done by actually creating a .war file on the local filesystem, but in AS5 it is done by using a
      number of deployers.

      I'm having a problem with making a generated wsdl available the WS deployer. Following are the details of this issue.

      One of our deployers has the responsibility of generating the WSDL file and also putting it into an in-memory virtual file system:

      public class EsbWsdlDeployer extends AbstractSimpleVFSRealDeployer<EsbMetaData>
      {
       /** Logger */
       private Logger log = Logger.getLogger(EsbWsdlDeployer.class);
      
       /**
       * No-args constructor.
       */
       public EsbWsdlDeployer()
       {
       super(EsbMetaData.class);
       setStage(DeploymentStages.POST_CLASSLOADER);
       setOutput(JSEArchiveMetaData.class);
       setOutput(EsbMetaData.class);
       }
      
       @Override
       public void deploy(final VFSDeploymentUnit deploymentUnit, final EsbMetaData esbMetaData) throws DeploymentException
       {
       final List<WebserviceInfo> endpointServices = esbMetaData.getModel().getWebserviceServices();
       if (endpointServices != null && endpointServices.size() > 0)
       {
       log.info("Deploying webservices for : " + esbMetaData.getDeploymentName() + ", " + deploymentUnit.getClassPath());
      
       try
       {
       URL dynamicClassRoot = new URL("vfsmemory", esbMetaData.getDeploymentName(), "");
      
       for (WebserviceInfo webserviceInfo : endpointServices)
       {
       final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(webserviceInfo);
       final String wsdl = ESBContractGenerator.generateWSDL(webserviceInfo, serviceInfo, deploymentUnit.getClassLoader());
       URL wsdlUrl = new URL(dynamicClassRoot + "/" + serviceInfo.getWSDLFileName());
      
       VirtualFile wsdlFile = MemoryFileFactory.putFile(wsdlUrl, wsdl.getBytes());
       deploymentUnit.addClassPath(wsdlFile);
       URL resource = deploymentUnit.getClassLoader().getResource(serviceInfo.getWSDLFileName());
       log.info("WDSL loaded with classloader: " + resource);
       log.info("WDSL deploymentUnit: " + deploymentUnit.getClassPath());
       log.info("WDSL : " + wsdlUrl);
       }
       }
       catch (final Exception e)
       {
       throw new DeploymentException("Failed to create webservice artifact", e);
       }
       }
       }
      }


      As you can see I'm logging a lot in this deployer to show what is happening:
      09:04:34,793 INFO [EsbWsdlDeployer] Deploying webservices for : Quickstart_publish_as_webservice,
       [
       MemoryContextHandler@6542706[
       path=
       context=vfsmemory://3j011-lnr81b-ftb3s170-1-ftb3sv3i-25
       real=vfsmemory://3j011-lnr81b-ftb3s170-1-ftb3sv3i-25],
      
       DelegatingHandler@5401885[
       path=Quickstart_publish_as_webservice.esb
       context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/
       real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb],
      
       MemoryContextHandler@24755545[
       path= context=vfsmemory://Quickstart_publish_as_webservice
       real=vfsmemory://Quickstart_publish_as_webservice],
      
       MemoryContextHandler@25044741[
       path=WEB-INF/classes
       context=vfsmemory://Quickstart_publish_as_webservice
       real=vfsmemory://Quickstart_publish_as_webservice/WEB-INF/classes]
       ]
      
      09:04:35,130 INFO [EsbWsdlDeployer] WDSL loaded with classloader: vfsmemory://Quickstart_publish_as_webservice/WEB-INF/wsdl/ESBServiceSample/HelloWorldPubService.wsdl
      
      INFO [EsbWsdlDeployer] WDSL deploymentUnit:
       [
       MemoryContextHandler@6542706[
       path=
       context=vfsmemory://3j011-lnr81b-ftb3s170-1-ftb3sv3i-25
       real=vfsmemory://3j011-lnr81b-ftb3s170-1-ftb3sv3i-25],
      
       DelegatingHandler@5401885[
       path=Quickstart_publish_as_webservice.esb
       context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/
       real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb],
      
       MemoryContextHandler@24755545[
       path=
       context=vfsmemory://Quickstart_publish_as_webservice
       real=vfsmemory://Quickstart_publish_as_webservice],
      
       MemoryContextHandler@25044741[
       path=WEB-INF/classes
       context=vfsmemory://Quickstart_publish_as_webservice
       real=vfsmemory://Quickstart_publish_as_webservice/WEB-INF/classes],
      
       MemoryContextHandler@19898723[
       path=WEB-INF/wsdl/ESBServiceSample/HelloWorldPubService.wsdl
       context=vfsmemory://Quickstart_publish_as_webservice
       real=vfsmemory://Quickstart_publish_as_webservice/WEB-INF/wsdl/ESBServiceSample/HelloWorldPubService.wsdl]
       ]
      INFO [EsbWsdlDeployer] WDSL : vfsmemory://Quickstart_publish_as_webservice/WEB-INF/wsdl/ESBServiceSample/HelloWorldPubService.wsdl


      You will also notice that I try loading the wsdl from the deployments classloader to be sure that it has access to the wsdl.

      Next, the following error is recieved during deployment (slightly modified to that it's easier to read the paths):
      ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/ state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/
       at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
       at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
       at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
       at org.jboss.Main.boot(Main.java:209)
       at org.jboss.Main$1.run(Main.java:547)
       at java.lang.Thread.run(Thread.java:595)
      
      Caused by: org.jboss.ws.WSException: Cannot build meta data: Child not found WEB-INF/wsdl/ESBServiceSample/HelloWorldPubService.wsdl for
       DelegatingHandler@6484689[path=Quickstart_publish_as_webservice.esb context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb],
       available children:
       [
       ZipEntryHandler@2915895[path=Quickstart_publish_as_webservice.esb/.classpath context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/.classpath],
      
       ZipEntryHandler@17986284[path=Quickstart_publish_as_webservice.esb/.project context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/.project],
      
       ZipEntryHandler@3603480[path=Quickstart_publish_as_webservice.esb/META-INF context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/META-INF],
      
       ZipEntryHandler@31506190[path=Quickstart_publish_as_webservice.esb/fault.xsd context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/fault.xsd],
      
       ZipEntryHandler@2055214[path=Quickstart_publish_as_webservice.esb/jbmq-queue-service.xml context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/jbmq-queue-service.xml],
      
       ZipEntryHandler@14474074[path=Quickstart_publish_as_webservice.esb/org context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/org],
      
       ZipEntryHandler@29697393[path=Quickstart_publish_as_webservice.esb/request.xsd context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/request.xsd],
      
       ZipEntryHandler@1920726[path=Quickstart_publish_as_webservice.esb/response.xsd context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/response.xsd]]
       at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE.buildMetaData(JAXWSMetaDataBuilderJSE.java:73)
       at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect.start(UnifiedMetaDataDeploymentAspect.java:64)
       at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:129)
       at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:75)
       at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:60)
       at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
       at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
       ... 18 more
      Caused by: java.io.IOException: Child not found WEB-INF/wsdl/ESBServiceSample/HelloWorldPubService.wsdl for
       DelegatingHandler@6484689[path=Quickstart_publish_as_webservice.esb context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb],
       available children:
       [
       ZipEntryHandler@2915895[path=Quickstart_publish_as_webservice.esb/.classpath context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/.classpath],
      
       ZipEntryHandler@17986284[path=Quickstart_publish_as_webservice.esb/.project context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/.project],
      
       ZipEntryHandler@3603480[path=Quickstart_publish_as_webservice.esb/META-INF context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/META-INF],
      
       ZipEntryHandler@31506190[path=Quickstart_publish_as_webservice.esb/fault.xsd context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/fault.xsd],
      
       ZipEntryHandler@2055214[path=Quickstart_publish_as_webservice.esb/jbmq-queue-service.xml context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/jbmq-queue-service.xml],
      
       ZipEntryHandler@14474074[path=Quickstart_publish_as_webservice.esb/org context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/org],
      
       ZipEntryHandler@29697393[path=Quickstart_publish_as_webservice.esb/request.xsd context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/request.xsd],
      
       ZipEntryHandler@1920726[path=Quickstart_publish_as_webservice.esb/response.xsd context=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/ real=file:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/Quickstart_publish_as_webservice.esb/response.xsd]]
       at org.jboss.virtual.VirtualFile.findChild(VirtualFile.java:461)
       at org.jboss.metadata.serviceref.VirtualFileAdaptor.findChild(VirtualFileAdaptor.java:99)
       at org.jboss.wsf.framework.deployment.ArchiveDeploymentImpl.getMetaDataFileURL(ArchiveDeploymentImpl.java:97)
       at org.jboss.ws.metadata.builder.jaxws.JAXWSProviderMetaDataBuilder.buildProviderMetaData(JAXWSProviderMetaDataBuilder.java:125)
       at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupProviderOrWebService(JAXWSServerMetaDataBuilder.java:55)
       at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE.buildMetaData(JAXWSMetaDataBuilderJSE.java:61)
       ... 24 more
      


      Now to me, it looks like when the web service is getting deployed it does not have access to the deploymentunits classpath. It can see all the files in the real .esb archive but not the in-memory files that were created previously by our deployers.

      Any thoughts or suggestions on this?

      /Daniel