You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Abid Hussain <ab...@abid76.de> on 2007/11/12 11:08:20 UTC

FileNotFoundException wsdl

Hello everybody,

I generated a client using wsdl2java and packed it in a jar, so that I 
can use it in other applications. When generating the client using 
wsdl2java I indicated that the wsdl file is in etc/kvvservice.wsdl.

Now, when I try to use the client in an other application (using the jar 
file) I get the following error (full stack trace at the end):
javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem 
parsing 'file:etc/kvvservice.wsdl'.: java.io.FileNotFoundException: 
etc\kvvservice.wsdl (Das System kann den angegebenen Pfad nicht finden)

First, I wonder how to indicate that the wsdl has moved to another place 
when using the client in another application.

Second, I don't get why the CXF Runtime needs the wsdl file at all? The 
clients classes have already been generated using wsdl2java and I 
suppose that all information needed is contained in those generated classes.

Would be happy if anybody could help me.

Best regards,

Abid


javax.xml.ws.WebServiceException: 
org.apache.cxf.service.factory.ServiceConstructionException: Failed to 
create service.
	at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:109)
	at 
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:55)
	at javax.xml.ws.Service.<init>(Service.java:57)
	at 
de.fuberlin.mi.kvv.ws.KvvServiceImplService.<init>(KvvServiceImplService.java:41)
	at kvv.service.client.KvvServiceClient.<init>(KvvServiceClient.java:32)
	at kvv.service.client.KvvServiceClient.getDefault(KvvServiceClient.java:66)
	at 
modulverwaltung.action.util.LecturerHelper.getLecturers(LecturerHelper.java:40)
	at modulverwaltung.action.CreateModule.performAction(CreateModule.java:240)
	at modulverwaltung.controller.Controller.doGet(Controller.java:91)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
	at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
	at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: 
Failed to create service.
	at 
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:83)
	at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:115)
	at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:107)
	... 24 more
Caused by: javax.wsdl.WSDLException: WSDLException: 
faultCode=PARSER_ERROR: Problem parsing 'file:etc/kvvservice.wsdl'.: 
java.io.FileNotFoun
dException: etc\kvvservice.wsdl (Das System kann den angegebenen Pfad 
nicht finden)
	at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
	at 
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:199)
	at 
org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:163)
	at 
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:81)
	... 26 more
Caused by: java.io.FileNotFoundException: etc\kvvservice.wsdl (Das 
System kann den angegebenen Pfad nicht finden)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at java.io.FileInputStream.<init>(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown 
Source)
	at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown 
Source)
	at 
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown 
Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
	... 32 more

-- 

Abid Hussain
Mail: abid.hussain@abid76.de
Web: http://www.abid76.de

Re: FileNotFoundException wsdl

Posted by Mayank Thakore <th...@gmail.com>.
thanks!

