如何找到java ClassCastException发生的位置(How to find where the java ClassCastException is happening)

编程入门 行业动态 更新时间:2024-10-27 14:26:59
如何找到java ClassCastException发生的位置(How to find where the java ClassCastException is happening)

只是想知道是否有人可以从下面的代码中看到为什么我得到异常“java.lang.ClassCastException”。

RISService,RisPortType是我从WSDL文件获得的lib,然后使用wsimport生成.java文件

我知道异常意味着什么,但我不知道如何追踪它。

// Instantiate the wsimport generated SXML API Service client -- RISService risportService = new RISService(); RisPortType risportPort = risportService.getRisPort(); // Set the URL, user, and password on the JAX-WS client String hostUrl = "https://10.1.1.1:8443/realtimeservice2/services/RISService"; ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, hostUrl); ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, cucmDetails.getAxlUsername()); ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, cucmDetails.getAxlPassword()); // create and populate the selectCmDevice request SelectCmDevice sxmlParams = new SelectCmDevice(); CmSelectionCriteria criteria = new CmSelectionCriteria(); long maxNum = 200; long modelNum = 255; ArrayOfSelectItem items = new ArrayOfSelectItem(); //create a select item criteria to retrieve devices with names matching "SEP123412341234" SelectItem item = new SelectItem(); item.setItem("SEP123412341234"); items.getItem().add(item); //Search on all nodes criteria.setNodeName("Any"); //get back max 200 phones. 9+ can get upto 1000 criteria.setMaxReturnedDevices(maxNum); //get back phones only criteria.setDeviceClass("Phone"); //255 means get back ALL phone models criteria.setModel(modelNum); //get back only Registered phones criteria.setStatus("Registered"); //return results in order of name criteria.setSelectBy("Name"); //array of phones to get results back for criteria.setSelectItems(items); sxmlParams.setCmSelectionCriteria(criteria); //make selectCmDevice request SelectCmDeviceReturn selectResponse = risportPort.selectCmDevice("",criteria); << This is where i get the exception outline below

线程“AWT-EventQueue-0”中的异常javax.xml.ws.WebServiceException:

java.lang.ClassCastException: [C cannot be cast to java.lang.String at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source) at com.sun.xml.internal.ws.client.Stub.process(Unknown Source) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source) at com.sun.proxy.$Proxy40.selectCmDevice(Unknown Source) at utils._9.APIRIS9.getPhoneIPadd(APIRIS9.java:66)

谢谢亚历克西斯

Just wondering if anyone can see why i am getting the exception "java.lang.ClassCastException" from the code below.

RISService, RisPortType are lib that i got from a WSDL file and then use wsimport to generate the .java files

I know what the exception means but i am just not sure how to track it down.

// Instantiate the wsimport generated SXML API Service client -- RISService risportService = new RISService(); RisPortType risportPort = risportService.getRisPort(); // Set the URL, user, and password on the JAX-WS client String hostUrl = "https://10.1.1.1:8443/realtimeservice2/services/RISService"; ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, hostUrl); ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, cucmDetails.getAxlUsername()); ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, cucmDetails.getAxlPassword()); // create and populate the selectCmDevice request SelectCmDevice sxmlParams = new SelectCmDevice(); CmSelectionCriteria criteria = new CmSelectionCriteria(); long maxNum = 200; long modelNum = 255; ArrayOfSelectItem items = new ArrayOfSelectItem(); //create a select item criteria to retrieve devices with names matching "SEP123412341234" SelectItem item = new SelectItem(); item.setItem("SEP123412341234"); items.getItem().add(item); //Search on all nodes criteria.setNodeName("Any"); //get back max 200 phones. 9+ can get upto 1000 criteria.setMaxReturnedDevices(maxNum); //get back phones only criteria.setDeviceClass("Phone"); //255 means get back ALL phone models criteria.setModel(modelNum); //get back only Registered phones criteria.setStatus("Registered"); //return results in order of name criteria.setSelectBy("Name"); //array of phones to get results back for criteria.setSelectItems(items); sxmlParams.setCmSelectionCriteria(criteria); //make selectCmDevice request SelectCmDeviceReturn selectResponse = risportPort.selectCmDevice("",criteria); << This is where i get the exception outline below

Exception in thread "AWT-EventQueue-0" javax.xml.ws.WebServiceException:

java.lang.ClassCastException: [C cannot be cast to java.lang.String at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source) at com.sun.xml.internal.ws.client.Stub.process(Unknown Source) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source) at com.sun.proxy.$Proxy40.selectCmDevice(Unknown Source) at utils._9.APIRIS9.getPhoneIPadd(APIRIS9.java:66)

Thanks Alexis

最满意答案

我敢打赌你的密码是作为char[]返回的,jaxws期待一个String。

I bet your password is being returned as a char[] and jaxws is expecting a String.

更多推荐

本文发布于:2023-08-01 10:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1357707.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位置   发生   ClassCastException   java   find

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!