ActiveBlog

Pushing to Stackato Directly from Eclipse or STS
by William Gautier

William Gautier, May 29, 2013

If you use Eclipse or its variants to develop applications, you can directly deploy your Java applications to Stackato with VMware’s Cloud Foundry Integration plugin. Here is how you can do it, starting from an existing Eclipse and Stackato install, in three simple steps.

Adding Stackato’s Certificate to Java

Before installing the plugin, you will need to allow Java to access Stackato via SSL. First, download your Stackato certificate. The easiest way is to access your Stackato management console with a browser.

  • On Chrome: Once you are on the certificate warning page, click on the crossed out padlock to the left of the address bar, then click Certificate Information, switch to the Details tab, and click Export. Make sure to save the certificate in DER-encoded binary. 
  • On Firefox: Once you are on the certificate warning page, click I Understand the Risks, then Add Exception. On the new window, click View, switch to the Details tab, and click Export. Make sure to save the certificate in DER-encoded binary. You can then quit Firefox without adding the exception. 

Once you have the certificate file, it’s time to add it to the Java keystore. First, open a terminal and navigate to your java install folder. If you’re not sure where it is or which java installation to use, go to your Eclipse preferences, then under “Installed JREs,” you will find the path.

Navigate to path/to/java/jre/lib/security. You should see a keystore file named “cacerts.” Then enter the following command to add the certificate to the keystore (In this example, I am using a Stackato micro-cloud. Don’t forget to change the arguments to your real server address.)

sudo keytool -import -file ~/stackato-xxxx.local -alias api.stackato-xxxx.local -keystore cacerts 

The default password for the Java keystore is “changeit."  If Eclipse is open, you will need to restart it once you're done so it can load the certificate.

Using Cloud Foundry Integration

Install the Cloud Foundry Integration plugin from the Eclipse Marketplace. If you are using the Spring Tool Suite, you can also install it from the Extensions tab of the Dashboard.

 

Once that’s done and you have restarted Eclipse, you need to add your server to Eclipse. Go to File, New, Server. Select Cloud Foundry under VMware as the server type, then name your server whatever you want.

On the next page, click Manage Cloud, then Add. Type any name, then your Stackato URL: for example, api.stackato-xxxx.local. As you click Finish, Eclipse will verify the validity of the URL. If you get a SSLHandshakeException, your certificate was not added correctly to Java’s keystore.

Assuming everything went well, select the URL you have created, and click OK to go back to the previous window. There, enter the login information in your Stackato server. Click Validate Account. If no error message appears at the top, you can click Finish.

Deploying Your Application

It is now time to push your Java application to Stackato. Note that not all Java frameworks are compatible with the Cloud Foundry plugin. For the moment, Spring, Grails, Lift, and Java Web are supported. You can use the Stackato command line client if you are working with another framework.

Right-click on your project and click Run on Server. Then select the Stackato server you have just added and click Finish.

A new window will pop up, asking you about the application framework and runtime. Note that the plugin will try to automatically detect and select them as the default values in the list. This means that most of the time, you can just trust the plugin and click Next. However, if you believe the plugin made a mistake, you can change it.

That should be all! Sometimes the plugin will attempt to load the application before it is deployed and you will see a 404 page. Make sure to wait for the “Server startup in X ms” message in the console before loading it again.

Subscribe to ActiveState Blogs by Email

Share this post:

About the Author: RSS

Graduating from University of Rennes, France, William joins ActiveState as a junior developer working on Stackato. The resident Java guy, William is in charge of the plugins and infrastructure surrounding Stackato, but he is also eager to learn and ready to face any polyglot challenge that comes his way.

Comments

1 comments for Pushing to Stackato Directly from Eclipse or STS
Permalink

Great post! But you only talked about Firefox and Chrome. What about IE?? Naahh, I'm kidding! :)

Do you know if there is such a plugin for Netbeans?