Cisco AXL - 执行SQL查询,解析响应。

问题描述 投票:0回答:1

AXL 12.5, Apache CXF 3.3.6, OpenJDK 14, Spring Boot 2.3.0,执行一个SQL查询

String sqlStmt = "SELECT name FROM typeuserlocale";

ExecuteSQLQueryReq executeSQLQueryReq = new ExecuteSQLQueryReq();
executeSQLQueryReq.setSql(sqlStmt);

ExecuteSQLQueryRes executeSQLQueryRes = axlPort.executeSQLQuery(executeSQLQueryReq);

List<Object> rows = executeSQLQueryRes.getReturn().getRow();

给出的答复是 List<Object>,如何解析结果?将对象投向什么?

调试显示,这是一个 ElementNSImpl. 试图将其投向 ElementNSImpl 导致IDE添加了这个依赖关系。

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.9.1</version>
</dependency>

但是投射它导致了一个异常。

java.lang.ClassCastException: 
class com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to class org.apache.xerces.dom.ElementNSImpl (com.sun.org.apache.xerces.internal.dom.ElementNSImpl is in module java.xml of loader 'bootstrap'; 
org.apache.xerces.dom.ElementNSImpl is in unnamed module of loader 'app')
java spring-boot cisco-axl
1个回答
0
投票

是否有可能是使用Oracle JDK版本的wsimport生成了AXL服务存根,而你的应用程序是用OpenJDK运行的? 在这种情况下,你可以尝试使用OpenJDK wsdl2java重新生成(不确定客户端代码是否会有任何变化)。

这里有一个Cisco DevNet的工作示例,演示了解析。https:/github.comCiscoDevNetaxl-java-samples)。 然而,它是基于Oracle JDK 1.8的。


0
投票

铸造必须要做 org.w3c.dom.Element它工作得很好。

© www.soinside.com 2019 - 2024. All rights reserved.