Me and my friend decided to start a project with the applications of Microservices, Spring Data JPA, Spring framework.
As a part of that, we implemented our databases on SAP HANA. In order to use it in our Java applications, as we all know, we need to include the dependency in our
POM.xml
.
The dependency I included is
The sets up the application.properties and ran our application. But oopss..... We were getting Driver class not found error.
What!!!! I once again checked the pom.xml file and yes the driver class dependency is added. Once again the program was run and the same error pops out.
The next step is quite similar for every developer. I started checking this on stack overflow and other resources. I even implemented a CloudConfig class which is actually of no use.. WOW!!!
There were many answers that was shown up, but nothing matches our error.
We stopped that day and continued on this the next day. Once again examined the pom.xml and yes, there is something special in the pom.xml. If everyone noticed, its great because it took almost 2 days for me to not that.
I was giving the <scope>test</scope>.
This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
So that was the problem and the class was not being used for the normal purpose. So I just removed it and yeah!!! The application started successfully and we took one more step ahead in our project.
The Updated pom.xml
<dependency>
<groupId>com.sap.cloud.db.jdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>2.7.14</version>
</dependency>
Enter fullscreen modeExit fullscreen mode
That's correct. It is required to remove the tag <type>pom</type>
. It fails to load with this tag, even if <scope> tag is already removed.
For scope, either you can remove it, or make it runtime. Below is valid entry and loads on doing the mvn install