[ 
https://issues.apache.org/jira/browse/AXIS2-1993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480542
 ] 

Wei Wang commented on AXIS2-1993:
---------------------------------

I ran into the same problem (java.io.FileNotFoundException). The patch did not 
work. I pulled down the source, after debug/testing, I believe the bug is in 
the resolveEntity method mentioned above, but on another line of code, to be 
exact, the line that reads: 
URL url = new URL(new URL(baseUri), systemId);

I changed that line to:
URL url = new URL(baseUri + systemId);

If you look at the Java API: 
http://java.sun.com/j2se/1.5.0/docs/api/java/net/URL.html#URL(java.net.URL,%20java.lang.String),
 it says 'If the spec's path component begins with a slash character "/" then 
the path is treated as absolute and the spec path replaces the context path.' 
Let say baseUri has value 'file:/C:/Temp/foo.wsdl', and systemId has value 
'/../bar.xsd'. Then the original code will produce 'file:/../bar.xsd', instead 
of 'file:/C:/Temp/../bar.xsd'. And that's where problem lies.


> xsd:include in the WSDL causes FileNotFoundException with XMLBeans as the 
> Databinding framework.
> ------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-1993
>                 URL: https://issues.apache.org/jira/browse/AXIS2-1993
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.1.1
>            Reporter: Sriram Vaidyanathan
>         Assigned To: Amila Chinthaka Suriarachchi
>             Fix For: 1.1.1
>
>         Attachments: patch
>
>
> When i add an xsd:include to my WSDL as shown below, a FileNotFoundException 
> is thrown:
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema
>   attributeFormDefault="unqualified" elementFormDefault="qualified"
>      targetNamespace="http://www.sample.com/test"; version="2.1.0">
>        <xsd:include schemaLocation="SampleService.xsd" />
>  </xsd:schema>
> Here is the Exception stacktrace:
>  Running AXIS Tool WSDL2Java with Axis2 Home as  C:\axis2-1.1.1 
>    [delete] Deleting directory C:\cvs\aps\sample\wsdl\xmlbeans_gen_src
>      [java] Retrieving schema at 'SampleService.xsd', relative to 
> 'file:/C:/cvs/aps/sample/wsdl/src/main/config/'.
>      [java] Jan 16, 2007 9:31:48 PM 
> org.apache.axis2.xmlbeans.CodeGenerationUtility$Axis2EntityResolver 
> resolveEntity
>      [java] INFO: Resolving schema with publicId [null] and systemId 
> [\SampleService.xsd]
>      [java] Exception in thread "main" 
> org.apache.axis2.wsdl.codegen.CodeGenerationException: 
> java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>      [java]   at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
>      [java]   at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
>      [java]   at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
>      [java] Caused by: java.lang.RuntimeException: 
> java.lang.reflect.InvocationTargetException
>      [java]   at 
> org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:92)
>      [java]   at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:177)
>      [java]   ... 2 more
>      [java] Caused by: java.lang.reflect.InvocationTargetException
>      [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [java]   at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]   at 
> org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:82)
>      [java]   ... 3 more
>      [java] Caused by: java.lang.RuntimeException: 
> org.apache.xmlbeans.XmlException: error: Problem parsing referenced XML 
> resource - java.io.FileNotFoundException: \SampleService.xsd (The system 
> cannot find the file specified)
>      [java]   at 
> org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:242)
>      [java]   ... 8 more
>      [java] Caused by: org.apache.xmlbeans.XmlException: error: Problem 
> parsing referenced XML resource - java.io.FileNotFoundException: 
> \SampleService.xsd (The system cannot find the file specified)
>      [java]   at 
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:225)
>      [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [java]   at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]   at 
> org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
>      [java]   at 
> org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:160)
>      [java]   ... 8 more
>      [java] Java Result: 1

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to