Friday, August 21, 2015

Apache Commons Logging troubleshoot for WSO2 servers

Have you encountered a situation where Apache Commons Logging doesn't work for your new project/module when running in WSO2 servers? Here's the troubleshoot.
  • Make sure you have the maven dependencies.
  • If you choose to have a different package name other than starting with "org.wso2.carbon" then you need to configure it in the <CARBON_HOME>/repository/conf/log4j.properties file.
    • Lest assume your new project package name is "com.my.example"
    • For debug logs, add the below line to log4j.properties file.
      • log4j.logger.com.my.example=DEBUG

Cheers!! Happy coding!

Monday, August 10, 2015

Creating new Oracle database and connecting it with WSO2 products

When we deal with oracle, creating a new database means creating a new user to hold the tables, therefore let's first create a new user in the oracle database and then connect the bps product as an example.
  • Connect to the oracle database using the following command.
    • CONNECT sys AS sysdba;
    • Enter the password when requested.
  • Now let's create a new user with the name "bps" and password "password".
    • CREATE USER bps IDENTIFIED BY password;
  • Now in-order to create tables we must first grant permission to newly created user using the below command.
    • GRANT ALL PRIVILEGES TO bps;
Now Let's connect the BPS product to newly created oracle user.
  • Modify the below parameters in <BPS_HOME>/repository/conf/datasources/bps-datasources.xml as follows.
                    <url>jdbc:oracle:thin:bps@localhost:1521/xe</url>
                    <username>bps</username>
                    <password>password</password>
                    <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
    • Leave the other parameters as it is.
  • Copy the ojdbc.jar to  <BPS_HOME>/repository/components/lib/ folder.
  • Restart the BPS server with -Dsetup.
    • sh wso2server.sh -Dsetup

Cheers !!