1.Spring启动跑错,不能存在多个实例cfx,经百度后发现为配置文件出错 改成
<jaxws:endpoint id="JK_webserviceLISImpl" implementor="com.ustcinfo.fccos.terminal.web.webservice.impl.JK_webserviceLISImpl" address="/JK_webService_LIS" />
<jaxws:endpoint id="JK_webService_NGBOOSImpl" implementor="com.ustcinfo.fccos.terminal.web.webservice.impl.JK_webService_NGBOOSImpl" address="/JK_webService_NGBOOS" />
后成功启动服务成功
2.调用报错,本地利用JaxWsDynamicClientFactory 调用CFX服务报错 此时先确认maven引用,需添加这些引用
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-xjc -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
本地调用成功,部署到服务器发现报错
java.lang.IllegalStateException: Unable to create working directory /opt/fccos/tomcat-terminal-ws/temp/org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory@2cc821ef-1512537721871-src
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:345)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:234)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:227)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:182)
查看代码发现本地生成动态客户端代码
try {
client = dcf.createClient(WsAddress);
查看源码发现
File src = new File(tmpdir, stem + "-src");
if (!src.mkdir()) {
throw new IllegalStateException("Unable to create working directory " + src.getPath());
}
try {
Object writer = JAXBUtils.createFileCodeWriter(src);
codeModel.build(writer);
} catch (Exception e) {
throw new IllegalStateException("Unable to write generated Java files for schemas: "
+ e.getMessage(), e);
}
File classes = new File(tmpdir, stem + "-classes");
if (!classes.mkdir()) {
throw new IllegalStateException("Unable to create working directory " + classes.getPath());
}
自动创建文件,先推测为用户权限不够,发现linux上付文件夹权限为当前用户,经查看服务器上没有 /opt/fccos/tomcat-terminal-ws/temp/org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory@2cc821ef-1512537721871-src文件夹 查找原因,发现没有 /opt/fccos/tomcat-terminal-ws/temp/目录,尝试手动创建temp文件夹,尝试调用,成功,问题解决。大坑大坑