Skip to content

darpan7/BehavioralApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BehavioralApi

  • experiences expressed in stories.

  • Helps to prepare behavioral type questions.

Angular 6 + Java (Spring) + MySQL

Steps to follow:

Setup tools [Optional]:

  1. Download Apache Tomcat Server 7.0:
    • Download zipped file from http://mirrors.ocf.berkeley.edu/apache/tomcat/tomcat-7/v7.0.92/bin/apache-tomcat-7.0.92.tar.gz
    • Extract zipped file to customized location i.e. ~/Installers/
    • Copy path of dowloaded tomcat directory. ______________ (A)
  2. Eclipse IDE:
  3. AngularJS 6:
    • Install npm on Mac: brew install node [No need to add sudo] npm -v should display version number.

    • Install ng globally: npm install -g @angular/cli [-g stands for globally. Remove -g if you want to install locally]

    • npm install: Error: Unexpected token / in JSON at position .... Solution: Remove package-lock.json file and re-run the command.

      Error: npm install hangs on one particular module. Solution: Simply stop the process (ctr + c) and re-run the command.

Make it Run first:

  1. Run Spring Application:

    • External Dependencies: MySql: - Install MySQL: Reference link: https://dev.mysql.com/doc/refman/5.7/en/osx-installation-pkg.html - Install MySQL Workbench [Optional]: Reference link: https://dev.mysql.com/doc/workbench/en/wb-installing-mac.html - After successful installation, test connection. mysql -uroot -hlocalhost -proot should connect to MySql database. - Create testdb schema. mysql -uroot -hlocalhost -proot CREATE SCHEMA testdb

    • Setup in Eclipse:

    • Run Commands:

      • cd ~/<root of spring directory application>
      • mvn clean
      • mvn spring-boot:run Errors and solution while running this command: Error: Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException Solution: jaxb api is not available by default in jdk. So you need to import it. One of the way is write the following lines in pom.xml: javax.xml.bind jaxb-api 2.2.11 com.sun.xml.bind jaxb-core 2.2.11 com.sun.xml.bind jaxb-impl 2.2.11 javax.activation activation 1.1.1
    • It will keep running and waiting for request to process. Now lets setup client.

  2. Run AngularJs6 Application:

    • `cd ~/
    • ng serve to start client.

Load Data:

  • Import data:

    • Copy dump.sql file to docker container: docker cp dump.sql local-mysql:/tmp/dump.sql
    • Run this command inside mysql container: mysql -uroot -proot sample< /tmp/dump.sql
  • Export data:

    • Create dump inside mysql container: mysqldump -uroot -proot sample > /tmp/dump.sql
    • Get the dump file from container: docker cp local-mysql:/tmp/dump.sql dump.sql