SOA part-1 Installing BPEL Designer and Apache ODE

Hi all, in my last project i was trying some BPEL process to execute from Eclipse and Apache ODE and finally i made the process to work so here is my experience and my tutorial to install BPEL designer in Eclipse3.6 and Apache ODE

Installing Eclipse BPEL designer
1.Suppose that you have already downloaded and installed your Eclipse > v3.6.2(Helios,or Indigo), version for Java EE Developers and JDK (version > 1.5).
2.Open the Eclipse, go to the menu Help→Install New SoftWare.
3.Click on the button Add and define a new Eclipe update site with the location:
http://download.eclipse.org/bpel/site/
4.Now you have the update-site of BPEL available on the eclipse. Select the check box to BPEL Visual Designer and click on the button Next.
5.Follow the installation windows, you will now have your BPEL installed on Eclipse. Note that: the BPEL dependencies(WTP, EMF, GEF, JEM) should be installed before the BPEL designer. Fortunately, with Eclipse Helios for JavaEE, you have all.
6.After finishing the installation, restart it.
7.To verify the installation was successful, after the restart, click on File→New→Other, you will see the BPEL 2.0 is on the list.
The BPEL designer is now ready to use. However, to run the BPEL process, you should have the server’s environment. Now, we are going to install the Apache ODE for the BPEL deployment.

Installing Apache ODE

1.Download and extract the latest ODE from the Apache web site. The current stable version is the ODE 1.3.5.
2.Inside the “apache-ode-war-1.3.5” folder, you will see an “ode.war” file. Deploy this file on your Tomcat server.
3.The simple way to do this is extracting the “ode.war” file to get the ode folder.
4.Copy this ode folder to your TOMCAT_DIR/webapps directory.
That’s all.

Setting up the ODE server on Eclipse
1.Show the “Servers” view by selecting the menu Windows→Show View→Servers.
2.Right click on the empty space of the “Servers” view, select New→Server.
3.Leave the server host name as localhost and select the server type as the Apache→Ode v1.x Server. Rename the server’s name if you want. In my installation, I keep the default name. Then click on the button Next.
4. Show the “Servers” view by selecting the menu Windows→Show View→Servers.
Right click on the empty space of the “Servers” view, select New→Server.
Leave the server host name as localhost and select the server type as the Apache→Ode v1.x Server. Rename the server’s name if you want. In my installation, I keep the default name. Then click on the button Next.

Note that: the ODE Runtime configuration above can also be added or editted using the menu Windows→Preferences→Server→Runtime Environments.

5. Click Finish. You now have the ODE server which is ready to run on the Eclipse. You can see this server on the Server View.
6.Now, you should test the server’s configuration by right click on the ODE server entry and select Start. Or you can click on the Start button on the Server View. If the server is sucessfully started, you will see the status like this.

Note:If you are using Tomcat v.6 or v.7, you probably get the error

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
  at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
  at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
  ... 1 more
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.

7. This error occurs maybe because it misses the tomcat-juli.jar in the Launch environment.
8. To fix this, double click on the installed Ode v1.x Server in the Server View to see the configuration.
9. k on Open launch configuration → Classpath tab → Add External JARs → [your TOMCAT_DIR]\bin\tomcat-juli.jar. Then Ok
10. Now try to start your ODE server in the Server View.
11.Terminate the server by clicking on the Stop button or right click on the server and select Stop. Every thing is

Ready now for the first BPEL program. i will be teaching the first HelloWorld BPEL Process in SOA-2 tutorial
Happy Coding 🙂

Using Apache Cassandra with Maven

Hi guys, from last few days i was working on a new technology called Apache Cassandra and here is my guidance to install and use it.
Apache Cassandra is an open source distributed database management system. It is an Apache Software Foundation top-level project, designed to handle very large amounts of data spread out across many commodity servers while providing a highly available service with no single point of failure. It is a NoSQL solution that was initially developed by Facebook
Cassandra provides a structured key-value store with tunable consistency.Keys map to multiple values, which are grouped into column families. The column families are fixed when a Cassandra database is created, but columns can be added to a family at any time. Furthermore, columns are added only to specified keys, so different keys can have different numbers of columns in any given family. The values from a column family for each key are stored together.

You can download the Apache Cassandra here and select one of the mirror link. After downloading extract the zip in one of the drives and create “\var\lib\cassandra\commitlog”,”\var\lib\cassandra\data”,”\var\lib\cassandra\saved_caches” folders in the root folder as these folders are used by cassandra server these folders are configures in conf/cassandra.yaml file.

once you are done with the creation navigate to bin dir and start cassandra.bat file. once it has started without error or exception then start cassandra-cli.bat(cassandra-client)

once the above steps are done correctly, Open Eclipse IDE with Maven capability(Assuming maven is already installed)
copy the below content in the POM.xml file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.spark.cassandra</groupId>
	<artifactId>CassandraMavenIntegration</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>CassandraMavenIntegration</name>
	<description>CassandraMavenIntegration</description>

	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>me.prettyprint</groupId>
			<artifactId>hector-core</artifactId>
			<version>1.0-2</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.6.1</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>java</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
					<optimize>true</optimize>
					<showDeprecation>true</showDeprecation>
					<showWarnings>true</showWarnings>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>cassandra-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>

Now to create a column family and insert data into it using java, follow the code as below.

/**
 * 
 */
package com.spark.cassandra.hector;

import me.prettyprint.cassandra.serializers.StringSerializer;
import me.prettyprint.hector.api.Cluster;
import me.prettyprint.hector.api.Keyspace;
import me.prettyprint.hector.api.beans.HColumn;
import me.prettyprint.hector.api.exceptions.HectorException;
import me.prettyprint.hector.api.factory.HFactory;
import me.prettyprint.hector.api.mutation.Mutator;
import me.prettyprint.hector.api.query.ColumnQuery;
import me.prettyprint.hector.api.query.QueryResult;

/**
 * @author Mantha Pavan Kumar
 * 
 */
public class CassandraHectorTest {

	private static StringSerializer stringSerializer = StringSerializer.get();

	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		Cluster cluster = HFactory.getOrCreateCluster("TestCluster",
				"localhost:9160");

		Keyspace keyspaceOperator = HFactory.createKeyspace("DEMO",
				cluster);
		try {
			Mutator<String> mutator = HFactory.createMutator(keyspaceOperator,
					StringSerializer.get());
			mutator.insert("jsmith", "users",
					HFactory.createStringColumn("first", "John"));

			ColumnQuery<String, String, String> columnQuery = HFactory
					.createStringColumnQuery(keyspaceOperator);
			columnQuery.setColumnFamily("users").setKey("jsmith")
					.setName("first");
			QueryResult<HColumn<String, String>> result = columnQuery.execute();

			System.out.println("Read HColumn from cassandra: " + result.get());
			System.out
					.println("Verify on CLI with: get DEMO.users['jsmith'] ");

		} catch (HectorException e) {
			e.printStackTrace();
		}
		cluster.getConnectionManager().shutdown();
	}

}

Happy Coding 🙂