Thursday, October 8, 2015

How to solve "SEVERE: One or more listener failed to start" error message in Tomcat startup log" when deploy and run OLAT application?

Startup the OpenOlat application on Tomcat server, encounter the error as described below. No clue of what could be the reason.
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
SEVERE: Context [/openolat] startup failed due to previous errors 
Solution
Please refer to http://blog.trifork.com/2011/03/18/debugging-the-dreaded-severe-error-listenerstart-and-severe-error-filterstart-tomcat-error-messages/ for solution After follow the steps as described in the blog, error message as shown below is displayed

org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of clas
s org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanInitializationException: Could not load pr
operties; nested exception is java.io.FileNotFoundException: class path resource
 [olat.local.properties] cannot be opened because it does not exist
        at org.springframework.beans.factory.config.PropertyResourceConfigurer.p
ostProcessBeanFactory(PropertyResourceConfigurer.java:87)
        at org.springframework.context.support.AbstractApplicationContext.invoke
BeanFactoryPostProcessors(AbstractApplicationContext.java:696)
        at org.springframework.context.support.AbstractApplicationContext.invoke
BeanFactoryPostProcessors(AbstractApplicationContext.java:671)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:461)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebA
pplicationContext(ContextLoader.java:410)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:306)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:112)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:5003)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5517)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095
)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:
1930)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: class path resource [olat.local.proper
ties] cannot be opened because it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPat
hResource.java:171)
        at org.springframework.core.io.support.EncodedResource.getInputStream(En
codedResource.java:143)
        at org.springframework.core.io.support.PropertiesLoaderUtils.fillPropert
ies(PropertiesLoaderUtils.java:98)
        at org.springframework.core.io.support.PropertiesLoaderSupport.loadPrope
rties(PropertiesLoaderSupport.java:175)
        at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProp
erties(PropertiesLoaderSupport.java:156)
        at org.springframework.beans.factory.config.PropertyResourceConfigurer.p
ostProcessBeanFactory(PropertyResourceConfigurer.java:78)
        ... 19 more

Tuesday, September 15, 2015

How to resolve MojoExecutionException error when build the OpenOlat project?

Try to download the OpenOlat version 10.3 source code as a gzip file from its portal, unzip the source code and build the project in maven. MojoExecutionException error message as shown below is displayed when "mvn clean package" command is executed.

[ERROR] Failed to execute goal org.openolat.mojo:buildnumber-maven-plugin:1.2.0:
hgchangeset (default) on project openolat-lms: Command failed.
[ERROR] EXECUTION FAILED
[ERROR] Execution of cmd : id failed with exit code: 255.
[ERROR] Working directory was:
[ERROR] D:\Projects\OpenOlat\openolat103
[ERROR] Your Hg installation seems to be valid and complete.
[ERROR] Hg version: 3.5+5 (OK)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.openolat.mojo:buildnumber-maven-plugin:1.2.0:hgchangeset (default) on project
 openolat-lms: Command failed.
EXECUTION FAILED
  Execution of cmd : id failed with exit code: 255.
  Working directory was:
    D:\Projects\OpenOlat\openolat103
  Your Hg installation seems to be valid and complete.
    Hg version: 3.5+5 (OK)

Reason

The OpenOlet mojo plugin can't be found, please refer to pom.xml

<plugin> 
     <groupid>org.openolat.mojo</groupid>
     <artifactid>buildnumber-maven-plugin</artifactid>
     <version>1.2.0</version>
     <executions>
          <execution>
               <phase>validate</phase>
	       <goals>
	            <goal>hgchangeset</goal>
	       </goals>
	  </execution>
     </executions>
     <configuration>
          <docheck>true</docheck>
	  <doupdate>true</doupdate>
     </configuration>
</plugin>

The proper way to build OpenOlat should be
  • Install TortoiseHg version 3.5
  • Clone the OpenOlat source code from http://hg.openolat.org/openolat103
  • Rebuild the project with "mvn clean package" command, you should be able to build the war file.