On 11/13/07, James Mao <ja...@iona.com> wrote:
> Jax-ws spec allow you to do this:
>
> ((BindingProvider)port).getRequestContext().put(
>    *BindingProvider.ENDPOINT_ADDRESS_PROPERY*,
>    "http://foo.com/blah");
>
> See this thread:
> http://www.nabble.com/Why-does-a-JAX-WS-client-use-the-WSDL-at-run-time--tf3683059.html#a10315931
>
>
> Regards,
> James
>
>
> > I had some doubts along similar lines.
> >
> > Suppose that my client needs to access a web service published by
> > different servers at multiple endpoint urls. These urls will be known
> > only at runtime. How can I achieve this? (because if the wsdl url is a
> > file then it has the address of the service)
> >
> > Arun says that when metro stubs are used the first call is used to
> > invoke the wsdl and second to get the results. Can we do the same in
> > CXF by specifying WS endpoint at runtime?
> >
> > Thanks!
> > Mayank
> >
> > On 11/12/07, Abid Hussain <ab...@abid76.de> wrote:
> >
> >> Thanks, putting the wsdl in the classpath and using the following code
> >> in the ServiceImpl class finally did it:
> >>
> >>     static {
> >>         URL url = null;
> >>         try {
> >> //              url = new URL("file:etc/kvvservice.wsdl");
> >>             url =
> >> KvvServiceImplService.class.getResource("/kvvservice.wsdl");
> >>             System.out.println("Using wsdl from (" + url + ").");
> >>         } catch (Exception e) {
> >>             System.err.println("Can not initialize the default wsdl
> >> from classpath:/kvvservice.wsdl");
> >>             // e.printStackTrace();
> >>         }
> >>         WSDL_LOCATION = url;
> >>     }
> >>
> >> Regards,
> >>
> >> Abi
> >>
> >> Glen Mazza schrieb:
> >>
> >>> Am Montag, den 12.11.2007, 11:08 +0100 schrieb Abid Hussain:
> >>>
> >>>> Hello everybody,
> >>>>
> >>>> I generated a client using wsdl2java and packed it in a jar, so that I
> >>>> can use it in other applications. When generating the client using
> >>>> wsdl2java I indicated that the wsdl file is in etc/kvvservice.wsdl.
> >>>>
> >>>> Now, when I try to use the client in an other application (using the jar
> >>>> file) I get the following error (full stack trace at the end):
> >>>> javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem
> >>>> parsing 'file:etc/kvvservice.wsdl'.: java.io.FileNotFoundException:
> >>>> etc\kvvservice.wsdl (Das System kann den angegebenen Pfad nicht finden)
> >>>>
> >>>> First, I wonder how to indicate that the wsdl has moved to another place
> >>>> when using the client in another application.
> >>>>
> >>>>
> >>> Your WSDL file will need to be in the classpath of the client app that
> >>> you are running.  Basically, at the root of the classes directory is the
> >>> easiest place to put it, but you can also specify other classpaths.
> >>>
> >>> I find Ant easier to state classpaths, if you look at my "run-client"
> >>> target in step 5 of my eBay tutorial this may help you:
> >>>
> >>> http://www.jroller.com/gmazza/date/20070817
> >>>
> >>> Also, in your Service class generated by JAX-WS, you can alter the
> >>> syntax used for loading the file.  Instead of:
> >>>
> >>> url = new URL("file:mywsdl.wsdl");  // filepath search, probably won't
> >>> work for JARs
> >>>
> >>> you should be able to use something like:
> >>>
> >>> URL wsdlURL = getClass().getClassLoader().getResource("mywsdl.wsdl");
> >>> // classpath search, should work for JARs
> >>>
> >>>
> >>>
> >>>> Second, I don't get why the CXF Runtime needs the wsdl file at all? The
> >>>> clients classes have already been generated using wsdl2java and I
> >>>> suppose that all information needed is contained in those generated classes.
> >>>>
> >>>>
> >>> Vivek and Arun of Sun Metro have much to say about this, links below.
> >>>
> >>> http://forums.java.net/jive/message.jspa?messageID=244333#244333
> >>> http://blogs.sun.com/arungupta/date/20071108
> >>>
> >>> HTH,
> >>> Glen
> >>>
> >>>
> >>>
> >>>
> >> --
> >>
> >> Abid Hussain
> >> Mail: abid.hussain@abid76.de
> >> Web: http://www.abid76.de
> >>
> >>
> >
> >
>

Re: FileNotFoundException wsdl

Posted by James Mao <ja...@iona.com>.
Jax-ws spec allow you to do this:

((BindingProvider)port).getRequestContext().put(
    *BindingProvider.ENDPOINT_ADDRESS_PROPERY*,
    "http://foo.com/blah");

See this thread: 
http://www.nabble.com/Why-does-a-JAX-WS-client-use-the-WSDL-at-run-time--tf3683059.html#a10315931


Regards,
James


> I had some doubts along similar lines.
>
> Suppose that my client needs to access a web service published by
> different servers at multiple endpoint urls. These urls will be known
> only at runtime. How can I achieve this? (because if the wsdl url is a
> file then it has the address of the service)
>
> Arun says that when metro stubs are used the first call is used to
> invoke the wsdl and second to get the results. Can we do the same in
> CXF by specifying WS endpoint at runtime?
>
> Thanks!
> Mayank
>
> On 11/12/07, Abid Hussain <ab...@abid76.de> wrote:
>   
>> Thanks, putting the wsdl in the classpath and using the following code
>> in the ServiceImpl class finally did it:
>>
>>     static {
>>         URL url = null;
>>         try {
>> //              url = new URL("file:etc/kvvservice.wsdl");
>>             url =
>> KvvServiceImplService.class.getResource("/kvvservice.wsdl");
>>             System.out.println("Using wsdl from (" + url + ").");
>>         } catch (Exception e) {
>>             System.err.println("Can not initialize the default wsdl
>> from classpath:/kvvservice.wsdl");
>>             // e.printStackTrace();
>>         }
>>         WSDL_LOCATION = url;
>>     }
>>
>> Regards,
>>
>> Abi
>>
>> Glen Mazza schrieb:
>>     
>>> Am Montag, den 12.11.2007, 11:08 +0100 schrieb Abid Hussain:
>>>       
>>>> Hello everybody,
>>>>
>>>> I generated a client using wsdl2java and packed it in a jar, so that I
>>>> can use it in other applications. When generating the client using
>>>> wsdl2java I indicated that the wsdl file is in etc/kvvservice.wsdl.
>>>>
>>>> Now, when I try to use the client in an other application (using the jar
>>>> file) I get the following error (full stack trace at the end):
>>>> javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem
>>>> parsing 'file:etc/kvvservice.wsdl'.: java.io.FileNotFoundException:
>>>> etc\kvvservice.wsdl (Das System kann den angegebenen Pfad nicht finden)
>>>>         
>>>> First, I wonder how to indicate that the wsdl has moved to another place
>>>> when using the client in another application.
>>>>
>>>>         
>>> Your WSDL file will need to be in the classpath of the client app that
>>> you are running.  Basically, at the root of the classes directory is the
>>> easiest place to put it, but you can also specify other classpaths.
>>>
>>> I find Ant easier to state classpaths, if you look at my "run-client"
>>> target in step 5 of my eBay tutorial this may help you:
>>>
>>> http://www.jroller.com/gmazza/date/20070817
>>>
>>> Also, in your Service class generated by JAX-WS, you can alter the
>>> syntax used for loading the file.  Instead of:
>>>
>>> url = new URL("file:mywsdl.wsdl");  // filepath search, probably won't
>>> work for JARs
>>>
>>> you should be able to use something like:
>>>
>>> URL wsdlURL = getClass().getClassLoader().getResource("mywsdl.wsdl");
>>> // classpath search, should work for JARs
>>>
>>>
>>>       
>>>> Second, I don't get why the CXF Runtime needs the wsdl file at all? The
>>>> clients classes have already been generated using wsdl2java and I
>>>> suppose that all information needed is contained in those generated classes.
>>>>
>>>>         
>>> Vivek and Arun of Sun Metro have much to say about this, links below.
>>>
>>> http://forums.java.net/jive/message.jspa?messageID=244333#244333
>>> http://blogs.sun.com/arungupta/date/20071108
>>>
>>> HTH,
>>> Glen
>>>
>>>
>>>
>>>       
>> --
>>
>> Abid Hussain
>> Mail: abid.hussain@abid76.de
>> Web: http://www.abid76.de
>>
>>     
>
>   

Re: FileNotFoundException wsdl

Posted by Mayank Thakore <th...@gmail.com>.
I had some doubts along similar lines.

Suppose that my client needs to access a web service published by
different servers at multiple endpoint urls. These urls will be known
only at runtime. How can I achieve this? (because if the wsdl url is a
file then it has the address of the service)

Arun says that when metro stubs are used the first call is used to
invoke the wsdl and second to get the results. Can we do the same in
CXF by specifying WS endpoint at runtime?

Thanks!
Mayank

On 11/12/07, Abid Hussain <ab...@abid76.de> wrote:
> Thanks, putting the wsdl in the classpath and using the following code
> in the ServiceImpl class finally did it:
>
>     static {
>         URL url = null;
>         try {
> //              url = new URL("file:etc/kvvservice.wsdl");
>             url =
> KvvServiceImplService.class.getResource("/kvvservice.wsdl");
>             System.out.println("Using wsdl from (" + url + ").");
>         } catch (Exception e) {
>             System.err.println("Can not initialize the default wsdl
> from classpath:/kvvservice.wsdl");
>             // e.printStackTrace();
>         }
>         WSDL_LOCATION = url;
>     }
>
> Regards,
>
> Abi
>
> Glen Mazza schrieb:
> > Am Montag, den 12.11.2007, 11:08 +0100 schrieb Abid Hussain:
> >> Hello everybody,
> >>
> >> I generated a client using wsdl2java and packed it in a jar, so that I
> >> can use it in other applications. When generating the client using
> >> wsdl2java I indicated that the wsdl file is in etc/kvvservice.wsdl.
> >>
> >> Now, when I try to use the client in an other application (using the jar
> >> file) I get the following error (full stack trace at the end):
> >> javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem
> >> parsing 'file:etc/kvvservice.wsdl'.: java.io.FileNotFoundException:
> >> etc\kvvservice.wsdl (Das System kann den angegebenen Pfad nicht finden)
> >
> >> First, I wonder how to indicate that the wsdl has moved to another place
> >> when using the client in another application.
> >>
> >
> > Your WSDL file will need to be in the classpath of the client app that
> > you are running.  Basically, at the root of the classes directory is the
> > easiest place to put it, but you can also specify other classpaths.
> >
> > I find Ant easier to state classpaths, if you look at my "run-client"
> > target in step 5 of my eBay tutorial this may help you:
> >
> > http://www.jroller.com/gmazza/date/20070817
> >
> > Also, in your Service class generated by JAX-WS, you can alter the
> > syntax used for loading the file.  Instead of:
> >
> > url = new URL("file:mywsdl.wsdl");  // filepath search, probably won't
> > work for JARs
> >
> > you should be able to use something like:
> >
> > URL wsdlURL = getClass().getClassLoader().getResource("mywsdl.wsdl");
> > // classpath search, should work for JARs
> >
> >
> >> Second, I don't get why the CXF Runtime needs the wsdl file at all? The
> >> clients classes have already been generated using wsdl2java and I
> >> suppose that all information needed is contained in those generated classes.
> >>
> >
> > Vivek and Arun of Sun Metro have much to say about this, links below.
> >
> > http://forums.java.net/jive/message.jspa?messageID=244333#244333
> > http://blogs.sun.com/arungupta/date/20071108
> >
> > HTH,
> > Glen
> >
> >
> >
>
> --
>
> Abid Hussain
> Mail: abid.hussain@abid76.de
> Web: http://www.abid76.de
>

Re: FileNotFoundException wsdl

Posted by Abid Hussain <ab...@abid76.de>.
Thanks, putting the wsdl in the classpath and using the following code 
in the ServiceImpl class finally did it:

     static {
         URL url = null;
         try {
//        	url = new URL("file:etc/kvvservice.wsdl");
             url = 
KvvServiceImplService.class.getResource("/kvvservice.wsdl");
             System.out.println("Using wsdl from (" + url + ").");
         } catch (Exception e) {
             System.err.println("Can not initialize the default wsdl 
from classpath:/kvvservice.wsdl");
             // e.printStackTrace();
         }
         WSDL_LOCATION = url;
     }

Regards,

Abi

Glen Mazza schrieb:
> Am Montag, den 12.11.2007, 11:08 +0100 schrieb Abid Hussain:
>> Hello everybody,
>>
>> I generated a client using wsdl2java and packed it in a jar, so that I 
>> can use it in other applications. When generating the client using 
>> wsdl2java I indicated that the wsdl file is in etc/kvvservice.wsdl.
>>
>> Now, when I try to use the client in an other application (using the jar 
>> file) I get the following error (full stack trace at the end):
>> javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem 
>> parsing 'file:etc/kvvservice.wsdl'.: java.io.FileNotFoundException: 
>> etc\kvvservice.wsdl (Das System kann den angegebenen Pfad nicht finden)
> 
>> First, I wonder how to indicate that the wsdl has moved to another place 
>> when using the client in another application.
>>
> 
> Your WSDL file will need to be in the classpath of the client app that
> you are running.  Basically, at the root of the classes directory is the
> easiest place to put it, but you can also specify other classpaths.
> 
> I find Ant easier to state classpaths, if you look at my "run-client"
> target in step 5 of my eBay tutorial this may help you:
> 
> http://www.jroller.com/gmazza/date/20070817
> 
> Also, in your Service class generated by JAX-WS, you can alter the
> syntax used for loading the file.  Instead of:
> 
> url = new URL("file:mywsdl.wsdl");  // filepath search, probably won't
> work for JARs
> 
> you should be able to use something like:
> 
> URL wsdlURL = getClass().getClassLoader().getResource("mywsdl.wsdl");
> // classpath search, should work for JARs
> 
> 
>> Second, I don't get why the CXF Runtime needs the wsdl file at all? The 
>> clients classes have already been generated using wsdl2java and I 
>> suppose that all information needed is contained in those generated classes.
>>
> 
> Vivek and Arun of Sun Metro have much to say about this, links below.
> 
> http://forums.java.net/jive/message.jspa?messageID=244333#244333
> http://blogs.sun.com/arungupta/date/20071108
> 
> HTH,
> Glen
> 
> 
> 

-- 

Abid Hussain
Mail: abid.hussain@abid76.de
Web: http://www.abid76.de

Re: FileNotFoundException wsdl

Posted by Glen Mazza <gl...@verizon.net>.
Am Montag, den 12.11.2007, 11:08 +0100 schrieb Abid Hussain:
> Hello everybody,
> 
> I generated a client using wsdl2java and packed it in a jar, so that I 
> can use it in other applications. When generating the client using 
> wsdl2java I indicated that the wsdl file is in etc/kvvservice.wsdl.
> 
> Now, when I try to use the client in an other application (using the jar 
> file) I get the following error (full stack trace at the end):
> javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem 
> parsing 'file:etc/kvvservice.wsdl'.: java.io.FileNotFoundException: 
> etc\kvvservice.wsdl (Das System kann den angegebenen Pfad nicht finden)

> First, I wonder how to indicate that the wsdl has moved to another place 
> when using the client in another application.
> 

Your WSDL file will need to be in the classpath of the client app that
you are running.  Basically, at the root of the classes directory is the
easiest place to put it, but you can also specify other classpaths.

I find Ant easier to state classpaths, if you look at my "run-client"
target in step 5 of my eBay tutorial this may help you:

http://www.jroller.com/gmazza/date/20070817

Also, in your Service class generated by JAX-WS, you can alter the
syntax used for loading the file.  Instead of:

url = new URL("file:mywsdl.wsdl");  // filepath search, probably won't
work for JARs

you should be able to use something like:

URL wsdlURL = getClass().getClassLoader().getResource("mywsdl.wsdl");
// classpath search, should work for JARs


> Second, I don't get why the CXF Runtime needs the wsdl file at all? The 
> clients classes have already been generated using wsdl2java and I 
> suppose that all information needed is contained in those generated classes.
> 

Vivek and Arun of Sun Metro have much to say about this, links below.

http://forums.java.net/jive/message.jspa?messageID=244333#244333
http://blogs.sun.com/arungupta/date/20071108

HTH,
Glen