Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:04:37+00:00 2026-06-07T16:04:37+00:00

I am running this code on the Tomcat server as a Java application. if(levelMap.get(bssid_a)

  • 0

I am running this code on the Tomcat server as a Java application.

if(levelMap.get(bssid_a) == null)
    continue;
ArrayList<String> levels_a = new ArrayList<String>();
levels_a = (ArrayList<String>)levelMap.get(bssid_a);

where levelMap is a hashmap defines as:

HashMap<String, ArrayList<String>> levelMap

I am getting this error:

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.ArrayList

The same code is working in my Android application, so I am not sure why I am getting this error.

The original function (without type casting, but gives me the same error):

    public EDistance[] getLocation(HashMap<String, ArrayList<String>> levelMap) {

        HashMap<String, CrossProduct> crossProductList_local = new HashMap<String, CrossProduct>();

        LinkedHashSet<String> localList = (LinkedHashSet<String>) globalList.clone();

        Iterator<String> cpItera = localList.iterator();
        long time1 = System.currentTimeMillis();
        // Iterator<String> levelIter = levelMap.keySet().iterator();
        // try {

        while (cpItera.hasNext()) {

            String ssids[] = cpItera.next().split(",");
            String bssid_a = ssids[0];

            if(levelMap.get(bssid_a) == null)
                continue;
            //ArrayList<String> levels_a = new ArrayList<String>();
            ArrayList<String> levels_a = levelMap.get(bssid_a);
            double meanA = mean(levels_a, sampleSize, defaultLevel);

            // Iterator<String> cpIterb = localList.iterator();
            //
            // while(cpIterb.hasNext())
            // {

            String bssid_b = ssids[1];
            // if(bssid_a.equals(bssid_b))
            // continue;
            if(levelMap.get(bssid_b) == null)
                continue;
            //ArrayList<String> levels_b = new ArrayList<String>();
            ArrayList<String> levels_b = levelMap.get(bssid_b);
            double meanB = mean(levels_b, sampleSize, defaultLevel);
............

Here is the stacktrace:

SEVERE: Failed to invoke method distance in class com.fingerprint.core.Calculate: [Ljava.lang.Object; cannot be cast to java.util.ArrayList
org.apache.xmlrpc.common.XmlRpcInvocationException: Failed to invoke method distance in class com.fingerprint.core.Calculate: [Ljava.lang.Object; cannot be cast to java.util.ArrayList
    at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:129)
    at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.execute(ReflectiveXmlRpcHandler.java:106)
    at org.apache.xmlrpc.server.XmlRpcServerWorker.execute(XmlRpcServerWorker.java:46)
    at org.apache.xmlrpc.server.XmlRpcServer.execute(XmlRpcServer.java:86)
    at org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:200)
    at org.apache.xmlrpc.webserver.XmlRpcServletServer.execute(XmlRpcServletServer.java:112)
    at org.apache.xmlrpc.webserver.XmlRpcServlet.doPost(XmlRpcServlet.java:196)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.ArrayList
    at com.fingerprint.location.HyperbolicEuclideanDistance.getLocation(HyperbolicEuclideanDistance.java:235)
    at com.fingerprint.core.Calculate.distance(Calculate.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:115)
    ... 24 more
Caused by:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.ArrayList
    at com.fingerprint.location.HyperbolicEuclideanDistance.getLocation(HyperbolicEuclideanDistance.java:235)
    at com.fingerprint.core.Calculate.distance(Calculate.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:115)
    at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.execute(ReflectiveXmlRpcHandler.java:106)
    at org.apache.xmlrpc.server.XmlRpcServerWorker.execute(XmlRpcServerWorker.java:46)
    at org.apache.xmlrpc.server.XmlRpcServer.execute(XmlRpcServer.java:86)
    at org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:200)
    at org.apache.xmlrpc.webserver.XmlRpcServletServer.execute(XmlRpcServletServer.java:112)
    at org.apache.xmlrpc.webserver.XmlRpcServlet.doPost(XmlRpcServlet.java:196)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

The code calling the XMlRPC method:

public String getLocationXMLRPC(HashMap<String, ArrayList<String>> levelMap, String mapFile) {

    try {
        XMLRPCClient client = new XMLRPCClient("http://172.28.184.222:8080/LocationService/xmlrpc");

        Object[] params = new Object[]{levelMap, mapFile};
        //EDistance retura[] = (EDistance[]) client.callEx("Calculate.distance", params);
        String result = (String) client.callEx("Calculate.distance", params);
        return result;

    } catch (XMLRPCException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}

The XMLRPC method that calls the erroneous function:

public String distance(HashMap<String, ArrayList<String>> levelMap, String mapFile)
{
    if(dist == null){
        dist = new HyperbolicEuclideanDistance(mapFile, 3, -130,
                false, "fake.txt");
        System.out.println("New Class created!");
    }
    EDistance[] result =  dist.getLocation(levelMap);

    StringBuilder build = new StringBuilder();

    for (int j = 0; j < result.length; j++) {
        if (result[j] != null)
            build.append(j + ") " + result[j] + "\n");
    }
    return build.toString(); 

}

The code that calls the server:

public String getLocationXMLRPC(HashMap<String, ArrayList<String>> levelMap, String mapFile) {

    try {
        XMLRPCClient client = new XMLRPCClient("http://172.28.184.222:8080/LocationService/xmlrpc");


        String result = (String) client.call("Calculate.distance", levelMap, mapFile);
        return result;

    } catch (XMLRPCException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:04:40+00:00Added an answer on June 7, 2026 at 4:04 pm

    According to ws-xmlrpc XMLRPC Data-Types a HashMap<String, ArrayList<String>>is not a directly supported parameter type.

    From the exception stacktrace you posted one can see that a HashMap<String, Object> made it along the wire to your XMLRPC server. That’s obvious as the server needs to invoke the distance method using Java reflection. Doing that, a exception would occur if the parameter is not a HashMap at least. Instead the exception in your trace happens, when retrieving an object from that map. There is a invisible type check at runtime when retrieving and assigning an element from HashMap<String, ArrayList<String>>, and that check fails with the exception you have.

    Thus it may be a marshalling problem for your XMLRPC library to pass your parameters. So, as Map<String, List<String>> according to the above documentation should be a valid parameter type though, try to change the distance method’s and their callees parameters to that and try again.

    If that also fails, think about passing the parameters in another more flat and simple structure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application server (JBoss, but this also happens in Tomcat) running as
I get a segmentation fault when running this code. Anyone know why? Thanks. #include
I am running a tomcat server and am attempting to update code on that
I have a problem with a server, written in Java, running on Tomcat, serving
I am running a multi-threaded Java web application on Apache Tomcat 6. Instead of
I'm experiencing a very odd problem with a Java application running under Tomcat. We
I have an e-commerce application running on Tomcat 7 & IIS 7. The souce-code
I am running this code: #include <iostream> #include <cstddef> int main(int argc, char *argv[]){
I am running this code and it is using a fair amount of CPU
While I am running this code it showing me a following error:- Column 'virtuemart_product_id'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.