Sunday, September 6, 2015

How to shutdown the Apache web server process running at the background in Mac machine?

Run the command below to shutdown Apache Web Server background process in your mac machine

sudo killall httpd
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist

Monday, August 17, 2015

How to reset your first installed mysql database password?

  • For newly installed mysql database, the default database password is empty
  • In order to reset the password, type in the "mysql" command at terminal window. 
  • Type in the command below to reset the password
mysql > UPDATE mysql.user SET password=password('password') WHERE user='root' AND host='localhost';
  • If the error message as shown below is displayed
ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
  • Add the 2 parameter to my.cnf file
[mysqld]
skip-grant-tables
skip-networking
  • Restart mysql services
  • Type in command "mysql" to login into mysql, rerun the command below, you should be able to reset your root password
mysql > UPDATE mysql.user SET password=password('password') WHERE user='root' AND host='localhost';
mysql > FLUSH PRIVILEGES; 

Tuesday, August 11, 2015

How to delete external app from LaunchPad?

  • For external application that displayed at LaunchPad, long click doesn't called up the cross symbol to allow the user to delete away the app.
  • Below are some alternative way that I have come across from internet that might be useful
  • Launch the "Terminal" window
# cd ~/Library/Application\ Support/Dock
# ls
  • By listing the files in the folder, you will be able to find the database file
  • Run the command below to delete away the application from LaunchPad
# sqlite3 [DATABASENAME].db "DELETE from apps WHERE title='[APPNAME]';"

[DATABASENAME] represent the database name that we discovered at previous steps
[APPNAME] represent the name of the app
  • Run the command below to restart the launchpad. Voila, the external application is removed from LaunchPad.
# killall Dock

Monday, August 10, 2015

How to setup "Basic" authentication to phpPgAdmin at Apache web server?


  • Run the command below to add user to ".htpasswd" file


# htpasswd [DIRECTORY]/.htpasswd [USERNAME]

[DIRECTORY] represent the folder that store the password
[USERNAME] represent the user login id

Note: Password/Retype password will be prompted after the command above has been executed


  • Open configuration file httpd.conf , add the configuration as described below

<Directory "/var/www/phpPgAdmin">
    AuthName "Secure Area"
    AuthType Basic
    AuthUserFile [DIRECTORY]/.htpasswd
    require valid-user
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


Restart Apache server, voila, your phpPgAdmin is protected now.


Wednesday, July 15, 2015

Technic to monitor Apache server performance

iftop tool installation

Enter the command below

# wget http://pkgs.repoforge.org/iftop/iftop-0.17-1.el6.rf.x86_64.rpm
# rpm -ivh iftop-0.17-1.el6.rf.x86_64.rpm

Run the "iftop" command to launch the tool to monitor the network card

Check the number of CPU

Enter the command below

# nproc

nmon tool installation

Enter the command below

# wget http://nmon.sourceforge.net/docs/MPG_nmon_for_Linux_14a_binaries.zip
# unzip MPG_nmon_for_Linux_14a_binaries.zip
# ./nmon_x86_64_centos5

Scripts to check Apache connection

Came across the script below from internet and found out it is helpful to monitor the number of concurrent connection to Apache server. Just show it for sharing purpose

#!/bin/bash

[ $# -eq 0 ] && { echo "Usage: $0 " ; exit 1; }

while true
do
        clear;
        echo "Number of Apache Active Connections:";
        netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort | wc -l;
        echo;
        #echo "Current Active IP's:";
        netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort;
        sleep $1;
done

Simple Shell scripts to load test the Apache server

The scripts download sample.pdf from Apache to time the download time and produce CSV report.

#!/bin/bash

for ((i=1; i <= 200 ; i++))
do
    curl -s -w "iPad($i)",%{time_connect},%{time_starttransfer},%{time_total}\\n  -o "sample$i.pdf" https://[SERVER_NAME]/sample.pdf >> report.csv &
done