I have an app that runs on GlassFish 3.x. It communicates to a remote server over https. In my cacerts file I've added the server certs. In my keystore.jks I added the private key the company running the remote server issued me. This works great on Glassfish 2.x, however on 3.x they remote server keeps complaining that the key I have is invalid.

If I remove the key from the keystore I get the same error. It's as if it's not even loading the key, which has got me wondering how does the app / container know which key I need

My connection code looks like this:

public class SSLSocket {

private static Logger logger = LoggerFactory.getLogger(SSLSocket.class);
private ConnectionProperties connectionProperties;

public TuSSLSocket(ConnectionProperties connectionProperties) {
    this.connectionProperties = connectionProperties;
}

public SSLSocket getSSLSocket() throws Exception{
    SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
    SSLSocket socket = (SSLSocket) factory.createSocket(connectionProperties.getHost(), connectionProperties.getPort());
    socket.setSoTimeout(90000);

    return socket;
}

}


I set the Host and Port accordingly, but no where do I say go look for this alias in the keystore. So... how does the app know what alias to grab?


Question: Find cron jobs that run between given times
Answer: Anything is possible but you will have to parse crontab yourself.

There are no simple answers, but just because I can here's a partial solution in bash.

    #!/bin/bash

    start="${1-0:0}"
    end="${2-0:0}"
    start_hour=$(cut -d: -f1 &lt;&lt;&lt;"$start")
    end_hour=$(cut -d: -f1 &lt;&lt;&lt;"$end")
    start_min=$(cut -d: -f2 &lt;&lt;&lt;"$start")
    end_min=$(cut -d: -f2 &lt;&lt;&lt;"$end")

    # leading zeroes would be bad
    let start_hour=10#${start_hour}
    let end_hour=10#${end_hour}
    let start_min=10#${start_min}
    let end_min=10#${end_min}

    cat /etc/crontab | \
            grep -v ^\# | \
            grep -E -v '^([a-zA-Z]+)' | \
            awk '{print $1, $2, $7}' | \
    while read line ; do
            if [ ! -z "$line" ] ; then
                    h=$(cut -d' ' -f2 &lt;&lt;&lt;"$line")
                    m=$(cut -d' ' -f1 &lt;&lt;&lt;"$line")
                    cmd=$(cut -d' ' -f3- &lt;&lt;&lt;"$line")

                    if [ "$h" = '*' ] || ( [ $h -ge $start_hour ] &amp;&amp; [ $h -le $end_hour ] ) ; then
                            if [ "$m" = '*' ] || ( [ $m -ge $start_min ] &amp;&amp; [ $m -le $end_min ] ) ; then
                                    echo $cmd
                            fi
                    fi
            fi
    done


Call like

cron_between 09:00 16:59


This certainly won't work for complex time specifications (e.g. */2) and only reports on the first part of the command. All of this can be corrected, but probably you'd be better off doing it in perl or something.