Can’t load data from mysql database Xampp to android studio JDBC : Could not create connection to database server

I cant load data from MYSQL database to android studio ListView , do you know what’s the problem ? i tried some solutions but still the same problem .

logs after catching Exceptions :

01-17 04:25:44.711 20226-20329/com.example I/System.out: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at java.lang.reflect.Constructor.constructNative(Native Method)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at com.mysql.jdbc.Util.getInstance(Util.java:408)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861)
01-17 04:25:44.711 20226-20329/com.example.myapplication I/System.out: at

Message Signing in SOAP Web Service

I am developing a java client to connect to a web service which uses SOAP. In Intellij

TOOLS>GENERATE JAVA CODE FROM WSDL 

has generated the stubs and I have connected to the insecure endpoint.

I now need to sign the message with a public certificate. I have read about Axis, CXF, WSS4J and Glassfish but I am still unclear which of these packages I would use?

ANT Create jarfile

I want to build a jar file using ant.
I have a resource folder in my project with files and folder beneath.
Example:

Package---
             src
                    Main.java
             resources
                    images
                           logo.png

Inside the JAR file the images sould be accesible via ...File("resources/images/logo.png"); is that possible and if yes how?

I tried serveral options but could not figure out how it works.
One of my attempts:

...    
<zipfileset dir="${dir.buildfile}/ressources/images" includes="*.png"/>
<zipfileset dir="${dir.buildfile}/ressources/images" includes="*.jpg"/>
...

This wasn’t working…

Best regards!

adding empty columns between in excel using poi

i have 2 requirements like add no. of empty rows after find the specific row and add 2 empty columns after find the specific column in excel using POI. Achieved the 1st requirement by sheet.shiftRows(startRow,no.of rows,no.of rows to insert) method. but didnt get solution for 2nd requirement. Can anyone help on this.. Thanks in advance.

how to run docker image with parameters with entrypoint

I have this docker file and I would like that when I do a docker run, the container starts and execute a test from a “.jar” file that is on a directory with a parameter at the end like this:

java -jar /opt/sqa/QA.jar PARAMETER

This is a dockerfile example whit what I have:

FROM openjdk:8-jre
WORKDIR /opt/sqa/
ENTRYPOINT [“java -jar /opt/sqa/QA.jar”,”$@”]

But I can make it work when I run:

docker run -it Image:Automation PARAMETER

the JAR is already on that directory (mapped with -V on Docker run).
In fact if I access the container and i run the test manually it works, but is not the idea.

I would like to be able to change the PARAMETER at the moment of running the container Instead of PARAMETER, PARAMETER2, or TEST1, TEST2 and whatever I want. Is this possible doing it with entrypoint like i did here? what should I change?

ENTRYPOINT [“java -jar /opt/sqa/QA.jar”,”$@”]

Iḿ getting error:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused “exec: “java -jar /opt/sqa/QA.jar”: stat java no such file or directory”: unknown.

Stack implementation array index out of bound error

hey guys i’m a begginer and i have started to learn programming .
I have created a stack .

public class STK {
    static int capacity = 0; 

    STK(int size) {
        capacity = size;
    }

    int stackk[] = new int[capacity];
    int top = 0;

    public void push(int d) {
        if(top < capacity) {
            stackk[top] = d;
            top++;
        } else {
            System.out.println("Overflow");
        }
    } 
}

its implementation

public class BasicStackImplementation {
    public static void main(String[] args) {
        STK mystack = new STK(5);

        mystack.push(51);
        mystack.push(23);
    }
}

when i try to run this code it gives an error

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at STK.push(STK.java:21)
    at BasicStackImplementation.main(BasicStackImplementation.java:6)

i have spent more than an hour to try to find out the error but i am unable

Jersey2 client list mapping

I’m trying to develop a rest client using Jersey and the jackson mapper for the object mappings. I’m receiving the following json response:

{
    "currentPage": 0,
    "pageSize": 15,
    "totalResults": 1,
    "sortDirection": "",
    "orderBy": "",
    "data": [
        [
            1,
            "ingredient",
            3,
            "former",
            4,
            "nestle",
            5,
            "fish",
            true
        ]
    ]
}

So the issue comes when I try to map the service response, I’m getting all the values but the “data” field, which comes as null. This is the code chunk where I’m doing the call:

public PageDTO<IngredienteBusquedaDTO> findIngredientesPaged(final IngredienteBusquedaCriteria criteria,
        final String token) {

    Client sslClient = null;
    try {
        sslClient = new SSLJerseyClient().getClient();

    } catch (KeyManagementException | NoSuchAlgorithmException e) {
        e.printStackTrace();
    }

    return sslClient
            .register(JacksonFeature.class)
            .target("https://192.168.11.6:8442/servicios/ws/")
            .path("ingrediente/paged")
            .request(MediaType.APPLICATION_JSON)
            .header("Authorization", token)
            .post(Entity.entity(criteria, MediaType.APPLICATION_JSON))
            .readEntity(new GenericType<PageDTO<IngredienteBusquedaDTO>>() {
            });
}

The PageDTO class is parametrizable:

@Produces("application/json")
@JsonAutoDetect
public class PageDTO<T> implements Serializable {

    /** The Constant serialVersionUID. */
    private static final long serialVersionUID = 5491202093571112081L;

    /** The current page. */
    private Integer currentPage;

    /** The page size. */
    private Integer pageSize;

    /** The total results. */
    private Integer totalResults;

    /** The sort direction. */
    private String sortDirection;

    /** The order by. */
    private String orderBy;

    /** The data. */
    @JsonProperty
    private List<T> data;

getters and setters...

And the IngredienteBusquedaDTO is an exact copy of the object being send from the service:

public class IngredienteBusquedaDTO implements Serializable {

    /** The Constant serialVersionUID. */
    private static final long serialVersionUID = 7827829548387723259L;

    /** The id ingrediente. */
    private Long idIngrediente;

    /** The descripcion. */
    private String descripcion;

    /** The id proveedor. */
    private Long idProveedor;

    /** The descripcion proveedor. */
    private String descripcionProveedor;

    /** The id tipo ingrediente. */
    private Short idTipoIngrediente;

    /** The descripcion tipo ingrediente. */
    private String descripcionTipoIngrediente;

    /** The salsa. */
    private boolean salsa;

getters and setters

Any ideas of what’s going on? Thanks in advance!!!

How to locate state of a checkbox element with java+selenium which could not be recognized as a checkbox even with javascript

I’m implementing test cases for aviasales.com web sites and I’m trying to validate state of the checkbox.

I could easily find the checkbox and even click on it via:

WebElement checkboxValue = driver.findElement(
      By.xpath("//label[@class='mewtwo-show_hotels__label']"));
            checkboxValue.click();

The problem is that boolean bool = checkboxValue.isSelected(); returns only false even it was selected.

I googled a lot and found an advice to use JavaScript for that, so I tried from the console before Java implementation but same thing happens – always false:

var field = document.getElementsByClassName("mewtwo-show_hotels__label");
if (field[0].checked == true) {alert("1")} else {alert("2")}

and I got only alert with 2 no matter what is a checkbox condition (selected or not)

What else can I try here if chrome locator identifies checkbox as ::before in source code?

enter image description here

Thank you!