...
Project name | maven command |
---|---|
reportincident.activemq | mvn clean install org.ops4j:maven-pax-plugin:eclipse |
reportincident.camelqueueservice | mvn clean install org.ops4j:maven-pax-plugin:eclipse |
reportincident.db | mvn clean install |
reportincident.features | mvn clean install |
reportincident.model | mvn clean install org.ops4j:maven-pax-plugin:eclipse |
reportincident.persistence | mvn clean install org.ops4j:maven-pax-plugin:eclipse |
reportincident.routing | mvn clean install org.ops4j:maven-pax-plugin:eclipse |
reportincident.service | mvn clean install org.ops4j:maven-pax-plugin:eclipse |
reportincident.web | mvn clean install |
reportincident.webservice | mvn clean install org.ops4j:maven-pax-plugin:eclipse |
...
Copy the files containing your properties file org.apache.camel.example.reportincident.datasource.cfg, ...
in the etc
directory of ServiceMix and cujstomize customize them if required
Step 2 : Edit the file org.apache.servicemix.features.cfg
...
Note |
---|
The deployment order of the bundle is critical in an OSGI environement. This is why for the purposes of this project/tutorial we have organised in consequence. If you plan to change something in the application, be aware of that |
Test it
Step 1 : launch application
It is time to launch the servicemix server and to test if our application works well. If this is not yet done, download ServiceMix Kernel 1.1.0 server and install it. Launch the server by executing the command in the bin
folder:
Code Block |
---|
c:\apache-servicemix-kernel-1.1.0\bin>servicemix
|
Info |
---|
If this is the first time that Servicemix is started, then you will see that a new
|
Step 2 : Check osgi list
When the following prompt appears on the screen :
Code Block |
---|
D:\Dvlpt\Java\workspace-ganymede\esb\apache-servicemix-kernel-1.2.0-SNAPSHOT\bin>servicemix
____ _ __ __ _
/ ___| ___ _ ____ _(_) ___ ___| \/ (_)_ __
\___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ /
___) | __/ | \ V /| | (_| __/ | | | |> <
|____/ \___|_| \_/ |_|\___\___|_| |_|_/_/\_\
ServiceMix Kernel (1.2.0-SNAPSHOT)
Type 'help' for more information.
--------------------------------------------------------------------------------------------
smx@root:/>
|
execute the following commands :
Code Block |
---|
smx@root:/> osgi
smx@root:osgi> list
|
Tip |
---|
During the first launch of SMX, it will install the bundles. Around 110 bundles have to be installed/deployed, so be patient because it can take time depending of your internet connection, cpu, processor of your machine. |
but after a few minutes, you must see the following list
Code Block |
---|
smx@root:osgi> list
START LEVEL 100
ID State Spring Level Name
[ 0] [Active ] [ ] [ 0] System Bundle (1.5.0.r752991)
[ 1] [Active ] [ ] [ 10] Apache Felix Prefrences Service (1.0.2)
[ 2] [Active ] [ ] [ 10] Apache ServiceMix Specs :: JAXP API 1.4 (1.4.0.SNAPSHOT)
[ 3] [Active ] [ ] [ 10] geronimo-annotation_1.0_spec (1.1.1)
[ 4] [Active ] [ ] [ 10] OSGi R4 Compendium Bundle (4.1.0)
[ 5] [Active ] [ ] [ 10] Apache ServiceMix Bundles: jaxp-ri-1.4.2 (1.4.2.1)
[ 6] [Active ] [ ] [ 10] Apache Felix Configuration Admin Service (1.0.4)
[ 7] [Active ] [ ] [ 10] geronimo-servlet_2.5_spec (1.1.2)
[ 8] [Active ] [Started] [ 40] Apache ServiceMix Kernel :: GShell Core (1.2.0.SNAPSHOT)
[ 9] [Active ] [ ] [ 8] OPS4J Pax Logging - API (1.3.0)
[ 10] [Active ] [ ] [ 8] OPS4J Pax Logging - Service (1.3.0)
[ 11] [Active ] [ ] [ 5] OPS4J Pax Url - wrap: (0.3.3)
[ 12] [Active ] [ ] [ 5] OPS4J Pax Url - mvn: (0.3.3)
[ 13] [Active ] [ ] [ 30] Apache ServiceMix Kernel :: GShell Features (1.2.0.SNAPSHOT)
[ 14] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: GShell OSGi Commands (1.2.0.SNAPSHOT)
[ 15] [Active ] [ ] [ 30] Apache ServiceMix Bundles: mina-1.1.7 (1.1.7.1)
[ 16] [Active ] [ ] [ 30] spring-osgi-extender (1.2.0.rc1)
[ 17] [Active ] [ ] [ 30] Spring Context (2.5.6)
[ 18] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: GShell PackageAdmin Commands (1.2.0.SNAPSHOT)
[ 19] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: GShell ConfigAdmin Commands (1.2.0.SNAPSHOT)
[ 20] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: JAAS Config (1.2.0.SNAPSHOT)
[ 21] [Active ] [ ] [ 30] Apache ServiceMix Bundles: commons-jexl-1.1 (1.1.0.1)
[ 22] [Active ] [ ] [ 30] Apache ServiceMix Bundles: commons-httpclient-3.1 (3.1.0.1)
[ 23] [Active ] [ ] [ 30] Spring Core (2.5.6)
[ 24] [Active ] [ ] [ 30] jmx-impl (1.0.0.r6125-patched)
[ 25] [Active ] [ ] [ 30] spring-osgi-io (1.2.0.rc1)
[ 26] [Active ] [ ] [ 30] jmx (1.0.0.r6125-patched)
[ 27] [Active ] [ ] [ 30] spring-osgi-core (1.2.0.rc1)
[ 28] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: JAAS Modules (1.2.0.SNAPSHOT)
[ 29] [Active ] [ ] [ 30] Apache ServiceMix Bundles: commons-vfs-1.0 (1.0.0.1)
[ 30] [Active ] [ ] [ 30] Spring Beans (2.5.6)
[ 31] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: GShell Admin (1.2.0.SNAPSHOT)
[ 32] [Active ] [ ] [ 30] Unnamed - com.google.code.sshd:sshd:bundle:0.1 (0.1)
[ 33] [Active ] [ ] [ 30] Apache ServiceMix Bundles: commons-codec-1.2 (1.2.0.1)
[ 34] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: GShell Log Commands (1.2.0.SNAPSHOT)
[ 35] [Active ] [ ] [ 30] Apache ServiceMix Bundles: jline-0.9.94 (0.9.94.1)
[ 36] [Active ] [ ] [ 30] Apache ServiceMix Bundles: aopalliance-1.0 (1.0.0.1)
[ 37] [Active ] [ ] [ 30] Spring AOP (2.5.6)
[ 38] [Active ] [ ] [ 30] Apache ServiceMix Bundles: cglib-2.1_3 (2.1.0.3_2-SNAPSHOT)
[ 39] [Active ] [ ] [ 30] Apache ServiceMix Bundles: oro-2.0.8 (2.0.8.1)
[ 40] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: Spring Deployer (1.2.0.SNAPSHOT)
[ 41] [Active ] [Started] [ 30] Apache ServiceMix Kernel :: Management (1.2.0.SNAPSHOT)
[ 42] [Active ] [ ] [ 15] Apache ServiceMix Kernel :: File Monitor (1.2.0.SNAPSHOT)
[ 43] [Active ] [ ] [ 60] Apache ServiceMix Bundles: jaxb-impl-2.1.6 (2.1.6.1)
[ 44] [Active ] [ ] [ 60] Apache ServiceMix Specs :: ACTIVATION API 1.4 (1.2.0)
[ 45] [Active ] [ ] [ 60] Apache ServiceMix Specs :: JAXB API 2.1 (1.2.0)
[ 46] [Active ] [ ] [ 60] Commons Collections (3.2.1)
[ 47] [Active ] [ ] [ 60] Commons Lang (2.4)
[ 48] [Active ] [ ] [ 60] Apache Commons Pool Bundle (1.4)
[ 49] [Active ] [ ] [ 60] Apache ServiceMix Bundles: asm-2.2.3 (2.2.3.1)
[ 50] [Active ] [ ] [ 60] geronimo-jta_1.1_spec (1.1.1)
[ 51] [Active ] [ ] [ 60] geronimo-j2ee-connector_1.5_spec (2.0.0)
[ 52] [Active ] [ ] [ 60] Apache ServiceMix Bundles: howl-1.0.1-1 (1.0.1.1_1)
[ 53] [Active ] [ ] [ 60] Geronimo TxManager :: Transaction (2.2.0.r634076)
[ 54] [Active ] [ ] [ 60] Spring Transaction (2.5.6)
[ 55] [Active ] [Started] [ 60] Apache ServiceMix Transaction (1.0.0)
[ 56] [Active ] [ ] [ 60] Geronimo TxManager :: Connector (2.2.0.r634076)
[ 57] [Active ] [ ] [ 60] geronimo-jms_1.1_spec (1.1.1)
[ 58] [Active ] [ ] [ 60] Apache ServiceMix Bundles: jencks-2.1 (2.1.0.1)
[ 59] [Active ] [ ] [ 60] geronimo-j2ee-management_1.1_spec (1.0.1)
[ 60] [Active ] [ ] [ 60] xbean-spring (3.4.3)
[ 61] [Active ] [ ] [ 60] activemq-core (5.2.0)
[ 62] [Active ] [ ] [ 60] activemq-ra (5.2.0)
[ 63] [Active ] [ ] [ 60] activemq-console (5.2.0)
[ 64] [Active ] [ ] [ 60] activemq-pool (5.2.0)
[ 65] [Active ] [Started] [ 60] Apache ServiceMix Features :: ActiveMQ Commands (4.0.0)
[ 66] [Active ] [ ] [ 60] Apache ServiceMix Bundles: jetty-6.1.14 (6.1.14.1)
[ 67] [Active ] [ ] [ 60] OPS4J Pax Web - Web Container (0.6.0)
[ 68] [Active ] [ ] [ 60] OPS4J Pax Web - Jsp Support (0.6.0)
[ 69] [Active ] [ ] [ 60] OPS4J Pax Web Extender - WAR (0.5.1)
[ 70] [Active ] [ ] [ 60] OPS4J Pax Web Extender - Whiteboard (0.5.1)
[ 71] [Active ] [ ] [ 60] OPS4J Pax Url - war:, war-i: (0.4.0)
[ 72] [Active ] [Started] [ 60] Apache ServiceMix WAR Deployer (4.0.0)
[ 73] [Active ] [ ] [ 60] Spring Web (2.5.6)
[ 74] [Active ] [ ] [ 60] spring-osgi-web (1.2.0.rc1)
[ 75] [Active ] [ ] [ 60] Wicket (1.3.5)
[ 76] [Active ] [ ] [ 60] Wicket IoC common code (1.3.5)
[ 77] [Active ] [ ] [ 60] Wicket Spring Integration (1.3.5)
[ 78] [Active ] [ ] [ 60] Wicket Spring Integration through Annotations (1.3.5)
[ 79] [Active ] [ ] [ 60] Wicket Extensions (1.3.5)
[ 80] [Active ] [ ] [ 60] Apache ServiceMix Bundles: FastInfoset-1.2.2 (1.2.2.1)
[ 81] [Active ] [ ] [ 60] Apache ServiceMix Bundles: xmlsec-1.3.0 (1.3.0.1)
[ 82] [Active ] [ ] [ 60] Apache ServiceMix Bundles: wss4j-1.5.4 (1.5.4.1)
[ 83] [Active ] [ ] [ 60] Apache ServiceMix Bundles: xmlbeans-2.4.0 (2.4.0.1)
[ 84] [Active ] [ ] [ 60] Apache ServiceMix Bundles: xmlresolver-1.2 (1.2.0.1)
[ 85] [Active ] [ ] [ 60] Apache ServiceMix Bundles: xmlschema-1.4.2 (1.4.2.1)
[ 86] [Active ] [ ] [ 60] Apache ServiceMix Bundles: ant-1.7.0 (1.7.0.1)
[ 87] [Active ] [ ] [ 60] Apache ServiceMix Bundles: jdom-1.1 (1.1.0.1)
[ 88] [Active ] [ ] [ 60] Apache ServiceMix Bundles: werken-xpath-0.9.4 (0.9.4.1)
[ 89] [Active ] [ ] [ 60] Apache ServiceMix Bundles: neethi-2.0.4 (2.0.4.1)
[ 90] [Active ] [ ] [ 60] Apache ServiceMix Bundles: abdera-0.4.0-incubating (0.4.0.incubating_1)
[ 91] [Active ] [ ] [ 60] Apache ServiceMix Bundles: junit-4.4 (4.4.0.1)
[ 92] [Active ] [ ] [ 60] Apache ServiceMix Bundles: antlr-3.0.1 (3.0.1.1)
[ 93] [Active ] [ ] [ 60] Apache ServiceMix Bundles: commons-io-1.3.2 (1.3.2.1)
[ 94] [Active ] [ ] [ 60] Apache ServiceMix Specs :: JAVAMAIL API 1.4 (1.2.0)
[ 95] [Active ] [ ] [ 60] Apache ServiceMix Specs :: JAXWS API 2.1 (1.2.0)
[ 96] [Active ] [ ] [ 60] Apache ServiceMix Specs :: SAAJ API 1.3 (1.2.0)
[ 97] [Active ] [ ] [ 60] Apache ServiceMix Bundles: wsdl4j-1.6.1 (1.6.1.1)
[ 98] [Active ] [ ] [ 60] geronimo-ws-metadata_2.0_spec (1.1.2)
[ 99] [Active ] [ ] [ 60] Apache CXF Bundle Jar (2.2)
[ 100] [Active ] [Started] [ 60] Apache ServiceMix CXF Transport for OSGi (4.0.0)
[ 101] [Active ] [ ] [ 60] camel-core (2.0.0.M1)
[ 102] [Active ] [ ] [ 60] camel-spring (2.0.0.M1)
[ 103] [Active ] [ ] [ 60] camel-osgi (2.0.0.M1)
[ 104] [Active ] [ ] [ 60] camel-bindy (2.0.0.M1)
[ 105] [Active ] [ ] [ 60] Spring JMS (2.5.6)
[ 106] [Active ] [ ] [ 60] camel-jms (2.0.0.M1)
[ 107] [Active ] [ ] [ 60] camel-cxf (2.0.0.M1)
[ 108] [Active ] [ ] [ 60] activemq-camel (5.2.0)
[ 109] [Active ] [ ] [ 60] Apache ServiceMix Bundles: commons-dbcp-1.2.2 (1.2.2.3)
[ 110] [Active ] [ ] [ 60] MySQL AB's JDBC Driver for MySQL (5.1.6)
[ 111] [Active ] [ ] [ 60] Spring ORM (2.5.6)
[ 112] [Active ] [ ] [ 60] Spring JDBC (2.5.6)
[ 113] [Active ] [ ] [ 60] Apache ServiceMix Bundles: dom4j-1.6.1 (1.6.0.SNAPSHOT)
[ 114] [Active ] [ ] [ 60] ANTLR (2.7.7)
[ 115] [Active ] [ ] [ 60] JGroups Toolkit (2.5.1)
[ 116] [Active ] [ ] [ 60] Javassist Java Programming Assistant (3.3.0.ga)
[ 117] [Active ] [ ] [ 60] JBoss Hibernate Object-Relational Mapper (3.3.1.GA)
[ 134] [Active ] [Started] [ 60] ActiveMQ Queuing engine (1.0.0.SNAPSHOT)
[ 135] [Active ] [Started] [ 60] Camel Queuing Service (1.0.0.SNAPSHOT)
[ 136] [Active ] [ ] [ 60] Report Incident Model Bundle (1.0.0.SNAPSHOT)
[ 137] [Active ] [Started] [ 60] Report Incident Persistence Bundle (1.0.0.SNAPSHOT)
[ 138] [Active ] [Started] [ 60] reportincident.service (1.0.0.SNAPSHOT)
[ 139] [Active ] [ ] [ 60] Report Incident Webservice Bundle (1.0.0.SNAPSHOT)
[ 140] [Active ] [Started] [ 60] Report Incident Routing Bundle (1.0.0.SNAPSHOT)
[ 141] [Active ] [ ] [ 60] Report Incident Web Bundle (1.0.0.SNAPSHOT)
|
Warning | ||||
---|---|---|---|---|
If errors happen during installation of the bundles, the list could be not completed. In this case, the feature provisioning system has stopped the installation. You have to check the log file of servicemix and depending of the error reported, correction made, the installation can be relaunched in the menu 'feature' using the command :
If a problem occurs with a bundle, you can by example recompile the code, regenerate the jar and update the bundle using the command
where xxx corresponds to the bundle to be updated |
The features list can also be very helpfull to see which features has been installed
Code Block |
---|
smx@root:features> list
State Version Name
[installed ] [ 0.0.0] hibernate
[installed ] [ 0.0.0] web-core
[installed ] [ 2.2] cxf
[installed ] [ 0.0.0] common
[installed ] [ 0.0.0] transaction
[installed ] [ 0.0.0] camel-activemq
[installed ] [ 0.0.0] web
[installed ] [ 1.0] reportincident
[installed ] [ 0.0.0] cxf-osgi
[installed ] [ 0.0.0] spring-web
[installed ] [ 0.0.0] camel-spring
[installed ] [ 2.0-M1] camel
[installed ] [ 0.0.0] camel-core
[installed ] [ 0.0.0] camel-bindy
[installed ] [ 5.2.0] activemq
[installed ] [ 0.0.0] connector
[installed ] [ 0.0.0] camel-osgi
[installed ] [ 0.0.0] wicket
[installed ] [ 0.0.0] jdbc-driver
[installed ] [ 0.0.0] camel-jms
[installed ] [ 0.0.0] camel-cxf
|
Step 3 : Incident file
To test the Camel routing, we have to produce an incident file report and put it in the file defined in the from uri of your inittial route. Create a file containing csv lines :
Code Block |
---|
001,29-04-2009,Claus,Ibsen,incident camel-001,this is a report incident for camel-001,cibsen@gmail.com,+111 10 20 300
002,29-04-2009,Charles,Moulliard,incident smx-002,this is a report incident for smx-002,cmoulliard@gmail.com,+222 10 20 300
003,28-04-2009,Guillaume,Nodet,incident camel-123,this is a report incident for camel-123,gnodet@gmail.com,+333 10 20 300
004,25-04-2009,Gert,Vanthienen,incident camel-454,this is a report incident for camel-454,gvanthienen@gmail.com,+444 10 20 300
005,24-04-2009,James,Anstey,incident smx-023,this is a report incident for smx-023,janstey@gmail.com,+555 10 20 300
007,01-04-2009,Willem,Jiang,incident smx-456,this is a report incident for smx-456,wjiang@gmail.com,+666 10 20 300
008,27-04-2009,Matt,Raibble,incident appfuse-123,this is a report incident for appfuse-123,mraibble@gmail.com,+777 10 20 300
009,12-04-2009,Jean-Baptiste,Onofré,incident smx3-088,this is a report incident for smx3-088,cjbonofre@gmail.com,+888 10 20 300
010,17-04-2009,Hadrian,Zbarcea,incident camel-005,this is a report incident for camel-005,hzbarcea@gmail.com,+999 10 20 300
|
Save your file and copy it in the folder
Check the log of SMX and you must see something like this
Next, open the web page of your application : http://localhost:8080/reportincidentweb/
Step 4 : Call a webservice
You can use the tool Soapui to call the web service of the application.
Use the following url from Soapui, to generate the client interface to communicate with the web service : http://localhost:8080/cxf/camel-example/incident?wsdl.
Call the web service with the request : http://localhost:8080/cxf/camel-example/incident
and the following SOAP message request by example :
...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep="http://reportincident.example.camel.apache.org">
<soapenv:Header/>
<soapenv:Body>
<rep:inputReportIncident>
<incidentId>000</incidentId>
<incidentDate>29-04-2009</incidentDate>
<givenName>Charles</givenName>
<familyName>Moulliard</familyName>
<summary>This is an web service report incident</summary>
<details>This is an web service report incident,This is an web service report incident.</details>
<email>cmoulliard@gmail.com</email>
<phone>+222 10 20 30 40</phone>
</rep:inputReportIncident>
</soapenv:Body>
</soapenv:Envelope>
Check the Servicemix log :
and web screen result : http://localhost:8080/reportincidentweb/
Conclusion
Well, this tutorial was a little bit long but we have tried to provide you all the required information to design a real application using Apache Camel, ServiceMix, OSGI, CXF and Apache Wicket frameworks. We hope that we have reached the goals defined in the introduction and will continue to improve its content based on Apache frameworks evolution. A part which is not covered but we plan to add it in the future concerns the testing/debugging of the application and transactional aspects.
Links
- Part 1 : simple example
- Part 2a : real example, architecture, project setup, database creation
- Part 2b : transform projects in bundles
- Part 2c : add infrastructure and routing
- Part 2d : web and deployment
#Resources
Attachments patterns .*part2.zip
...