Java

Converting keystores between JKS and P12

From TECH BLOG FOR EJBCA ENTERPRISE OPEN SOURCE PKI's articel Converting keystores between JKS and P12.


Johan dug up these keytool commands, that with in JDK6 and onwards (not in JDK5 and earlier).

JKS → P12

keytool -importkeystore -srckeystore keystore.jks -srcstoretype JKS  -deststoretype PKCS12 -destkeystore keystore.p12

P12 → JKS

Provide one datasource with two different JNDI names in JBoss

While testing your JBoss service it can be very handy to use DefaultDS as your data source. However you will probably not want to hardcode this JNDI name into your code, jboss-server.xml, web.xml or persistence.xml (depending on service you write). There you want to use your own "MyAppDS" JNDI name. So wouldn't it be sweet to be able to bind two different JNDI names to the same datasource ?

It is possible and quite simple however I could not really find any good example while Googling the problem. So here is a short description how I solved my problem.

WSS4J Tutorial revisit

While reading the WSS4J - Axis Deployment Tutorial I found it somewhat lacking. Also in later versions of Axis it seems that the StockQuoteService has been changed.

So here is a reworked version.

Using JavaSVN beta with Subclipse

Why ?


The beta version of JavaSVN (1.1.0 beta 4) has support for the file:// protocol.

Prerequisite


# Eclipse 3.x
# Install the latest version of subclipse.
# Donwload the standalone release ot JavaSVN 1.0.1 Beta 4.

Install


Copy ganymed.jar and javasvn.jar from the JavaSVN beta zip to /plugins/org.tigris.subversion.subclipse.core_1.0.3/lib overwriting files with the same name.

Use PC Speaker from Java

Getting the PC speaker to emit a annoying beep might seem to be a quite easy task. And it is provided that you are in a graphical environment such as X.org och MS Windows™. Then using this easy bit of code will do:

package beeptest;

import java.awt.Toolkit;

public class BeepTest {
        public static void main(String[] args) {
                try {
                        Toolkit.getDefaultToolkit().beep();
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
}

JUCpio

Project summary


SVN

What is JUCpio ?

JUCpio stands for Java Util CPIO and is a set of classes (a API) for reading and writing cpio files.

It is designed to be similar to java.util.zip.

The primary reason I started this project was to learn more about the CPIO file format. The API is currently in a very early stage of development.

Features


Implemented


* Gives a interface to extract data from cpio files.

Digest The Tortoies And The Hare

The Tortoies And The Hare


I was looking for a API that could help me create a data driven model for a application I was writting at work. Since it was a Java application I turned my eyes towards Jakarta (a true saviour for us Java coders) and found Jakarta Digester. It seemed to full fill all that I needed. So I took it for a spin.

Log4j

Introduction

Log4J is a logging framework developed as part of the Jakarta project and distributed under the Apache Sowtware Licens. The Log4J framework gives you a fully configurable logging environment for your applications. It can easily be configured through code in your program or using configuration files.

The basic architecture of Log4J consists of 3 main components:

JDBCInfo

Here is a small Java application which connects to a database using JDBC and prints some information.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

public class JDBCInfo {
    private Connection conn;
   
    public JDBCInfo(String driver, String url) {
        if (driver != null) {
            try {
                Class.forName(driver);
                System.out.println("Registered JDBC driver '" + driver + "'");
            } catch (ClassNotFoundException e) {

Syndicate content