Quick start – First Spring Boot App in Eclipse

In eclipse start a new maven project – Sample entries I had provided

sb-app

Edit the pom.xml file and add the following dependency – Want to test a simple rest endpoint app

<dependencies>
 <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-data-rest</artifactId>
  </dependency>
</dependencies>

Add the following plugin for Maven to run the project

    <build>
        <plugins>
            <plugin>
     
      <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

Create a new package demo (in src/main/java)

Create a simple User POJO (User.java) in src/main/java/demo

package demo;

import org.springframework.stereotype.Component;

@Component
public class User {
  private String firstName;
  private String lastName;
  private int id;
  public String getFirstName() {
    return firstName;
  }
  public void setFirstName(String firstName) {
    this.firstName = firstName;
  }
 public String getLastName() {
   return lastName;
 }
 public void setLastName(String lastName) {
   this.lastName = lastName;
 }
 public int getId() {
   return id;
 }
 public void setId(int id) {
   this.id = id;
 }
}

Add a Controller (UserController.java) in (src/main/java/demo) class with on end point

package demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
 @RequestMapping(value="/test")
 public User getUserInfo(){
  User user = new User();
  user.setFirstName("First");
  user.setLastName("Last");
  user.setId(10);
  return user;
 }
}

Create one simple Application.java in src/main/java/demo with a main method (a requirement for spring boot)

package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
public static void main(String[] args) {
 SpringApplication.run(Application.class, args);
 }
}

Your are done with setting up – Right click on Application.java, Run As->Java Application – Your first spring boot app will be up and running. Open a browser and access localhost:8080/test and you should be able to view the JSON response.

Posted in Uncategorized | Tagged , , | Comments Off on Quick start – First Spring Boot App in Eclipse

Tomcat 8.5.x – Eclipse plugin

In the lib folder of tomcat,  catalina.jar  includes

org/apache/catalina/util/ServerInfo.properties

update the contents of the line in that file

server.info=Apache Tomcat/8.5.x

to

server.info=Apache Tomcat/8.0.0

 

 

Posted in Uncategorized | Tagged , , , | Comments Off on Tomcat 8.5.x – Eclipse plugin

Firefox – Java – Plugin – Ubuntu 16.04

After installing Oracle java

mkdir ~/.mozilla/plugins

ln -s /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins

 

Posted in Uncategorized | Tagged , , , | Comments Off on Firefox – Java – Plugin – Ubuntu 16.04

Lync / Skype for business on Ubuntu 16.04

Based on information at : https://community.skype.com/t5/Linux/Skype-for-Business/td-p/4072041

Access https://tel.red/linux.php

Scroll down and click on the relevant link matching your OS version and install.

Using it for some time now – No issues found till now

 

Posted in Uncategorized | Tagged , , , | Comments Off on Lync / Skype for business on Ubuntu 16.04

Installing Node JS on Ubuntu 16.04 LTS

Add NodeJS PPA

sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

2. Install nodejs

sudo apt-get install nodejs
Verify version
name@host:~$node -v
v6.8.0
name@host:~$npm -v
3.10.8

Optional – To test installation

Create a file server.js with the following contents

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Test Server');
}).listen(3000, "127.0.0.1");
console.log('Server running at http://127.0.0.1:300');

Access localhost:3000 from the browser

Posted in Uncategorized | Tagged , | Comments Off on Installing Node JS on Ubuntu 16.04 LTS

Tomcat Deploy Web App takes long time

Observed that deployment of WAR files was taking a long time.

On searching for info came to know it could be because of the bug

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4705093

The solution was to add the following line in $CATALINA_HOME/bin/setenv.sh file (create one if it is not there) [ java.awt.headless is not associated with the issue]

export JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true"
Posted in Uncategorized | Tagged , , | Comments Off on Tomcat Deploy Web App takes long time

Configure Reverse Proxy – CentOS 7 – httpd

By default mod_proxy is included in http package.

Had created a new VM – So installing httpd

yum clean all
yum -y update
yum -y install httpd
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=8080/tcp
systemctl start httpd
systemctl enable httpd
systemctl status httpd

Configure the proxy/reverse proxy.

Create new config file

<os-prompt># vi /etc/httpd/conf.d/r_proxy.conf

<IfModule mod_proxy.c>
    ProxyRequests Off
    <Proxy *>
        Require all granted
    </Proxy>
    # Proxy to which server?
    ProxyPass / http://<ip>:<port>/
    ProxyPassReverse / http://<ip>:<port>/
</IfModule>

Restart httpd

systemctl restart httpd

When I tried to access http://proxyserverip/myapp

I got “Service Unavailable”.

In /var/log/httpd/error_log I could see

[Thu Jul xx xx:xx:xx:xxxxxx 2016] [proxy:error] [pid 11966] AH00959: ap_proxy_connect_backend disabling worker for (<targetserverip>) for 60s

Solution was to configure SELinux with following

/usr/sbin/setsebool -P httpd_can_network_connect 1

And it worked!

 

 

Posted in Uncategorized | Tagged , , | Comments Off on Configure Reverse Proxy – CentOS 7 – httpd

MySQL – Disable Full Group By

Encountered the exception :

java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘IAM_DB.this_.ID’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by.

Fix was to update global settings in MySQL

In MySQL

SELECT @@sql_mode;

+——————————————————————————————————————————————-+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+——————————————————————————————————————————————-+

Change it  by executing

 

set global sql_mode=’STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’;

 

 

Posted in Uncategorized | Comments Off on MySQL – Disable Full Group By

MySQL 5.6/7 on Debian 7.x

Debian 7.6 was installed on the VM.  Default mysql-server which was getting installed using apt-get was 5.5.  One of the updates in mysql 5.6 was to support more than one current_timestamp column with default value of current time stamp.

So to install this is what I did

wget http://dev.mysql.com/get/mysql-apt-config_0.3.5-1debian7_all.deb

dpkg -i mysql-apt-config_0.3.5-1debian7_all.deb

apt-get update

apt-get install mysql-community-server

Source : http://www.debiantutorials.com/install-mysql-server-5-6-debian-7-8/

Posted in Uncategorized | Comments Off on MySQL 5.6/7 on Debian 7.x

Neo4J – Linux – Configurations

After installing the community edition of Neo4J on Debian VM  understood from manuals about the need to increase the number of files limit for Neo4J.

cat /proc/sys/fs/file-max

The output was 3273723 – So no issues.  In case if it is less you can update it (Set it to lower value if needed, I decided not to change)

# sysctl -w fs.file-max=3273723

Then

# vi /etc/sysctl.conf

and append the following line (value is your choice, for Neo4J the min should be 40000)

fs.file-max = 3273723

Save and close the file. Users need to log out and log back in again to changes take effect or just type the following command:

# sysctl -p

The above procedure sets system-wide file descriptors (FD) limits. However, you can limit neo4j (or any other users) user to specific limits by editing /etc/security/limits.conf file, enter:

# vi /etc/security/limits.conf

Set ne04j user soft and hard limits as follows:

neo4j soft nofile 40000
neo4j hard nofile 40000

This did not work on my VM – On searching the net, there were suggestions to try not logging in as root and with a normal user account with sudo rights.  Both did not work.  Just restarted the system.  Still could not start neo4j – When I tried to start neo4j after doing a ‘su – neo4j’ got message no such file  /var/run/neo4j/neo4j.pid file.  Found out that /var/run/neo4j was not available, created the folder and did a ‘chown neo4j:adm /var/run/neo4j’ and then started neo4j and it worked.

 

Posted in Uncategorized | Comments Off on Neo4J – Linux – Configurations