[jbossws-issues] [JBoss JIRA] Commented: (JBWS-2413) WSDLPublisher fails when trying to publish include schemas that contain relative paths

Richard Opalka (JIRA) jira-events at lists.jboss.org
Tue Jun 2 01:06:56 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBWS-2413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12470162#action_12470162 ] 

Richard Opalka commented on JBWS-2413:
--------------------------------------

Hi alvaro, are you able to reproduce this issue with JBossWS Native 3.1.2 on AS 5.x series? It should be fixed in up2date JBossWS versions.

> WSDLPublisher fails when trying to publish include schemas that contain relative paths
> --------------------------------------------------------------------------------------
>
>                 Key: JBWS-2413
>                 URL: https://jira.jboss.org/jira/browse/JBWS-2413
>             Project: JBoss Web Services
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: jbossws-native
>    Affects Versions: jbossws-native-3.0.4
>         Environment: OS: Windows Vista Business SP1
> Java: 1.5 build 16
> JBossWS: 3.0.4
> JBossAS: 4.2.3
>            Reporter: Alvaro
>            Assignee: Alessio Soldano
>             Fix For: jbossws-native-3.2.0
>
>
> When trying to deploy an EJB3 with a WebService endpoint and the property wsdlLocation set, the WSDLPublisher fails to publish schema imports if they contain relative paths.
> For example, in the method "publishSchemaImports", if the variable "resourcePath" used in the statement "URL resourceURL = dep.getMetaDataFileURL(resourcePath);" resolves to "META-INF/wsdl/schemas/NE2006/multicacheschemas/../coreschemas/infrastructureRoot.xsd", there will be a java.io.FileNotFoundExeception is thrown:
> org.jboss.ws.WSException: Cannot publish wsdl to: G:\Servidores\jboss-4.2.3.GA\server\default\data\wsdl\hl7-service-patient-administration-0.0.1-SNAPSHOT.jar\PRPA_AR101001UV01
> .wsdl
>         at org.jboss.wsf.stack.jbws.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:149)
>         at org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect.start(PublishContractDeploymentAspect.java:51)
>         at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.start(DeploymentAspectManagerImpl.java:144)
>         at org.jboss.wsf.container.jboss42.LazyAssemblyWSFRuntime.start(LazyAssemblyWSFRuntime.java:66)
>         at org.jboss.wsf.container.jboss42.AbstractDeployerHookEJB.deploy(AbstractDeployerHookEJB.java:50)
>         at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:88)
>         at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
>         at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>         at $Proxy34.start(Unknown Source)
>         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
>         at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>         at $Proxy9.deploy(Unknown Source)
>         at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
>         at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
>         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
>         at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
>         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
>         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
>         at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
>         at $Proxy0.start(Unknown Source)
>         at org.jboss.system.ServiceController.start(ServiceController.java:417)
>         at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>         at $Proxy4.start(Unknown Source)
>         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:304)
>         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
>         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>         at $Proxy5.deploy(Unknown Source)
>         at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
>         at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
>         at org.jboss.Main.boot(Main.java:200)
>         at org.jboss.Main$1.run(Main.java:508)
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: java.io.IOException: Cannot get URL for: META-INF/wsdl/schemas/NE2006/multicacheschemas/../coreschemas/infrastructureRoot.xsd
>         at org.jboss.wsf.common.URLLoaderAdapter.findChild(URLLoaderAdapter.java:103)
>         at org.jboss.wsf.framework.deployment.ArchiveDeploymentImpl.getMetaDataFileURL(ArchiveDeploymentImpl.java:97)
>         at org.jboss.wsf.stack.jbws.WSDLFilePublisher.publishSchemaImports(WSDLFilePublisher.java:274)
>         at org.jboss.wsf.stack.jbws.WSDLFilePublisher.publishSchemaImports(WSDLFilePublisher.java:297)
>         at org.jboss.wsf.stack.jbws.WSDLFilePublisher.publishSchemaImports(WSDLFilePublisher.java:303)
>         at org.jboss.wsf.stack.jbws.WSDLFilePublisher.publishSchemaImports(WSDLFilePublisher.java:303)
>         at org.jboss.wsf.stack.jbws.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:136)
>         ... 79 more
> If we replace the "resourcePath" with the canonical form, this error disappears.
> As a solution, I've replaced the following code: 
>  private void publishSchemaImports(URL parentURL, Element element, List<String> published) throws Exception
>    {
>      ....
>       while (it.hasNext())
>       {
>                  ....                  
>                   URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
>                   File targetFile = new File(xsdURL.getPath());
>                   targetFile.getParentFile().mkdirs();
>                   String deploymentName = dep.getCanonicalName();
>                   // get the resource path including the separator
>                   int index = baseURI.indexOf(deploymentName) + 1;
>                   String resourcePath = baseURI.substring(index + deploymentName.length());
>                   //check for sub-directories
>                   resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1);
>                   resourcePath = expLocation + resourcePath + schemaLocation;
>                   
>                   while (resourcePath.indexOf("//") != -1)
>                   {
>                      resourcePath = resourcePath.replace("//", "/");
>                   }
>                   URL resourceURL = dep.getMetaDataFileURL(resourcePath);                  
>                   .....
>           }
>          ....
>    }
> with this one:
>  private void publishSchemaImports(URL parentURL, Element element, List<String> published) throws Exception
>    {
>       ....
>       while (it.hasNext())
>       {
>                ....
>                   URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
>                   File targetFile = new File(xsdURL.getPath());
>                   targetFile.getParentFile().mkdirs();
>                   String deploymentName = dep.getCanonicalName();
>                   // get the resource path including the separator
>                   int index = baseURI.indexOf(deploymentName) + 1;
>                   String resourcePath = baseURI.substring(index + deploymentName.length());
>                   //check for sub-directories
>                   resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1);
>                   resourcePath = expLocation + resourcePath + schemaLocation;
>                   URI resourceURI = new URI(resourcePath);
>                   URI resourceURI2 = resourceURI.resolve("");
>                   resourcePath = resourceURI2.toString()+resourceURI2.relativize(resourceURI).toString();
>                   URL resourceURL = dep.getMetaDataFileURL(resourcePath);                  
>            ...
>       }
>    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbossws-issues mailing list