Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Roadmap for a perspective Servicemix developer

THE POINT:

  • connect the dots between the documentation already existing on the Servicemix website
  • Give a developer interested in Servicemix a run through on getting the software up and running (with examples!)
  • Give the developer information on monitoring/configuring the software via jconsole

Conventions:

  1. 'company repository' = a remote Maven 2 repository used within your company to hold dependencies/artifacts.
  2. Wiki Markup
    \[Smix_source_folder\] = the location of the folder created after uncompressing the downloaded Smix source distribution (from .zip, .tar.gz etc.).
  3. Wiki Markup
    \[Servicemix_binary_distribution_home\] = installation location of the Smix binary distribution on your machine

NOTE: I am using apache-servicemix-3.0-incubating-20060907.104512-15-src.tar.gz for the following tutorial. If you do not use this snapshot release I cannot guarantee the following will work.

BEFORE STARTING:

  • You will need Maven 2 installed on your machine 

Getting the component dependencies into your local machine/company repository

...

You should now be able to 'mvn -Dmaven.test.skip=true deploy' and the dependencies will upload to the remote repository you defined. This is a good for thing when other people you are working with will need the Smix component dependencies. If others will be working on a Smix project you create it will also come in handy, as they will not have to chase down dependencies. THANKS MAVEN!!! I think there are other benefits too, such as faster fetching since the dependencies are more local (physically).

Next up install the compiled binary Servicemix...

Wiki Markup
You now have Smix built from source, and the Smix components in a Maven 2 repository. The built distribution of Smix will be in \[Smix_source_folder\]/apache-servicemix/target. There will be a source distribution that is like (exactly like?) the one which you downloaded, and the .zip, .tar.gzip binary distributions. Install the binary distribution following [these|http://servicemix.org/sm30ug/3-installation.html#3.Installation-UnixSourceInstallation] directions. Note those are for Unix, but you can follow the link and find directions for Windows. Once you have installed the binary Servicemix installation you are ready to do some testing.

 wsdl-first

Wiki Markup
The first thing to do now is install the [wsdl-first|http://servicemix.org/sm30ug/1-quick-start.html#1.Quickstart-Deployasampleapplication] service assembly (SA) which contains a few service units (SU's) ([See JBI specification document|https://sdlc6a.sun.com/ECom/EComActionServlet;jsessionid=728961EE41294F2FB2547B82D037F02E]). The end result is a XFire based SOAP service which is pretty simple. The actual code for the service is in the file \[Servicemix_binary_distribution_home\]/examples/wsdl-first/wsdl-first-jsr181-su/src/main/java/org/apache/servicemix/samples/wsdl_first/PersonImpl.java. Phew\! Take a look at the code, it is pretty simple. It uses an [annotation|http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html] which describes the class as a [jsr181|http://dev2dev.bea.com/webservices/jwsm.html] web service. One interesting thing to note about this project is the use of an ant task inside the parent pom.xml. This taks uses XFire's WsGenTask to create Java objects used by the web service, as described in the WSDL file.

Wiki Markup
So let's get this up and running in our Smix container. [Start|http://servicemix.org/sm30ug/1-quick-start.html#1.Quickstart-Starttheserver] Smix, watch the output to make sure things start up correctly. You will need to open up a new console for the next step, since the Smix output is taking up the other. You will be able to watch this output to see what is going on in some of the following steps. Go back to \[Servicemix_binary_distribution_home\]. You need to copy the components needed by the wsdl-first SA from the /components folder to the /install folder. The ones you should copy are:

  • servicemix-http-3.0-incubating-SNAPSHOT-installer.zip
  • servicemix-shared-3.0-incubating-SNAPSHOT-installer.zip
  • servicemix-jsr181-3.0-incubating-SNAPSHOT-installer.zip

With each copied component will come messages from Smix in the console output window. Watch these to make sure things properly install. If any problems crop up, try to copy the component again. I have received a zip related exception before. I did the copy a second time and the problem didn't show itself a second time.

Wiki Markup
There is an easy way to do the following: copy the file \[Servicemix_binary_distribution_home\]/examples/wsdl-first/wsdl-first-sa-3.0-incubating-SNAPSHOT.zip into the /install folder. Watch the Smix console window making sure things go well. You can now open a browser and go [here|http://localhost:8192/PersonService/main.wsdl] to see the WSDL for the SOAP service.

Wiki Markup
 That was the easy way....but you want to learn about developing so let's do it the 'hard' way. First go to the \[Servicemix_binary_distribution_home\]/examples/wsdl-first folder and type mvn install. This example project is using a [Maven 2 plugin|http://servicemix.org/site/maven-jbi-plugin.html] for creating specific JBI components. If you look in the module pom.xml files you will see a special packaging type. After the mvn install completes there will be file called wsdl-first-sa-3.0-incubating-SNAPSHOT-installer in the wsdl-first-sa module's target folder. This is SA for the wsdl-first example project. Now we want to deploy this to our container. The Maven JBI plugin will take care of this for us\!\!\! Note we need to make a small change to the wsdl-first-sa module's pom.xml. The plugin will normally try to install all the shared libraries needed by the SA when running the Maven goal jbi:projectDeploy. This is sometimes useful. But often it causes problems because another SA in Smix is using the shared lib already. In this case the Maven goal will try to remove and redeploy the shared lib from Smix. This causes a problem and will make the SA deployment fail. So to tell the plugin to not do this make the following change in the pom.xml:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>jbi-maven-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

---to--- 

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>jbi-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <deployDependencies>false</deployDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

 That little config change will prevent some headaches later.

You are ready to rock. Change directory to the wsdl-first-sa module. Type 'mvn jbi:projectDeploy'. You can watch the Smix console for information on the deployment.

Temporary excursion into monitoring

coming soon... 

Next up - the bridge example

coming soon....