Disable start up of Hibernate configuration in Spring boot.

#Exclude start up of Hibernate JPA configuration

Add below entry in your application.properties file


167 total views, 1 views today

Error: [$http:badreq] Http request configuration url must be a string. Received

$http.get is a shortcut method for $http({ method: ‘GET’ }), and expects the URL as the first parameter.

method: 'JSONP',
url: url
}).then(function successCallback(response) {
// ok
}, function errorCallback(response) {
// ko

209 total views, no views today

Highlight code snippet in Blogger post.

I m using this pretty tool for my blog to highlight the codes.

Its colorful and also provide formatting of codes.

Go to link :


So will see below window 

1. Just copy paste your code in the source code window.
2. select your language.
3. select your style.
4. Choose line numbers if you want to show.
5. click on highlight button.

Preview window will open with colorful text and formatted lines.

This is easy to use and pretty cool.

161 total views, no views today

exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.json.JSONObject

Could not write content: No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )

controller methods return simple POJOs – Collection<Bookmark>, and Bookmark, etc., 

When an HTTP request comes in that specifies an Accept header, Spring MVC loops through the configured HttpMessageConverter until it finds one that can convert from the POJO domain model types into the content-type specified in the Accept header, if so configured.

Spring Boot automatically wires up an HttpMessageConverter that can convert generic Object’s to JSON, absent any more specific converter. HttpMessageConverter s work in both directions: incoming requests bodies are converted to Java objects, and Java objects are converted into HTTP response bodies.

To solve Exception just override the default behaivour of the HttpMessageConverter provided by spring.

public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
return jsonConverter;

This will do the trick for you.

170 total views, no views today

Caused by: java.lang.IllegalArgumentException: ‘dataSource’ or ‘jdbcTemplate’ is required

A Simple DAO class extends JdbcDaoSupport, but, unable to inject or @autowired a “dataSource”, the method setDataSource is final, can’t override.


To quickly fix it, uses @PostConstruct to inject the dataSource like this :

public class UserDetailsDaoImpl extends JdbcDaoSupport implements UserDetailsDao {

private DataSource dataSource;

private void initialize() {


Alternatively, create an own implementation of JdbcDaoSupport class, and do whatever you want. Dive inside the source code of JdbcDaoSupport, it’s just a simple helper class to create a jdbcTemplate.

Source :- https://www.mkyong.com/spring/how-to-autowire-datasource-in-jdbcdaosupport/

256 total views, no views today

org.hibernate.hql.internal.ast.querysyntaxexception: “table_name” is not mapped Spring boot

Put your SampleWebJspApplication.java in pl.test package and execute the application.

It is recommended by Spring Boot to run your application from the root package and all your entities, controllers,DAO’s and other service classes should be placed in child packages. This is not a hard and fast rule but it ensures all your subpackage annotated classes are scanned properly

In your case your User class is not scanned and Hibernate is not able to find the mapping for the same and eventually throwing the QuerySyntaxException when executing the from User query.

Currently Spring Boot will scan @Entity classes if they are placed in the same package or sub-packages where you specified the @SpringBootApplication annotation. Atleast, this is what I observed while developing spring boot apps lately.

If you do not want to move the location of the 

SampleApplication.java, then use 

@EntityScan(basePackages = "pl.test.model")

 annotation and this will fix the issue.

171 total views, no views today

spring boot controllers not initialized

Checkout my recommended article on Spring Boot Interview Questions.
Controllers are not initialize because you have not scan the packages for controller
add these lines in your main class.
If you are scanning a particular class for controller.
@ComponentScan(basePackageClasses = temInventoryController.class)
public class InventoryApp {
if you want to scan a whole package for controller add this.
@ComponentScan(basePackages = "com.home.controller")

158 total views, no views today

ORACLE : Io exception: The Network Adapter could not establish the connection

Not connecting to correct Database in oracle :


the following commands will help:

1. Oracle query command to check the SID (or instance name):

select sys_context(‘userenv’,’instance_name’) from dual; 

2. Oracle query command to check database name (or server host):

select sys_context(‘userenv’, ‘server_host’) from dual;

158 total views, no views today

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mrpapp: Compilation failure

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

 Go to Window → Preferences → Java → Installed JREs.

And see if there is an entry pointing to your JDK path, and if not, click on Edit button and put the path you configured your JAVA_HOME environment

165 total views, no views today