I am pretty new to spring and I am developing a Spring MVC|Hibernate|C3P0 based web app using NetBeans IDE.NetBeans came with glassfish 4.1.1 server and my app gets deployed successfully and works fine in the default server. Then I learned that this version of glassfish is buggy and gives trouble while setting up JNDI connection pools. So I installed glassfish 4.1 server and added it to my IDE. Now when I try to deploy my app, it throws a 'BeanCreationException'.
I was thinking the problem was due to some configuration error as I am using multiple configuration class. So I already tried adding componentScan filter to exculude my WebConfig clas in my RootConfig class.
WebConfig.java
@Configuration
@ComponentScan(basePackages="com.tgear.jdeproject")
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter{
@Bean
public ViewResolver getViewResolver(){
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
resolver.setExposeContextBeansAsAttributes(true);
return resolver;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/assets/**")
.addResourceLocations("/resources/");
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
RootConfig.java
@Configuration
@ComponentScan(basePackages = {"com.tgear.jdeproject"},
excludeFilters = {
@ComponentScan.Filter(type = FilterType.ANNOTATION, value =
EnableWebMvc.class)
})
public class RootConfig {
}
AppInitializer.java
import org.springframework.web.servlet.support.
AbstractAnnotationConfigDispatcherServletInitializer;
public class AppInitializer extends
AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] { RootConfig.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] { WebConfig.class };
}
@Override
protected String[] getServletMappings() {
return new String[] { "/","" };
}
}
Below is the error message:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'requestMappingHandlerAdapter' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method 'requestMappingHandlerAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: com.fasterxml.jackson.core.util.DefaultIndenter
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
Any help would be greatly appreciated. Thanks in advance! :)