webservices中遇到的问题
1.cxf生成客户端调用webservices报如下错:
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/axis2/jaxws/description/DescriptionFactory
at org.apache.axis2.jaxws.spi.ServiceDelegate.(ServiceDelegate.java:212)
at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:59)
at javax.xml.ws.Service.(Unknown Source)
at com.pcitc.project.hengyi.webservices.materialsType.client.MaterialsTypeService_Service.(MaterialsTypeService_Service.java:47)
at com.pcitc.project.hengyi.webservices.materialsType.client.TestMaterialsType.main(TestMaterialsType.java:5)
Caused by: java.lang.ClassNotFoundException: org.apache.axis2.jaxws.description.DescriptionFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader
1.
r
u
n
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
j
a
v
a
.
s
e
c
u
r
i
t
y
.
A
c
c
e
s
s
C
o
n
t
r
o
l
l
e
r
.
d
o
P
r
i
v
i
l
e
g
e
d
(
N
a
t
i
v
e
M
e
t
h
o
d
)
a
t
j
a
v
a
.
n
e
t
.
U
R
L
C
l
a
s
s
L
o
a
d
e
r
.
f
i
n
d
C
l
a
s
s
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
j
a
v
a
.
l
a
n
g
.
C
l
a
s
s
L
o
a
d
e
r
.
l
o
a
d
C
l
a
s
s
(
U
n
k
n
o
w
n
S
o
u
r
c
e
)
a
t
s
u
n
.
m
i
s
c
.
L
a
u
n
c
h
e
r
1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher
1.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.net.URLClassLoader.findClass(UnknownSource)atjava.lang.ClassLoader.loadClass(UnknownSource)atsun.misc.LauncherAppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 5 more
原因:找不到这个类DescriptionFactory,这个类在axis2-metadata包里,下载这个包并放到lib下面
下载包的路径,maven:
https://mvnrepository.com/artifact/org.apache.axis2/axis2-metadata/1.5.6
maven截图