adequate
adequate
adequate
adequate
 

JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   Forums 
August 22, 2018, 07:26:20 AM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: Please, help-me: Unsupported major.minor version 52.0  (Read 200 times)

jose.azanha

  • JPPF Padawan
  • *
  • Posts: 14
Please, help-me: Unsupported major.minor version 52.0
« on: May 06, 2018, 03:43:24 AM »

Hi everyone,

This errors are printing in NetBeans IDE after executing my code. Whats happening?

Informations: [org.peup.db.DAO_Db_Runner@4bf70de6]
Informations: Listing the users... - MySQL task, error: org/peup/db/DAO_Db_Runner : Unsupported major.minor version 52.0

I will attach my full code, please have a look at it and help-me to get a solution.

PS.: I'm using Fedora 28 with OpenJDK (build 1.8.0_171-b10) .

--------------------------------------
Usuarios1.java
--------------------------------------
package org.peup.ws;

import java.util.*;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import org.jppf.client.JPPFClient;
import org.jppf.client.JPPFJob;
import org.jppf.node.protocol.Task;
import org.peup.db.DAO_Db_Runner;

@Path("usuariosListNew1")
public class Usuarios1 {

    @Context
    private UriInfo context;
    private String mysql;

    public Usuarios1() {
        this.mysql = "SELECT desc_email, id_usuario, nom_usuario, dt_inclusao "
                        + "FROM tb_usuario";
    }
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String getText() {
      try {
        String message = "Listing the users...";
                             
        // JPPF client initialization
        JPPFClient jppfclient=new JPPFClient();
        JPPFJob job = new JPPFJob();
        job.setName(message);   

        // JPPF Task initialization
        Task<?> task = job.add(new DAO_Db_Runner(mysql));
        task.setId(message + " - MySQL task");
        job.setBlocking(false);
        jppfclient.submitJob(job);

        // JPPF Getting results
        List<Task<?>> results = job.awaitResults();
        System.out.println(results);
       
        for (Task<?> task1: results) {
            String taskName = task.getId();
       
            if (task1.getThrowable() != null) {
                System.out.println(taskName + ", error: " + task1.getThrowable ().getMessage());
            } else {
                // process the result here ...
                System.out.println(taskName + ", the results are: " + task1.getResult());
            }
        }
      }
      catch(Exception e) {
         e.printStackTrace();
      }
      return null;
   }
   
    @PUT
    @Consumes(MediaType.TEXT_PLAIN)
    public void putText(String content) {
    }
}

--------------------------------------
DAO_DB_Runner.java
--------------------------------------
package org.peup.db;

import org.jppf.node.protocol.AbstractTask;
import java.sql.*;
import java.util.Arrays;

public class DAO_Db_Runner extends AbstractTask<String>{
   
    private final String mysql;
   
   public DAO_Db_Runner(String mysql) {
        this.mysql = mysql;
   }
   
    @Override
   public void run() {

       Connection conn = null;
        String[][] listAux = null;

        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            conn=DriverManager.getConnection("jdbc:mysql://localhost/mydb?"+
                "user=user&password=passwd");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery(mysql); 

            ResultSetMetaData rsmd = rs.getMetaData();
            int numColumns = rsmd.getColumnCount();
            rs.last();
            int numRows = rs.getRow();
            rs.first();

            String listAll[][] = new String[numRows][numColumns];
           
            for (int i=0;i<numRows;i++){
                int j=0;
                for(j=0;j<numColumns;j++)
                    listAll[j] = rs.getString(j+1);
                rs.next();
            }
            listAux = listAll;
            conn.close();
            rs.close();
            stmt.close();
        } catch (Exception e) {
            System.out.println("Erro... "+e.getMessage());
        }
        setResult(Arrays.toString(listAux));
    }
}
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2232
    • JPPF Web site
Re: Please, help-me: Unsupported major.minor version 52.0
« Reply #1 on: May 06, 2018, 07:20:45 AM »

Hello,

For a detailed explanation of the error you are getting, please look at this Stackoverflow thread.

What I believe is happening here, is that your DAO_Db_Runner task is compiled with Java 8, but the JPPF node in which it executes is running with Java 7. You need to ensure that your nodes run with Java 8 as well,. Could you please do this and let us know of the outcome?

Sincerely,
-Laurent
Logged

jose.azanha

  • JPPF Padawan
  • *
  • Posts: 14
Re: Please, help-me: Unsupported major.minor version 52.0
« Reply #2 on: May 06, 2018, 11:16:47 PM »

Thanks so much.

About JDK is solved. However, the class DAO_DB_Runner.java don't return value (just null). But I have tested this class without the JPPF and is returnning the array data from database.

In JPPF Node, is showing a message with Error 4 after trying executing SQL Task.

Please, whats happaning?
« Last Edit: May 07, 2018, 12:48:58 AM by jose.azanha »
Logged

jose.azanha

  • JPPF Padawan
  • *
  • Posts: 14
Re: Please, help-me: Unsupported major.minor version 52.0
« Reply #3 on: May 07, 2018, 02:00:59 AM »

Laurant,

Please, ignore the last message. I descovered the problem.

Thanks. Good night!  ;) ;D
Logged
Pages: [1]   Go Up
 
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads