Increase space Virtual Box and Linux Partition

Clone the disk

VBoxManage clonehd “path/WebServer.vmdk” “path/WebServer.vdi” –format vdi

resize 20*1024 = 20GB

VBoxManage modifyhd “path/WebServer.vdi” –resize 20480

reconvert into vmdk

VBoxManage clonehd “path/WebServer.vdi” “path/WebServer.vmdk” –format vmdk

File -> Virtual Media Manager -> Removed existing images (note, I removed them only from the registry).

1. Open the Oracle VM VirtuaBox Manager
Click on File -> Virtual Media Manager (or Ctrl+D)
2. Delete the hard disk entry in question (select and press “Del” on keyboard)
3. Open “Settings” of the Virtual Machine, go to “Storage”, click “Add Attachment”, select “Add Hard Disk” and “Choose existing disk“, then selected the vdi file and you are done.

  1. Download “gparted-live-x.xx.x-x-ixxx.iso” file from http://gparted.sourceforge.net/download.php. Mount this iso file as CD. Virtual Machine -> Settings -> Storage -> Controller IDE (Right Click) -> Add CD/DVD -> Select gparted-live-x.xx.x-x-ixxx.iso file
  2. Run virtual machine, Virtual Machine will boot from this CD. Choose default values with pressing “Enter”, “Enter” … until Gpart ISO GUI starts. Select tool gpart program and start.
  3. Extend disk size as below;
    • Right click on partitions and if “possible” click on “Disable Active Partion”.
    • Extend Partition as much as possible from GUI (for this case 500GB).
    • Right click the partition which is disabled and select “Enable Active Partion”.
    • Apply and wait until the operations finished.
    • Shut down virtual machine.
    • Unmount gparted-live-x.xx.x-x-ixxx.iso.
      $ Virtual Machine -> Settings -> Storage-> Controller IDE (Right Click on gparted-live-x.xx.x-x-ixxx.iso) -> Remove Attachement
    • Start the virtual machine.

vgdisplay

df -h

File system              Dim. Usati Dispon. Uso% Montato su
/dev/mapper/centos-root   19G  6,2G     13G  34% /
devtmpfs                 910M     0    910M   0% /dev
tmpfs                    920M     0    920M   0% /dev/shm
tmpfs                    920M  8,6M    912M   1% /run
tmpfs                    920M     0    920M   0% /sys/fs/cgroup
/dev/sda1               1014M  188M    827M  19% /boot
tmpfs                    184M     0    184M   0% /run/user/0

 

resize2fs /dev/mapper/centos-root

lvextend -l+100%FREE /dev/mapper/centos-root

resize2fs /dev/mapper/centos-root

xfs_growfs /dev/mapper/centos-root

df -ha

WildFly(JBoss) vs. Tomcat

Introduction
Both WildFly and Tomcat are Java application servers, but they have difference strength. Making the wrong choice can result in more work than necessary.

The JBoss application server (aka JBoss AS) is an application server based on Java. It is an open source software server and is usable in any operating system supported Java (because the server is Java based).

Apache Tomcat is a servlet container (meaning it is a Java class that operates under the strictures of the Java Servlet API – a protocol by which a Java class responds to an http request). This is an open source server, providing a ‘pure Java’ HTTP web server environment in which code written in Java is capable of running.

The major difference between Wildfly and Tomcat
Both JBoss and Tomcat are Java servlet application servers, but JBoss is a whole lot more. The substantial difference between the two is that JBoss provides a full Java Enterprise Edition (JEE) stack, including Enterprise JavaBeans and many other technologies that are useful for developers working on enterprise Java applications.

Tomcat is much more limited. One way to think of it is that JBoss is a JEE stack that includes a servlet container and web server, whereas Tomcat, for the most part, is a servlet container and web server.

On the other hand, Tomcat has a lighter memory footprint (~60-70 MB), while those Java EE servers weigh in at hundreds of megs. Tomcat is very popular for simple web applications, or applications using frameworks such as Spring that do not require a full Java EE server. Administration of a Tomcat server is arguably easier, as there are fewer moving parts.

When WildFly
JBoss is the best choice for applications where developers need full access to the functionality that the Java Enterprise Edition provides and are happy with the default implementations of that functionality that ship with it. If you don’t need the full range of JEE features, then choosing JBoss will add a lot of complexity to deployment and resource overhead that will go unused. For example, the JBoss installation files are around an order of magnitude larger than Tomcat’s.

When Tomcat
Tomcat is a Java servlet container and web server, and, because it doesn’t come with an implementation of the full JEE stack, it is significantly lighter weight out of the box. For developers who don’t need the full JEE stack that has two main advantages.

Significantly less complexity and resource use.

Modularity.

For those who need add-ons that work with Tomcat, there are some lightweight alternative to JEE like EJB.

Summary
WildFly is a application servers with access to the whole JEE stack while Tomcat is servelet server

Developers of complex Java enterprise applications should choose JBoss (or GlassFish), while those who don’t need the full JEE stack are better off with Tomcat plus any extensions they need.

JBoss makes use of the Java EE specification; Tomcat makes use of Sun Microsystems specific specifications.

Referece
http://stackoverflow.com/questions/3821640/what-is-difference-between-tomcat-and-jboss-and-glassfish

JBoss vs. Tomcat: Choosing A Java Application Server

Difference Between JBoss and Tomcat

VisualVM

How to Evaluate the Performance (CPU + Memory) of java Software:

java -Dcom.sun.management.jmxremote.port=9011 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp “.:../lib/*:../../../../lib/*” it.AppListener > /var/log/AppListener.log 2>&1 &

or
export JAVA_OPTS=”-server -Xms6144M -Xmx7168M -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false”

after set the port variable during the start up of the software, is possible to use to evaluate the situation this software

Linux command to check which process takes memory

ps aux  | awk '{print $6/1024 " MB\t\t" $11}'  | sort -n

 

Where to download VisualVM

Deploy a Spring Boot application under Tomcat Web Server Container

Higthligths:
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}

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

}

pom.xml

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>



</dependencies>

Spring boot provides option to deploy the application as a traditional war file in servlet 3.x(without web.xml)supporting tomcat server.Please see spring boot documentation for this. I will brief what you need to do here.

step 1 : modify pom.xml to change the packaging to war:(that you already did)

<packaging>war</packaging>

step 2 : change your dependency

    <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-tomcat</artifactId>
   </dependency>

to

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <scope>provided</scope>
</dependency>

step 3 :modify your war name (if you need to avoid the version details appended with the war name) in pom.xml under <build> tag.

<build>
    <finalName>web-service</finalName>
.....

step 4 : run maven build to create war : clean install step 5 : deploy the generated war file web-service.war in tomcat and request url in browser http://<tomcat ip>:<tomcat port>/web-service/hello

 

here the project : http://gitlab.saic.it/root/spring-boot-war-tomcat