Results 1 to 5 of 5

Thread: No Connections-org.voltdb.client.NoConnectionsException

  1. #1
    New Member
    Join Date
    Mar 2014
    Posts
    2

    No Connections-org.voltdb.client.NoConnectionsException

    Hi,
    Does any one know why I get this exception when I start my client application:
    org.voltdb.client.NoConnectionsException: No connections.
    at org.voltdb.client.Distributer.queue(Distributer.ja va:698)
    at org.voltdb.client.ClientImpl.callProcedure(ClientI mpl.java:241)
    at org.voltdb.client.ClientImpl.callProcedureWithTime out(ClientImpl.java:206)
    at org.voltdb.client.ClientImpl.callProcedure(ClientI mpl.java:187)
    at com.millenniumit.voltdb.dao.VoltJdbcTemplate.query Proc(VoltJdbcTemplate.java:50)
    at com.millenniumit.voltdb.dao.PerfTestDAOImpl.perfTe stTradeCaptureReportProc(PerfTestDAOImpl.java:74)
    at com.millenniumit.voltdb.service.PerfTestServiceImp l.perfTestTradeCaptureReport(PerfTestServiceImpl.j ava:40)
    at com.millenniumit.voltdb.TestVoltDBClient$Task.run( TestVoltDBClient.java:104)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

  2. #2
    Super Moderator
    Join Date
    Feb 2010
    Posts
    94
    Hi Miyuru,

    The exception is thrown when you try to call a procedure on a client that is closed or has a broken connection to the server. You have to call Client.createConnection() before using the client instance for procedure invocations. The following doc shows how to establish a client connection and call procedures.

    https://voltdb.com/docs/UsingVoltDB/DesignAppLogic.php
    Ning

  3. #3
    New Member
    Join Date
    Mar 2014
    Posts
    2
    Hi Nshi,

    Thanks for the reply Nshi. I think I have call the createConnecton() before using the client instance for procedure invocations. An I have add my sample code I am using. I don't get this error every time I run my client program.

    public class VoltJdbcTemplate {


    private Client client;

    private VoltDataSource dataSource;

    public VoltTable[] query(String sql) throws IOException, ProcCallException {
    return getClient().callProcedure("@AdHoc", sql).getResults();

    }



    public VoltTable[] queryProc(String procedeureName,List<String> params) throws NoConnectionsException, IOException, ProcCallException, InterruptedException{

    VoltTable[] resultRow = getClient().callProcedure(procedeureName,params.ge t(0),params.get(1)).getResults();
    return resultRow;
    }



    public Client getClient() throws IOException {
    if (client == null) {
    String[] hostArray = new String[]{dataSource.getUrl()};
    this.initClient(hostArray);
    }
    return client;
    }


    private void initClient(String hostNames[])
    throws IOException {
    ClientConfig config = new ClientConfig(dataSource.getUsername(), dataSource.getPassword());

    config.setProcedureCallTimeout(900*1000);
    config.setConnectionResponseTimeout(900*1000);
    config.setMaxTransactionsPerSecond(100);

    client = ClientFactory.createClient(config);
    this.initConnections(hostNames);
    }

    private void initConnections(String hostNames[])
    throws IOException {
    if (hostNames != null && hostNames.length > 0) {
    for (String host : hostNames) {
    client.createConnection(host.trim());
    }
    } else {
    throw new UnknownHostException("No hosts specified");
    }
    }

    public void closeClientConnection(){
    try {
    this.client.close();
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    }


    public void setDataSource(VoltDataSource dataSource) {
    this.dataSource = dataSource;
    }
    }

    Thanks.
    Last edited by Miyuru; 03-18-2014 at 01:47 AM.

  4. #4
    Super Moderator
    Join Date
    Feb 2010
    Posts
    94
    Hi Miyuru,

    Could the server be terminated before the client? You can add a status listener to the client instance to track when the connection is closed.

    http://voltdb.com/docs/UsingVoltDB/D...ignAppErrOther
    Ning

  5. #5
    New Member
    Join Date
    Apr 2015
    Posts
    1
    Thanks for the reply Nshi. I think I have call the createConnecton() before using the client instance for procedure invocations. An I have add my sample code I am using. I don't get this error every time I run my client program.
    asad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •