Java Classpath Issues with Webservices(CXF) and Jboss
I am using CXF(which autogenerates my webservices in my pom.xml from my wsdl) with JBoss(eclipse ide), and I am having some trouble accessing the webservice from my web application. I found this resource: http://blog.progs.be/?p=92 but I am having a really hard time using WSDL_LOCATION = cl.getResource( "my/progam/pack/wsdl/myService.wsdl" ); to work properly in my code.
I have my wsdls located in src/main/wsdl and have added the following l开发者_如何学Cine to the .classpath file: classpathentry kind="src" path="src/main/wsdl"
I also created the folders my,program,pack,wsdl and dropped my wsdls into that location, so it is accessible.
However, the classloader.getResource call always returns null no matter what.
When I specify getResource( "/wsdl/myService.wsdl" ) it does not return null, but I believe it looks at the full file path and not what I need (considering part of the URL contains the path to the wsdl file all the way through the jboss server directory and includes the WEB-INF dir.
Is my .classpath file set up incorrectly or am I missing something else?
if the WSDL Location is not correct it always throws a ClassCast Exception like so:
java.lang.ClassCastException: org.apache.cxf.jaxws.ServiceImpl at javax.xml.ws.Service.(Service.java:81)
I have my wsdls located in
src/main/wsdl
(...)
In order to get theses files on the class path, you need to declare the directory as resource in your POM:
<project>
...
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/wsdl</directory>
</resource>
</resources>
...
</build>
</project>
And now your WSDLs should end up under the classes
directory.
精彩评论