1. Add Jackson maven dependency to your project

  <dependencies>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.8.5</version>
    </dependency>
  </dependencies>

2. Use ObjectMapper class

ObjectMapper mapper = new ObjectMapper();

//to array
MyClass[] myObjects = mapper.readValue(myJson, MyClass[].class);

//to list 1
List<MyClass> myObjects = mapper.readValue(jsonInput, new TypeReference<List<MyClass>>(){});

//to list 2
List<MyClass> myObjects = mapper.readValue(jsonInput, mapper.getTypeFactory().constructCollectionType(List.class, MyClass.class));

If your Java application uses Spring Data for accessing to MongoDB and it throws error messages like this: "... Not authorized for query ..." or this: "... errmsg" : "unauthorized... ",

then check your application context xml-file:

<mongo:db-factory dbname="${mongo.database}" host="${mongo.host}" id="mongoDbFactory" port="${mongo.port}" username="${mongo.username}" password="${mongo.password}"/>

I used Spring Roo for source code generating and attributes username and password weren`t generated per default.

After adding of the MongoDB cartridge to your application you can not build a connection from your local client (MongoVue or Unit tests from your Application) because usings ports are closed.

Follow steps will help you:

 

1. Activate a port forwarding to your application:

rhc port-forward -a <your_application_name>

you will get a message like this:

Service Local                OpenShift
------- --------------- ---- --------------------------------------------------------
haproxy 127.0.0.1:8080   =>  127.3.6.2:8080
...
mongodb 127.0.0.1:55131  =>  <your_app_domain>.rhcloud.com:55131

 

2. keep the executing of the port forwarding and use local IP and Port (127.0.0.1:55131) of MongoDB for building your connection

During the Tomcat starting:

The BASEDIR environment variable is not defined correctly. This environment variable is needed to run this program

To Do:

enable current user to execute the startup files


cd {tomcat-home}/bin
chmod +x *.sh


 

Error:

Unable to set localhost. This prevents creation of a GUID. Cause was: myhost : myhost java.net.UnknownHostException: myhost : myhost

To Do:

in /etc/hosts eintragen:
127.0.0.1 myhost localhost

Sysstat ist eine Sammlung von System-Überwachungswerkzeugen für Linux (CPU, RAM, Swapping, I/O, Netzwerk usw.). Sysstat ist Open Source.

Man definiert Zeitabstände, wie oft die Systemauslastung protokoliert werden soll. Dabei werden keine Snapshots (momentalen Aufnahmen) des Systems gemacht, sondern die Durchschnittswerte, gemessen zwischen 2 Protokollierungszeitpunkten.

Installation:

Step 1.  Installieren
sudo apt-get install sysstat

Step 2. Aktivieren
sudo vi /etc/default/sysstat
 change ENABLED=”false” to ENABLED=”true”
 save the file

Step 3. Aufzeichnungsinterval von 10 zu 2 Minuten ändern:
vi /etc/cron.d/sysstat
 Change
5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
 To
*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
 save the file

Step 4. Restart
sudo service sysstat restart

 Aktuelle Statistiken zeigen

#CPUs
sar -u

# Memory (RAM)
sar -r

#Netzwerk
sar -n DEV
sar -n DEV -s 15:43:00 -e 16:32:02

#IO
sar -b

Alte Statistiken zeigen

#CPUs
sadf -d /var/log/sysstat/sa18 -P , -s 16:44:00 -e 18:32:00

# Memory
sadf -d /var/log/sysstat/sa18 -- -r -s 16:44:00 -e 18:32:00

#Netzwerk
sadf -d /var/log/sysstat/sa18 -- -n DEV -s 16:44:00 -e 18:32:00

#IO
sadf -d /var/log/sysstat/sa18 -- -b -s 16:44:00 -e 18:32:00

wobei die Dateinamen wie 'sa18' können sich variiren.

Mehr Info

http://sebastien.godard.pagesperso-orange.fr/documentation.html

http://www.linupedia.org/opensuse/Systemueberwachung_mit_sysstat