Nav Bar

jueves, 14 de febrero de 2013

Setting SSL in Tomcat with Java apps

Good afternoon, at least in Spain. Today we are going to learn how to set up SSL security on a Apache Tomcat server running our Java, or similar, app.
First of all, we must create a Keystore file using Java. Go to your JDK folder: cd $JAVA_HOME/bin. Now, create the keystore file: keytool -genkey -alias tomcat -keyalg RSA -keystore. Bare in mind that the password for the keystore must be the same as the key password. This is a tomcat limitation that I didn’t find anywhere. Took me a whole morning to find out. If everything is correct, you should have the .keystore file in the folder you where in (JDK/bin). The next step is to copy this .keystore file wherever you want it to be.
There is a possibility to change the password for the key file using the following command: keystore -keypasswd -alias tomcat -keystore
Now, let’s move on. Open your server.xml file. Inside the conf folder, in $CATALINA_HOME. You have to declare a new Connector:

Our last step to follow is  to configure the web.xml file for our app. Then we will be able to run SSL. It should be inside your webapps/appFolder folder. Insert the following lines after declaration.

 
  securedapp
  /*
 

 
  CONFIDENTIAL
 
If you want to quit SSL, just change CONFIDENTIAL to NONE, so you don’t have to delete all the code written. Hope you found it interesting.

Resources:
Resource 1
Resource 2

lunes, 4 de febrero de 2013

Startup script in Ubuntu

Today I learned how to make a script run on sytem startup. This way you can run your script after rebooting automatically. Let’s take a look at the steps:

1. Open /etc/init.d/rc.local file.

2. Add the script you want to run on boot process there. For example:

    sh /usr/share/apache-tomcat-7.0.27/bin/startup.sh
    echo ‘Apache Tomcat Running’

3. Save the file. Your script will run on boot process.

jueves, 18 de octubre de 2012

Hi all,
As you should know, when developing an application, it is extremely important to keep track of the different versions and updates that we come up with. At some point, we might want to take a different approach and do a new branch of our code, we could be considering trying new features or any fancy new things. With version control softwares we can do this and still keep our main thread of the code, the trunk. These kind of software also provide great capabilities for teamworking. Another great feature these softwares have, is the possibility to close a version. Sometimes in app developing, you might have to hand in a deliverable during the process of development, that is why tags exist. They close a version, and provide the possiblity to come back and start developing from that checkpoint.


 Possible scenario for an app lifecycle
I usually use Eclipse for application programming, depending on the platform obviously, and there are two possiblities for using the Subversion (version control software) in this IDE: Subclipse or Subversive. The one I decided to use? Subversive, which is developed and supported by the eclipse team. Now I´m going to try to explain how to fork a project and start developing and looking around different folders.
After Subversive is installed, we should open a new perspective window in our Eclipse in order to be able to browse through our repository. To open the perspective: Window > Open Perspective > Other and we look for the SVN Repository Exploring.
In that perspective, we have two main options: Create a new repository, or set a new location where we already have a repository. We would have to fill in a couple of settings, and we should see the repository in that view.
Now, to start working or checking code from the project, we must download it to our computer. To do so, we check the trunk or brunch we want to download, right-click with the mouse, and select Check-out. Then we will have the project in our projects view.

Image from: Resource