Currently I am using Linux Mint 14 and Lubuntu 12.10, as we know, both of them using ubuntu as ancestor. I do not know this problem would raised if we using other linux distribution or no. I do not know what I had to do before, because I guess the problem is on the OS (silly guess, haha). but with a little surfing with my friend, I know the solution is quite simple. We just have to install these package from repository :
$ sudo apt-get install network-manager-pptp-gnome
for some vpn, they need (note : for me, above installation is enough)
$sudo apt-get install network-manager-openvpn-gnome
$sudo apt-get install network-manager-openvpn
JAXB stands for Java Architecture for XML Bindings. In a nutshell, JAXB used for convert Java Object to XML and vice versa. We called it marshalling to convert Java object to XML and unmarshalling to convert XML to Java object. JAXB bundled in Java 1.6++, so we do not need another external libraries (but sometimes I loved to adding testing and logging framework). First, you have to know the technology that I used in this tutorial are :
- Maven 3
- TestNG (for unit test)
Some of you would frown and said “hmm, why you put commons-io on this tutorial?”. Simple, I used it in unit-test to get xml file from resource folder and convert to String, I know it can be done with the classic inputstream ways. but remember to not reinventing the wheel 🙂
Continue reading JAXB Tutorial
By default, CXF will mapping CXFServlet to /cxf context path. I used Servicemix 4.5 which using CXF 2.7.3 inside. its define static in osgiservlet.xml in cxf-rt-transport-http (FYI, for CXF 2.7.3, they are using transport-http ver. 2.6.3). So, based on default configuration, all our CXF service will result like http://localhost:8181/cxf/myservice, this is not good. because sometimes you want define service itself.
Continue reading Change CXF based address in OSGI Service
I ever had a problem when want to using Jaxb in Servicemix 4.x which used OSGI. Like documentation describe on this page, we will know how to use Jaxb with apache camel. What we have to do is adding line below :
DataFormat jaxb = new JaxbDataFormat("com.foo.bar");
Above endpoint will route the jaxb unmarshal result to another queue. JaxbDataFormat will automatically search entity with JaxB @XMLRootElement inside package. But you will get a problem when implemented those code in OSGI. here is the error message :
Continue reading Problem using JaxB marshalling/unmarshalling within OSGI container
Have you ever get confused when trying TestNG for the first time? especially when want to make a unit test with some execution order? I have :). So, I made a little example to encounter those problem. As we know, TestNG has some annotation to point our method/class and indicate when the test will running. Some of which are :
- @BeforeSuite: The annotated method will be run before all tests in this suite have run.
- @BeforeTest: The annotated method will be run before any test method belonging to the classes inside the <test> tag is run.
- @BeforeGroups: The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.
- @BeforeClass: The annotated method will be run before the first test method in the current class is invoked.
- @BeforeMethod: The annotated method will be run before each test method.
Continue reading Execution Order Configuration with TestNG