Steven,

In a servlet, the contents of WEB-INF aren't available on the classpath 
(except for WEB-INF/classes).   They are grabbed via the ServletContext.    
If you look at the CXF servlet code, we create a spring bus using the 
normal configs, the servlet then adds a ResourceResolver for the 
ServletContext stuff and registers the Servlet based HTTP stuff, then we 
load the cxf-servlet.xml configs.   

What this means is if you are starting services in the first phase, they 
probably won't work.   The contents of WEB-INF won't be available.   The 
HTTP Destination stuff won't be registered, etc....

In the second phase in cxf-servlet.xml in your war, it should work 
(outside the maven jetty:run command) and I've verified it in tomcat 
5.5.23.

If you know of a way to clean that up a bit, I'd love to hear it. 

Dan



On Wednesday 02 May 2007 22:02, Steven E. Harris wrote:
> Im' trying to define an endpoint via the <jaxws:endpoint> element in a
> Spring configuration file, and I can't figure out how to use the
> wsdlLocation attribute to point to a file in my WAR.
>
> According to the "JAX-WS Configuration" document¹ on the CXF site, the
> wsdlLocation attribute is used as follows:
>
> ,----
>
> | The location of the WSDL. Can be on the classpath, file system, or
> | be hosted remotely.
>
> `----
>
> My WSDL file is in may WAR's WEB-INF/wsdl directory. I've tried using
> the following as values for wsdlLocation:
>
>   /WEB-INF/wsdl/myfile.wsdl
>   WEB-INF/wsdl/myfile.wsdl
>   /wsdl/myfile.wsdl
>   wsdl/myfile.wsdl
>   classpath:WEB-INF/wsdl/myfile.wsdl
>
> None of them work. The first four fail as follows:
>
> ,----
>
> | Caused by: javax.wsdl.WSDLException: WSDLException:
> | faultCode=PARSER_ERROR: Problem parsing
> | '/WEB-INF/wsdl/myfile.wsdl'.: java.io.FileNotFoundException:
> | \WEB-INF\wsdl\myfile.wsdl (The system cannot find the path
> | specified) 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:177) at
> | org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.
> |java:141) at
> | org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.j
> |ava:81) ... 42 more
> | Caused by: java.io.FileNotFoundException: \WEB-INF\wsdl\myfile.wsdl
> | (The system cannot find the path specified) at
> | java.io.FileInputStream.open(Native Method)
> |     at java.io.FileInputStream.<init>(FileInputStream.java:106)
> |     at java.io.FileInputStream.<init>(FileInputStream.java:66)
> |     at
> | sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnectio
> |n.java:70) at
> | sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLCo
> |nnection.java:161) at
> | com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurren
> |tEntity(XMLEntityManager.java:653) at
> | com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determine
> |DocVersion(XMLVersionDetector.java:186) at
> | com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(
> |XML11Configuration.java:771) at
> | com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(
> |XML11Configuration.java:737) at
> | com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser
> |.java:107) at
> | com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser
> |.java:225) at
> | com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Do
> |cumentBuilderImpl.java:283) ... 48 more
>
> `----
>
> The last one -- the "classpath" scheme -- fails for being an invalid
> URL scheme.
>
> I see that WSDLManagerImpl sets up a ResourceManagerWSDLLocator that
> looks like a fancy catalog resolver, but I can see that it fails to
> find any of my candidate paths in its getBaseInputSource() method.
>
> Do I need to configure something specifically to be able to refer to a
> file within my WAR?
>
>
> Footnotes:
> ¹ http://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to