If you need to run JConsole with JTop, all you have to use
is the following command and it will appear as a new tab on
JConsole.
$ jconsole -pluginpath JDK_HOME/demo/management/JTop/JTop.jar
Thursday, July 29, 2010
How to run JConsole with JTop
Tuesday, July 20, 2010
How to resolve error referring to the text "ap_cache_cacheable_hdrs_out" when starting Apache HTTP Server
I came across a need to enable the following links for the Apache HTTP Server, in order to enable response caching. Go to /etc/apache2 folder and give the following commands.
ln -s ../mods-available/file_cache.load file_cache.load
ln -s ../mods-available/mem_cache.conf mem_cache.conf
ln -s ../mods-available/mem_cache.load mem_cache.load
Once the above links were created, I tried to restart the server and it threw the following error
* Starting web server apache2
apache2: Syntax error on line 204 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/mods-enabled/mem_cache.load: Cannot load /usr/lib/apache2/modules/mod_mem_cache.so into server: /usr/lib/apache2/modules/mod_mem_cache.so: undefined symbol: ap_cache_cacheable_hdrs_out [fail]
To resolve this all I had to do was, add the following line to the apach2.conf file before # Include module configuration: section
LoadModule cache_module /usr/lib/apache2/modules/mod_cache.so
ln -s ../mods-available/file_cache.load file_cache.load
ln -s ../mods-available/mem_cache.conf mem_cache.conf
ln -s ../mods-available/mem_cache.load mem_cache.load
Once the above links were created, I tried to restart the server and it threw the following error
* Starting web server apache2
apache2: Syntax error on line 204 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/mods-enabled/mem_cache.load: Cannot load /usr/lib/apache2/modules/mod_mem_cache.so into server: /usr/lib/apache2/modules/mod_mem_cache.so: undefined symbol: ap_cache_cacheable_hdrs_out [fail]
To resolve this all I had to do was, add the following line to the apach2.conf file before # Include module configuration: section
LoadModule cache_module /usr/lib/apache2/modules/mod_cache.so
Friday, July 16, 2010
How to generate HTTP 1.0 requests
While verifying some scenarios with WSO2 ESB I had the need to send HTTP 1.0 POST messages. Then came cURL to the rescue. I just had to use the option -0 or --http1.0 when sending the request like shown below.
$ curl -s "http://localhost:8280/services/Axis2Service" -d @soap11_echoString.xml -H "Content-Type:text/xml; charset=UTF-8" -H "SOAPAction: urn:echoString" -0
Or
$ curl -s "http://localhost:8280/services/Axis2Service" -d @soap11_echoString.xml -H "Content-Type:text/xml; charset=UTF-8" -H "SOAPAction: urn:echoString" --http1.0
When viewed through TCPMon, you will see how it sends a HTTP 1.0 message
POST /services/Axis2Service HTTP/1.0
User-Agent: curl/7.18.2 (x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10
Host: 127.0.0.1:7001
Accept: */*
Content-Type:text/xml; charset=UTF-8
SOAPAction: urn:echoString
Content-Length: 273
<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ser:echoString xmlns:ser="http://service.carbon.wso2.org">
<ser:s>Hello!!!</ser:s>
</ser:echoString>
</soap:Body>
</soap:Envelope>
$ curl -s "http://localhost:8280/services/Axis2Service" -d @soap11_echoString.xml -H "Content-Type:text/xml; charset=UTF-8" -H "SOAPAction: urn:echoString" -0
Or
$ curl -s "http://localhost:8280/services/Axis2Service" -d @soap11_echoString.xml -H "Content-Type:text/xml; charset=UTF-8" -H "SOAPAction: urn:echoString" --http1.0
When viewed through TCPMon, you will see how it sends a HTTP 1.0 message
POST /services/Axis2Service HTTP/1.0
User-Agent: curl/7.18.2 (x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10
Host: 127.0.0.1:7001
Accept: */*
Content-Type:text/xml; charset=UTF-8
SOAPAction: urn:echoString
Content-Length: 273
<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ser:echoString xmlns:ser="http://service.carbon.wso2.org">
<ser:s>Hello!!!</ser:s>
</ser:echoString>
</soap:Body>
</soap:Envelope>
Tuesday, July 6, 2010
Making the resources of a WSO2 ESB READ-WRITE node available in the READ-ONLY node of a cluster
If you have a cluster of WSO2 ESB nodes and if you need to make the resources of the READ_WRITE node available on the READ-ONLY nodes all you have to do is set up a property in the carbon.xml. For the WSO2 ESB instances to be in a cluster, you need to have a WSO2 Governance Registry instance as well since in 3.0.x family, the resource that are created in WSO2 ESB are saved to a configuration/governance registry. In order to witness this, following steps should be followed.
Step 1 - Setting up the governance and configuration registry instances
a) Download the latest WSO2 Governance Registry distribution from here.
b) Extract the downloaded WSO2 Governance Registry distribution to two separate directories.
E.g.: - Extract the distribution to a folder named config-reg and gov-reg
c) Change the http/https ports (of the mgt-transports.xml) of these two instances so that it is possible for you to start the two registry instances on the same machine.
E.g. :- Assume that the ports were configured as below
Governance registry
- HTTP port - 9763
- HTTPS port - 9443
Configuration registry
- HTTP port - 9764
- HTTPS port - 9444
d) Change the registry.xml files of the governance and configuration registries as follows to connect to an external database (Let us assume that the two registry instances will be connected to two separate MySQL databases)
i) Add the following dbConfig to the registry.xml of the governance registry instance (gov-reg)
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
ii) Add the following two dbConfig configurations to the registry.xml of the configuration registry instance (config-reg)
<dbconfig name="config_registry">
<url>jdbc:mysql://10.100.1.153:3306/reg_config_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
iii) In addition to the above add the following configuration to the registry.xml of the configuration registry (config-reg). This configuration will be used to mount the governance registry instance to this particular configuration registry instance.
<remoteinstance url="">:9443/gov/registry">
<id>gov_reg</id>
<dbconfig>gov_registry</dbconfig>
<readonly>false</readonly>
<registryroot>/</registryroot>
</remoteinstance>
<mount path="/_system/governance" overwrite="true">
<instanceid>gov_reg</instanceid>
<targetpath>/_system/governance</targetpath>
</mount>
e) Once the above configration are done, start the governance registry instance and the configuration registry instances
Step 2 - Setting up the WSO2 ESB READ-WRITE instance
a) Download the latest WSO2 ESB instance from here and extract it to a folder of your choice.
E.g. - Extract the distribution to a folder named esb-rw
b) Change the ports of the WSO2 ESB instance
E.g. :- Assume that the ports were configured as below
- HTTP port - 9761
- HTTPS port - 9441
c) Leave the default dbConfig section as it is and add the following to the registry.xml file.
<dbconfig name="config_registry">
<url>jdbc:mysql://localhost:3306/reg_config_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
d) Additionally, add the following configuration to the registry.xml inorder to mount the governance and configuration registries to the WSO2 ESB READ-WRITE instance
<remoteinstance url="https://localhost:9444/config/registry">
<id>config_reg</id>
<dbconfig>config_registry</dbconfig>
<readonly>false</readonly>
<registryroot>/</registryroot>
</remoteinstance>
<mount path="/_system/governance" overwrite="true">
<instanceid>gov_reg</instanceid>
<targetpath>/_system/governance</targetpath>
</mount>
<mount path="/_system/config" overwrite="true">
<instanceid>config_reg</instanceid>
<targetpath>/_system/nodes</targetpath>
</mount>
<remoteinstance url="https://localhost:9443/gov/registry">
<id>gov_reg</id>
<dbconfig>gov_registry</dbconfig>
<readonly>false</readonly>
<registryroot>/</registryroot>
</remoteinstance>
e) Next, enable clustering by uncommenting the following section of the axis2.xml
<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">
:
:
</clustering>
Step 3 - Setting up the WSO2 ESB READ-ONLY instance
a) Extract the downloaded WSO2 ESB instance to another folder of your choice.
E.g. - Extract the distribution to a folder named esb-ro
b) Change the ports of the WSO2 ESB instance
E.g. :- Assume that the ports were configured as below
- HTTP port - 9762
- HTTPS port - 9443
c) Leave the default dbConfig section as it is and add the following to the registry.xml file.
<dbconfig name="config_registry">
<url>jdbc:mysql://localhost:3306/reg_config_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
d) Additionally, add the following configuration to the registry.xml inorder to mount the governance and configuration registries to the WSO2 ESB READ-WRITE instance
<remoteinstance url="https://localhost:9444/config/registry">
<id>config_reg</id>
<dbconfig>config_registry</dbconfig>
<readonly>true</readonly>
<registryroot>/</registryroot>
</remoteinstance>
<mount path="/_system/governance" overwrite="true">
<instanceid>gov_reg</instanceid>
<targetpath>/_system/governance</targetpath>
</mount>
<mount path="/_system/config" overwrite="true">
<instanceid>config_reg</instanceid>
<targetpath>/_system/nodes</targetpath>
</mount>
<remoteinstance url="https://localhost:9443/gov/registry">
<id>gov_reg</id>
<dbconfig>gov_registry</dbconfig>
<readonly>true</readonly>
<registryroot>/</registryroot>
</remoteinstance>
e) Next, enable clustering by uncommenting the following section of the axis2.xml (This is required ONLY in a state-full setup)
<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">
:
:
</clustering>
f) Inorder for the resources that are in the READ-WRITE instance to be available in the READ-ONLY node, the following configuration should be added to the carbon.xml
<mediationconfig>
<loadfromregistry>true</loadfromregistry>
</mediationconfig>
Step 4 - Creating resources in the READ-WRITE instance
Once the configuration are properly done, start the READ-WRITE WSO2 ESB instance.
user@user-laptop:~/opt/esbrw/wso2esb-3.0.0/bin $ sh ./wso2server.sh
Now create some resources (Sequences, Endpoints, Proxy Services,etc) by logging into the Management Console
Step 5 - Witnessing the resources of the READ-WRITE instance in the READ-ONLY node
Finally, start the READ-ONLY instance and you will see the resources that were created through the READ-WRITE available through the READ-ONLY node
user@user-laptop:~/opt/esbr0/wso2esb-3.0.0/bin $ sh ./wso2server.sh
Step 1 - Setting up the governance and configuration registry instances
a) Download the latest WSO2 Governance Registry distribution from here.
b) Extract the downloaded WSO2 Governance Registry distribution to two separate directories.
E.g.: - Extract the distribution to a folder named config-reg and gov-reg
c) Change the http/https ports (of the mgt-transports.xml) of these two instances so that it is possible for you to start the two registry instances on the same machine.
E.g. :- Assume that the ports were configured as below
Governance registry
- HTTP port - 9763
- HTTPS port - 9443
Configuration registry
- HTTP port - 9764
- HTTPS port - 9444
d) Change the registry.xml files of the governance and configuration registries as follows to connect to an external database (Let us assume that the two registry instances will be connected to two separate MySQL databases)
i) Add the following dbConfig to the registry.xml of the governance registry instance (gov-reg)
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
ii) Add the following two dbConfig configurations to the registry.xml of the configuration registry instance (config-reg)
<dbconfig name="config_registry">
<url>jdbc:mysql://10.100.1.153:3306/reg_config_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
iii) In addition to the above add the following configuration to the registry.xml of the configuration registry (config-reg). This configuration will be used to mount the governance registry instance to this particular configuration registry instance.
<remoteinstance url="">:9443/gov/registry">
<id>gov_reg</id>
<dbconfig>gov_registry</dbconfig>
<readonly>false</readonly>
<registryroot>/</registryroot>
</remoteinstance>
<mount path="/_system/governance" overwrite="true">
<instanceid>gov_reg</instanceid>
<targetpath>/_system/governance</targetpath>
</mount>
e) Once the above configration are done, start the governance registry instance and the configuration registry instances
Step 2 - Setting up the WSO2 ESB READ-WRITE instance
a) Download the latest WSO2 ESB instance from here and extract it to a folder of your choice.
E.g. - Extract the distribution to a folder named esb-rw
b) Change the ports of the WSO2 ESB instance
E.g. :- Assume that the ports were configured as below
- HTTP port - 9761
- HTTPS port - 9441
c) Leave the default dbConfig section as it is and add the following to the registry.xml file.
<dbconfig name="config_registry">
<url>jdbc:mysql://localhost:3306/reg_config_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
d) Additionally, add the following configuration to the registry.xml inorder to mount the governance and configuration registries to the WSO2 ESB READ-WRITE instance
<remoteinstance url="https://localhost:9444/config/registry">
<id>config_reg</id>
<dbconfig>config_registry</dbconfig>
<readonly>false</readonly>
<registryroot>/</registryroot>
</remoteinstance>
<mount path="/_system/governance" overwrite="true">
<instanceid>gov_reg</instanceid>
<targetpath>/_system/governance</targetpath>
</mount>
<mount path="/_system/config" overwrite="true">
<instanceid>config_reg</instanceid>
<targetpath>/_system/nodes</targetpath>
</mount>
<remoteinstance url="https://localhost:9443/gov/registry">
<id>gov_reg</id>
<dbconfig>gov_registry</dbconfig>
<readonly>false</readonly>
<registryroot>/</registryroot>
</remoteinstance>
e) Next, enable clustering by uncommenting the following section of the axis2.xml
<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">
:
:
</clustering>
Step 3 - Setting up the WSO2 ESB READ-ONLY instance
a) Extract the downloaded WSO2 ESB instance to another folder of your choice.
E.g. - Extract the distribution to a folder named esb-ro
b) Change the ports of the WSO2 ESB instance
E.g. :- Assume that the ports were configured as below
- HTTP port - 9762
- HTTPS port - 9443
c) Leave the default dbConfig section as it is and add the following to the registry.xml file.
<dbconfig name="config_registry">
<url>jdbc:mysql://localhost:3306/reg_config_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
<dbconfig name="gov_registry">
<url>jdbc:mysql://localhost:3306/reg_gov_db</url>
<username>wso2</username>
<password>wso2</password>
<drivername>com.mysql.jdbc.Driver</drivername>
<maxactive>50</maxactive>
<maxwait>60000</maxwait>
<minidle>5</minidle>
</dbconfig>
d) Additionally, add the following configuration to the registry.xml inorder to mount the governance and configuration registries to the WSO2 ESB READ-WRITE instance
<remoteinstance url="https://localhost:9444/config/registry">
<id>config_reg</id>
<dbconfig>config_registry</dbconfig>
<readonly>true</readonly>
<registryroot>/</registryroot>
</remoteinstance>
<mount path="/_system/governance" overwrite="true">
<instanceid>gov_reg</instanceid>
<targetpath>/_system/governance</targetpath>
</mount>
<mount path="/_system/config" overwrite="true">
<instanceid>config_reg</instanceid>
<targetpath>/_system/nodes</targetpath>
</mount>
<remoteinstance url="https://localhost:9443/gov/registry">
<id>gov_reg</id>
<dbconfig>gov_registry</dbconfig>
<readonly>true</readonly>
<registryroot>/</registryroot>
</remoteinstance>
e) Next, enable clustering by uncommenting the following section of the axis2.xml (This is required ONLY in a state-full setup)
<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">
:
:
</clustering>
f) Inorder for the resources that are in the READ-WRITE instance to be available in the READ-ONLY node, the following configuration should be added to the carbon.xml
<mediationconfig>
<loadfromregistry>true</loadfromregistry>
</mediationconfig>
Step 4 - Creating resources in the READ-WRITE instance
Once the configuration are properly done, start the READ-WRITE WSO2 ESB instance.
user@user-laptop:~/opt/esbrw/wso2esb-3.0.0/bin $ sh ./wso2server.sh
Now create some resources (Sequences, Endpoints, Proxy Services,etc) by logging into the Management Console
Step 5 - Witnessing the resources of the READ-WRITE instance in the READ-ONLY node
Finally, start the READ-ONLY instance and you will see the resources that were created through the READ-WRITE available through the READ-ONLY node
user@user-laptop:~/opt/esbr0/wso2esb-3.0.0/bin $ sh ./wso2server.sh
Subscribe to:
Posts (Atom)