Skip to content

Instantly share code, notes, and snippets.

@athulmurali
Last active October 22, 2019 05:27
Show Gist options
  • Save athulmurali/42507282f8187bb6f60ec6bb5be98116 to your computer and use it in GitHub Desktop.
Save athulmurali/42507282f8187bb6f60ec6bb5be98116 to your computer and use it in GitHub Desktop.
Spring boot common issues | Debug

Things to do:

  1. Update the schema name in DatabaseConnection.java

  2. Remove all duplicate code for creating connection in all DAOs first.

  3. Just use the getConnection method from DatabaseConnection.java At any instance, do not duplicate the connection strings or copy paste connection methods to stay away from trouble.

  4. Remove duplicate package tags in pom.xml

If you have, username = System.getenv("master")

It means the value is being extracted from the environment. If you want to hard code values instead of passing it in the environment,

please replace it with username="HARD_CODED_VALUE" in Connection or DatabaseConnection file

If you are not doing either of the above, you will end up with NULL pointer exceptions.


How to find the schema or database name ?

Go to your work bench and find it or type the following in your work bench query editor

Show all databases (schemas)

SHOW DATABASES

Get the current database

SELECT DATABASE();


How to build and run with mvn ?

Paste the following into your bash from root

ls

The above should list pom.xml as one of its files. Then it means, you are in the right location to execute the following commands.

mvn clean install

If build is successful proceed below.

Now, you will have an image built in the target folder.

To run the built maven image paste the following in cli Check for the war image name in your target folder and replace the myapp-*.jar with your image

java -jar ./target/myapp-0.0.1-SNAPSHOT.war

    - Athul athulmurali@ccs.neu.edu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment