Spring Boot Application Couldn't Autowire XML Configuration - java

I'm trying to convert my existing traditional spring application to a spring boot. I have imported my XML Configuration with #ImportResource and when I run my application. It throws Injection failed even though this bean is configured in XML Configuration. Not sure what's going wrong here
> Application.java
#Configuration
#ComponentScan("com.vzt")
#EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
public class Application {
public static void main(String[] args) {
ApplicationContext applicationContext = SpringApplication.run(
Application.class, args);
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = applicationContext.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}
#Configuration
#ImportResource("classpath:spring/beans.xml")
// #Profile("itest2") //commented it from the suggestion to set the
spring.profiles.active=itest2 on VM arguments
class XMLImportingConfiguration {
}
>XML Configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:web-services="http://www.springframework.org/schema/web-services"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.springframework.org/schema/util"
xmlns:c="http://www.springframework.org/schema/c" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:component-scan base-package="com.vzt" />
<!-- <oxm:jaxb2-marshaller id="marshaller" contextPath="com.vzt.ws.stubs.cca.ivrinfows"
/> -->
<!-- <jee:jndi-lookup id="ccaDataSource" jndi-name="java:/cca"
resource-ref="true" />
-->
<bean id="ccaDataSourceTest"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="${cca.jdbc.url}" />
<property name="username" value="${cca.jdbc.username}" />
<property name="password" value="${cca.jdbc.password}" />
</bean>
<bean id="ccaService" class="com.vzt.callcenter.service.CCAServiceImpl">
<!-- wire dependency -->
</bean>
<bean id="ccaRepository" class="com.vzt.callcenter.dao.CCARepository">
<property name="dataSource" ref="ccaDataSourceTest" />
</bean>
<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<!-- IVR Info WS Request and Response Classes -->
<value>com.vzt.ws.stubs.cca.ivrinfows.CallData</value>
<value>com.vzt.ws.stubs.cca.ivrinfows.GetCallData</value>
<value>com.vzt.ws.stubs.cca.ivrinfows.IvrTransfer</value>
<value>com.vzt.ws.stubs.cca.ivrinfows.IvrTransferred</value>
<!-- Weather Data WS Request and Response Classes -->
<value>com.vzt.ws.stubs.weather.Alert</value>
<value>com.vzt.ws.stubs.weather.DataSet</value>
<value>com.vzt.ws.stubs.weather.GetAll</value>
<value>com.vzt.ws.stubs.weather.GetAllResponse</value>
<value>com.vzt.ws.stubs.weather.Weather</value>
<!-- MW (ESB) Webservice SR Request and Response Classes -->
<value>com.hughestelematics.htimessageheader.MessageHeaderT</value>
<value>com.hughestelematics.xmlns.webservicesr.WebserviceSRRequest
</value>
<value>com.hughestelematics.xmlns.webservicesr.WebserviceSRReturn
</value>
<!-- Siebel Webservice updateSRType Request and Response Classes -->
<value>com.siebel.customui.UpdateSRTypeInput</value>
<value>com.siebel.customui.UpdateSRTypeOutput</value>
<!-- MW (BPEL) Webservice SR PSTN Request and Response Classes -->
<value>com.hti.xmlns.webservicepstn.ObjectFactory</value>
<value>com.hti.xmlns.webservicepstn.PSTNRequestT</value>
<value>com.hti.xmlns.webservicepstn.PSTNReturnT</value>
<value>com.hti.xmlns.webservicepstn.PSTNOutput</value>
</list>
</property>
</bean>
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<property name="marshaller" ref="jaxb2Marshaller" />
<property name="unmarshaller" ref="jaxb2Marshaller" />
<constructor-arg ref="messageFactory" />
<!-- <property name="defaultUri" value="${ccawebservice.url}" /> -->
<property name="messageSender">
<bean
class="org.springframework.ws.transport.http.HttpComponentsMessageSender">
<property name="connectionTimeout" value="${cca.ivrinfo.webservice.timeout}" />
<property name="readTimeout" value="${cca.ivrinfo.webservice.timeout}" />
<property name="acceptGzipEncoding" value="false" />
</bean>
</property>
</bean>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean
class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl" />
</property>
</bean>
<!-- <mvc:default-servlet-handler /> -->
<mvc:resources location="/resources/" mapping="/resources/**" />
<!-- <mvc:interceptors> <bean class = "com.vzt.nissan.interceptors.HttpRequestResponseLoggingInterceptor"/>
<bean class = "com.vzt.nissan.interceptors.AddSessionBeanInterceptor" />
</mvc:interceptors> -->
<context:annotation-config />
<mvc:annotation-driven />
<aop:aspectj-autoproxy />
<beans profile="dev">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:framework_dev.properties</value>
<value>classpath:data/testdata/testdata_dev.properties</value>
<value>classpath:db/db_dev.properties</value>
</list>
</property>
</bean>
</beans>
<beans profile="itest">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:framework_itest.properties</value>
<value>classpath:data/testdata/testdata_itest.properties</value>
<value>classpath:db/db_itest.properties</value>
</list>
</property>
</bean>
</beans>
<beans profile="itest2">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:framework_itest2.properties</value>
<value>classpath:data/testdata/testdata_itest2.properties</value>
<value>classpath:db/db_itest2.properties</value>
</list>
</property>
</bean>
</beans>
>CCAServiceImpl.java
package com.vzt.callcenter.service;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.ws.client.core.WebServiceTemplate;
import org.springframework.ws.soap.client.SoapFaultClientException;
import com.vzt.callcenter.constants.Constants;
import com.vzt.callcenter.model.GetCallDataByInteractionIdResponse;
import com.vzt.ws.stubs.cca.ivrinfows.CallData;
import com.vzt.ws.stubs.cca.ivrinfows.GetCallData;
import com.vzt.ws.stubs.cca.ivrinfows.IvrTransfer;
import com.vzt.ws.stubs.cca.ivrinfows.IvrTransferred;
import com.vzt.ws.stubs.cca.ivrinfows.ObjectFactory;
#Service
public class CCAServiceImpl implements CCAService {
#Autowired
private WebServiceTemplate webServiceTemplate;
static Logger logger = Logger.getLogger(CCAServiceImpl.class);
#Value("${cca.ivrinfo.webservice.url}")
private String webserviceUrl;
#Value("${cca.ivrinfo.webservice.timeout}")
private String webserviceTimeout;
public String getWebserviceUrl() {
return webserviceUrl;
}
public void setWebserviceUrl(String webserviceUrl) {
this.webserviceUrl = webserviceUrl;
}
public String getWebserviceTimeout() {
return webserviceTimeout;
}
public void setWebserviceTimeout(String webserviceTimeout) {
this.webserviceTimeout = webserviceTimeout;
}
/* (non-Javadoc)
* #see com.vzt.callcenter.service.CCAService#getCallDataByInteractionId(java.lang.String)
*/
#Override
public GetCallDataByInteractionIdResponse getCallDataByInteractionId(
String interactionId) {
//code not shown for brevity
return getCallDataByInteractionIdResponse;
}
/* (non-Javadoc)
* #see com.vzt.callcenter.service.CCAService#ivrTransfer(com.vzt.callcenter.model.IvrTransferRequest)
*/
#Override
public String ivrTransfer(com.vzt.callcenter.model.IvrTransferRequest ivrTransferRequest) {
logger.info("Request:" + ivrTransferRequest);
//code not shown for brevity
return Constants.WS_RC_CCAINFOWS_WSEXCEPTION;
}
}
>Error when I do the Spring Boot
>EDIT
Based on USER:axtavt comment, I made change to the
spring.active.profiles on run-time instead of using #Annotations. And
now I get the below error.
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4260904e: startup date [Thu Dec 11 09:47:19 EST 2014]; root of context hierarchy
09:47:19 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext obtainFreshBeanFactory Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4260904e: org.springframework.beans.factory.support.DefaultListableBeanFactory#4db8738f: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,application]; root of factory hierarchy
09:47:20 INFO rg.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions Loading XML bean definitions from class path resource [spring/beans.xml]
09:47:21 INFO ngframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Overriding bean definition for bean 'mvcContentNegotiationManager': replacing [Root bean: class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=mvcContentNegotiationManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]]
09:47:21 INFO rk.context.annotation.ConfigurationClassBeanDefinitionReader iddenByExistingDefinition Skipping bean definition for [BeanMethod:name=mvcUriComponentsContributor,declaringClass=org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport]: a definition for bean 'mvcUriComponentsContributor' already exists. This top-level bean definition is considered as an override.
09:47:21 INFO ngframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
09:47:21 INFO framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties Loading properties file from class path resource [framework_itest2.properties]
09:47:21 INFO framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties Loading properties file from class path resource [data/testdata/testdata_itest2.properties]
09:47:21 INFO framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties Loading properties file from class path resource [db/db_itest2.properties]
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
09:47:22 INFO t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$acc877c3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:47:22 INFO t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:47:22 INFO t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:47:22 INFO t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:47:22 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext initMessageSource Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource#773fe60f]
09:47:22 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext plicationEventMulticaster Using ApplicationEventMulticaster [org.springframework.context.event.SimpleApplicationEventMulticaster#4191ff3]
09:47:22 DEBUG ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory etArchiveFileDocumentRoot Code archive: C:\Users\v579424\.m2\repository\org\springframework\boot\spring-boot\1.1.7.RELEASE\spring-boot-1.1.7.RELEASE.jar
09:47:22 DEBUG ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory plodedWarFileDocumentRoot Code archive: C:\Users\v579424\.m2\repository\org\springframework\boot\spring-boot\1.1.7.RELEASE\spring-boot-1.1.7.RELEASE.jar
09:47:22 DEBUG ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory getValidDocumentRoot Document root: C:\Users\v579424\Documents\workspace-sts-3.4.0.RELEASE\VZTCallCenterFramework\src\main\webapp
09:47:22 INFO ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory tEmbeddedServletContainer Server initialized with port: 8080
09:47:22 INFO org.springframework.web.context.ContextLoader ddedWebApplicationContext Root WebApplicationContext: initialization completed in 3087 ms
09:47:23 INFO pringframework.boot.context.embedded.ServletRegistrationBean onStartup Mapping servlet: 'dispatcherServlet' to [/]
09:47:23 INFO springframework.boot.context.embedded.FilterRegistrationBean configure Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
09:47:26 INFO org.springframework.oxm.jaxb.Jaxb2Marshaller ateJaxbContextFromClasses Creating JAXBContext with classes to be bound [class com.vzt.ws.stubs.cca.ivrinfows.CallData,class com.vzt.ws.stubs.cca.ivrinfows.GetCallData,class com.vzt.ws.stubs.cca.ivrinfows.IvrTransfer,class com.vzt.ws.stubs.cca.ivrinfows.IvrTransferred,class com.vzt.ws.stubs.weather.Alert,class com.vzt.ws.stubs.weather.DataSet,class com.vzt.ws.stubs.weather.GetAll,class com.vzt.ws.stubs.weather.GetAllResponse,class com.vzt.ws.stubs.weather.Weather,class com.hughestelematics.htimessageheader.MessageHeaderT,class com.hughestelematics.xmlns.webservicesr.WebserviceSRRequest,class com.hughestelematics.xmlns.webservicesr.WebserviceSRReturn,class com.siebel.customui.UpdateSRTypeInput,class com.siebel.customui.UpdateSRTypeOutput,class com.hti.xmlns.webservicepstn.ObjectFactory,class com.hti.xmlns.webservicepstn.PSTNRequestT,class com.hti.xmlns.webservicepstn.PSTNReturnT,class com.hti.xmlns.webservicepstn.PSTNOutput]
09:47:27 INFO org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName Loaded JDBC driver: oracle.jdbc.OracleDriver
09:47:27 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<com.vzt.callcenter.model.CustomRoute> com.vzt.callcenter.web.CustomAgentRouteController.customAgentRoutes()
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/{mdn}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.vzt.callcenter.model.CustomRoute com.vzt.callcenter.web.CustomAgentRouteController.getCustomRougeByMdn(java.lang.String)
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
09:47:28 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<com.vzt.callcenter.model.CustomRoute> com.vzt.callcenter.web.CustomAgentRouteController.customAgentRoutes()
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/{mdn}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.vzt.callcenter.model.CustomRoute com.vzt.callcenter.web.CustomAgentRouteController.getCustomRougeByMdn(java.lang.String)
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
09:47:28 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
09:47:28 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
09:47:28 INFO pringframework.jmx.export.annotation.AnnotationMBeanExporter afterPropertiesSet Registering beans for JMX exposure on startup
09:47:28 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext initLifecycleProcessor Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor#27b6c151]
09:47:28 DEBUG oconfigure.logging.AutoConfigurationReportLoggingInitializer ogAutoConfigurationReport
09:47:28 ERROR org.springframework.boot.SpringApplication run Application startup failed
java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:154)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:272)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:132)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at com.vzt.Application.main(Application.java:28)
09:47:28 INFO ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext doClose Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4260904e: startup date [Thu Dec 11 09:47:19 EST 2014]; root of context hierarchy
09:47:28 INFO pringframework.jmx.export.annotation.AnnotationMBeanExporter destroy Unregistering JMX-exposed beans on shutdown
Exception in thread "main" java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:154)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:272)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:132)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at com.vzt.Application.main(Application.java:28)
**

Got it fixed by passing the spring.profiles.active=itest2 on VM arguments instead of setting it as an annotation shown below. Not sure, why spring-boot is not allowing to configure using annotation.
#Configuration
#ImportResource("classpath:spring/beans.xml")
#Profile("itest2")
class XMLImportingConfiguration {
}

Related

activiti 6.0 and ldap integration

Looking at the activiti user doc https://www.activiti.org/userguide/#chapter_ldap,
I copied the activiti-ldap jar file from here to
webapps/activiti-app/WEB-INF/lib/activiti-ldap-6.0.0.jar
following error when I start the tomcat
07:05:49,238 [localhost-startStop-1] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [activiti-custom-context.xml]
07:05:49,331 [localhost-startStop-1] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'processEngineConfiguration' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=activitiEngineConfiguration; factoryMethodName=processEngineConfiguration; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/activiti/rest/conf/ActivitiEngineConfiguration.class]] with [Generic bean: class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [activiti-custom-context.xml]]
07:05:49,497 [localhost-startStop-1] WARN org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineConfiguration' defined in class path resource [activiti-custom-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'configurators' of bean class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]: Bean property 'configurators' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Jul 22, 2017 7:05:49 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.activiti.rest.servlet.WebConfigurer
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineConfiguration' defined in class path resource [activiti-custom-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'configurators' of bean class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]: Bean property 'configurators' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1518)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:154)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520)
at org.activiti.rest.servlet.WebConfigurer.contextInitialized(WebConfigurer.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1795)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'configurators' of bean class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]: Bean property 'configurators' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:231)
at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:423)
at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:280)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1514)
... 24 more
Here is my custom config file
/webapps/activiti-rest/WEB-INF/classes/activiti-custom-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean id="processEngineConfiguration" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="configurators">
<list>
<bean class="org.activiti.ldap.LDAPConfigurator">
<!-- Server connection params -->
<property name="server" value="ldap://corp.abc.ad" />
<property name="port" value="3268" />
<property name="user" value="uid=Ad_user,ou=Service Accounts" />
<property name="password" value="Pa55w0rd" />
<!-- Query params -->
<property name="baseDn" value="" />
<property name="queryUserByUserId" value="(&(objectClass=inetOrgPerson)(uid={0}))" />
<property name="queryUserByFullNameLike" value="(&(objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))" />
<property name="queryGroupsForUser" value="(&(objectClass=groupOfUniqueNames)(uniqueMember={0}))" />
<!-- Attribute config -->
<property name="userIdAttribute" value="uid" />
<property name="userFirstNameAttribute" value="cn" />
<property name="userLastNameAttribute" value="sn" />
<property name="groupIdAttribute" value="cn" />
<property name="groupNameAttribute" value="cn" />
</bean>
</list>
</property>
</bean>
</beans>
According to the Activi document, do I need to add the dependency as well in some Pom.xml ? Please advice.
You try to use spring class PropertyPlaceholderConfigurer instead of one of native ProcessEngineConfiguration classes provided by activity.
Please take a look at section "3.2. ProcessEngineConfiguration bean" in activity user guide.

Spring MVC Controller mapping does not work

I am working on a spring-mvc project. After many tries, I am unable to the map the controller in spring. As a result, the below url always returns as 404 not found.
http://localhost:8080/EcommerceBookStore/rest/welcome
Here is the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>EcommerceBookStore</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml,
/WEB-INF/Ecommerce-servlet.xml
</param-value>
</context-param>
<servlet>
<servlet-name>Ecommerce</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Ecommerce</servlet-name>
<url-pattern>/rest/</url-pattern>
</servlet-mapping>
<!-- <servlet>
<servlet-name>Ecommerce</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.java.Client</param-name>
<param-value>com.java.Client</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>-->
</web-app>
Here is the Ecommerce-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<mvc:default-servlet-handler/>
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="org.springframework.security.web.bind.support.AuthenticationPrincipalArgumentResolver" />
</mvc:argument-resolvers>
</mvc:annotation-driven>
<!-- bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WebContent" />
<property name="suffix" value=".jsp" />
</bean-->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<mvc:annotation-driven />
<context:component-scan base-package="com.webspider"/>
<mvc:resources mapping="/Resources/**" location="/Resources/" />
</beans>
Here is the
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:webflow-config="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd">
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource"
id="dataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/Ecommerce"></property>
<property name="username" value="root"></property>
<property name="password" value="pass"></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" >
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties" >
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
<property name="packagesToScan">
<list>
<value>com.webspider</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="10240000" />
</bean>
<security:http auto-config="true">
<security:intercept-url pattern="/admin/**" access="ROLE_ADMIN" />
<security:intercept-url pattern="/customer/**" access="ROLE_USER" />
<security:form-login
login-page="/login"
default-target-url="/product/productList"
authentication-failure-url="/login?error"
username-parameter="username"
password-parameter="password" />
<security:logout
logout-success-url="/login?logout" />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service
data-source-ref="dataSource"
authorities-by-username-query="SELECT username, authority FROM authorities WHERE username = ?"
users-by-username-query="SELECT username, password, enabled FROM users WHERE username = ?" />
</security:authentication-provider>
</security:authentication-manager>
<webflow-config:flow-executor id="flowExecutor" flow-registry="flowRegistry" />
<webflow-config:flow-registry id="flowRegistry" base-path="/WEB-INF/flows">
<webflow-config:flow-location path="/checkout/checkout-flow.xml" id="checkout" />
</webflow-config:flow-registry>
<bean id="flowHandlerMapping" class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
</bean>
<bean id="flowHandlerAdapter" class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
</beans>
Here is the helloworld controller
package com.webspider.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/*
* author: Crunchify.com
*
*/
#Controller
public class HelloWorld {
#RequestMapping("/welcome")
public ModelAndView helloWorld() {
String message = "<br><div style='text-align:center;'>"
+ "<h3>********** Hello World, Spring MVC Tutorial</h3>This message is coming from CrunchifyHelloWorld.java **********</div><br><br>";
return new ModelAndView("welcome", "message", message);
}
}
Here is the tomcat output
Nov 23, 2016 12:41:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Nov 23, 2016 12:41:14 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/atishpatra/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Nov 23, 2016 12:41:15 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Nov 23, 2016 12:41:15 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Nov 23, 2016 12:41:15 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Nov 23, 2016 12:41:15 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Nov 23, 2016 12:41:15 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 972 ms
Nov 23, 2016 12:41:15 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 23, 2016 12:41:15 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.38
Nov 23, 2016 12:41:18 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Nov 23, 2016 12:41:18 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Nov 23, 2016 12:41:18 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'Ecommerce'
Nov 23, 2016 12:41:18 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'Ecommerce': initialization started
Nov 23, 2016 12:41:18 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'Ecommerce-servlet': startup date [Wed Nov 23 00:41:18 CST 2016]; root of context hierarchy
Nov 23, 2016 12:41:18 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/Ecommerce-servlet.xml]
Nov 23, 2016 12:41:19 AM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping' with a different definition: replacing [Root bean: class [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
Nov 23, 2016 12:41:19 AM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter' with a different definition: replacing [Root bean: class [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
Nov 23, 2016 12:41:19 AM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'mvcUriComponentsContributor' with a different definition: replacing [Root bean: class [org.springframework.web.servlet.config.AnnotationDrivenBeanDefinitionParser$CompositeUriComponentsContributorFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.web.servlet.config.AnnotationDrivenBeanDefinitionParser$CompositeUriComponentsContributorFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
Nov 23, 2016 12:41:19 AM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Nov 23, 2016 12:41:20 AM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'Ecommerce-servlet': startup date [Wed Nov 23 00:41:18 CST 2016]; root of context hierarchy
Nov 23, 2016 12:41:20 AM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'Ecommerce-servlet': startup date [Wed Nov 23 00:41:18 CST 2016]; root of context hierarchy
Nov 23, 2016 12:41:20 AM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/Resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
Nov 23, 2016 12:41:20 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'Ecommerce': initialization completed in 2089 ms
Nov 23, 2016 12:41:21 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Nov 23, 2016 12:41:21 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Nov 23, 2016 12:41:21 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5855 ms
I dont see any error in tomcat output. I expected something similar to appear
INFO: Mapped URL path [/welcome] onto handler HelloWorld.
I have no clue what's wrong. Can anyone please point out what I am missing ?
Thanks in advance.
I think you have mixed here:
If your project name is rest and you are deploying it as rest.war then you don't need this line in web.xml
<url-pattern>/rest/</url-pattern>
change it to
<url-pattern>/</url-pattern>
but if you are running it with ROOT.war and you want /rest in url then you have to do as below:
#Controller
#RequestMapping("/rest")
public class HelloWorld {
and then access with below url:
localhost:8080//rest/welcome
Try following,
#RequestMapping("/welcome", method = RequestMethod.GET)
public ModelAndView helloWorld() {...
Make sure your mapping is,
<servlet-mapping>
<servlet-name>Ecommerce</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Customize your default servlet name as,
<mvc:default-servlet-handler default-servlet-name="Ecommerce"/>
URL to try : localhost:8080/Ecommerce/welcome

Deploy Spring MVC 3 Rest on WebSphere Application Server 8

I am trying to deploy a Spring 3 MVC Rest Application on WebSphere Application Server 8.0 and have not had any success.
Here is my controller class
`
#Controller
public class BookingService {
public BookingService() {
System.out.println("test");
}
#RequestMapping(value="/test", method=RequestMethod.GET, produces="application/xml")
#ResponseBody
public String test() {
return "<test>test</test>";
}
}
`
web.xml - servlet spec 3
`
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
</web-app>
`
dispatcher-servlet.xml
`
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="com.example" />
<!-- <tx:annotation-driven /> -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean id="viewResolver" class=
"org.springframework.web.servlet.view.BeanNameViewResolver" />
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="html" value="text/html" />
<entry key="json" value="application/json" />
<entry key="json" value="application/xml" />
</map>
</property>
<property name="viewResolvers">
<list>
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</list>
</property>
<property name="defaultViews">
<list>
<bean
class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
<property name="prefixJson" value="true" />
</bean>
</list>
</property>
</bean>
</beans>
`
I confirm that it does work on tomcat. In the tomcat logs the mapping is being created.
INFO: Mapped "{[/test],methods=[GET],params=[],headers=[],consumes=[],produces=[application/xml],custom=[]}" onto public java.lang.String com.westjet.ens.services.BookingService.test()
Doing a curl on http://localhost:8080/ens-das-web/api/test returns HTTP 200.
However in the was logs this does not appear and doing a curl http://localhost:9080/my-service-web/api/test returns 404 and the following response.
`
Error 404: SRVE0295E: Error reported: 404
`
Also the WAS Log shows the following when doing a curl.
[9/23/15 15:53:21:390 MDT] 00000089 PageNotFound W org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [/ens-das-web/api/test] in DispatcherServlet with name 'dispatcher'
WAS logs:
[9/23/15 15:20:52:809 MDT] 00000049 WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new session context for application key default_host/ens-das-web
[9/23/15 15:20:58:993 MDT] 00000049 webapp I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet Message - [ens-das-web-0_1_war#ens-das-web-0.1.war]:.No Spring WebApplicationInitializer types detected on classpath
[9/23/15 15:20:59:176 MDT] 00000049 webapp I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet Message - [ens-das-web-0_1_war#ens-das-web-0.1.war]:.Initializing Spring FrameworkServlet 'dispatcher'
[9/23/15 15:20:59:178 MDT] 00000049 DispatcherSer I org.springframework.web.servlet.FrameworkServlet initServletBean FrameworkServlet 'dispatcher': initialization started
[9/23/15 15:20:59:229 MDT] 00000049 XmlWebApplica I org.springframework.context.support.AbstractApplicationContext prepareRefresh Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Wed Sep 23 15:20:59 MDT 2015]; root of context hierarchy
[9/23/15 15:20:59:313 MDT] 00000049 XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
[9/23/15 15:20:59:749 MDT] 00000049 AutowiredAnno I org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init> JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[9/23/15 15:20:59:770 MDT] 00000049 DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#3c2306c: defining beans [mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,viewResolver,org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
[9/23/15 15:21:00:615 MDT] 00000049 DispatcherSer I org.springframework.web.servlet.FrameworkServlet initServletBean FrameworkServlet 'dispatcher': initialization completed in 1436 ms
[9/23/15 15:21:00:615 MDT] 00000049 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [ens-das-web-0_1_war] [/ens-das-web] [dispatcher]: Initialization successful.
[9/23/15 15:21:00:616 MDT] 00000049 webcontainer I com.ibm.ws.webcontainer.VirtualHostImpl addWebApplication SRVE0250I: Web Module ENS Data Access Service has been bound to default_host[*:9080,*:80,*:9443,*:5060,*:5061,*:443].
Any help would be much appreciated.
I was able to fix this. For some reason maven was not cleaning the WEB-INF/classes folder and my #Controller class was not available.

Data is inserted twice in database jpa/hibernate

Couldn't find what is wrong with inserting data in mySQL database using Spring data, JPA, hibernate and mySQL. It is inserting data twice in database.
The root-context.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.8.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<context:component-scan base-package="com.project.db">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<jdbc:embedded-database type="HSQL" id="dataSource"/>
<!-- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/jpa"/>
<property name="username" value="root"/>
<property name="password" value=""/>
</bean> -->
<!-- <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true"/>
<property name="generateDdl" value="true"/>
<property name="database" value="MYSQL"/>
</bean> -->
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
id="entityManagerFactory">
<property name="packagesToScan" value="com.project.db.entity"></property>
<property name="dataSource" ref="dataSource"></property>
<!-- <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/> -->
<property name="jpaProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
<property name="persistenceProvider">
<bean class="org.hibernate.jpa.HibernatePersistenceProvider"/>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean class="org.springframework.orm.jpa.JpaTransactionManager"
id="transactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<jpa:repositories base-package="com.project.db.repository"/>
</beans>
The servlet-context.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC #Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.project.db" />
</beans:beans>
My #Entity class is:
#Entity
public class User {
#Id
#GeneratedValue
private Integer id ;
private String name ;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
JPA repository is:
import org.springframework.data.jpa.repository.JpaRepository;
import com.project.entity.User;
public interface UserRepository extends JpaRepository<User, Integer> {
}
And, finally, #Service class is:
import javax.annotation.PostConstruct;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.project.entity.User;
import com.project.repository.UserRepository;
#Transactional
#Service
public class InitDbService {
#Autowired
private UserRepository userRepository;
#PostConstruct
public void init() {
User user = new User();
user.setName("Ali");
userRepository.save(user);
}
}
The above code works without errors/exceptions; database/table is also created but data is inserted into Entity/table twice when I see that in mySQL database.
Project is at github.
Console output is:
INFO: Spring WebApplicationInitializers detected on classpath: [com.project.db.WebAppInitializer#1867584]
Sep 2, 2015 12:50:17 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Wed Sep 02 12:50:17 PKT 2015]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Hibernate: drop table if exists users
Hibernate: create table users (id integer not null auto_increment, name varchar(255), primary key (id))
Hibernate: insert into users (name) values (?) // first time inserting here and
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 5633 ms
Sep 2, 2015 12:50:23 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'springDispatcher'
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'springDispatcher': initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'springDispatcher-servlet': startup date [Wed Sep 02 12:50:23 PKT 2015]; parent: Root WebApplicationContext
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.project.db.HomeController.home(java.util.Locale,org.springframework.ui.Model)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: WebApplicationContext for namespace 'springDispatcher-servlet': startup date [Wed Sep 02 12:50:23 PKT 2015]; parent: Root WebApplicationContext
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: WebApplicationContext for namespace 'springDispatcher-servlet': startup date [Wed Sep 02 12:50:23 PKT 2015]; parent: Root WebApplicationContext
INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
Hibernate: insert into users (name) values (?) // Second time inserting here
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'springDispatcher': initialization completed in 1483 ms
Sep 2, 2015 12:50:25 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/db] is completed
Taking a chance here since I see that you are using Spring MVC.
With Spring MVC, you have a servlet-context which defines the controllers, and an applicationContext for other beans. It might be that you are scanning for beans other than controllers in the servlet-context, which in turn will give you two beans of InitDbService, both running their #PostConstruct-method, inserting into the database.
This can be solved by defining component-scan like this:
servlet-context (after placing controllers and controllers only in a separate package):
<context:component-scan base-package="com.my.project.controller" />
applicationContext:
<context:component-scan base-package="com.my.project">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
You have to enable DEBUG logging to check that your initailizing bean isn't created twice, as Tobb mentioned before your bean is probabbly created in both contexts. Log stands clearly that first insert is executed during root context initialization (witch is correct) and second time during servlet context initialization (which is wrong)
I have found solution to your problem: You have to add commponent scan without default filters to your root-context
<context:component-scan base-package="com.project.db" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
and servlet-context is
<context:component-scan base-package="com.project.db" />
I have tested your project and its working fine with this change.

Spring3 JPA Persistence Exception on entityManagerFactory

I have an application using Spring 3.2.2 and Hibernate 3.6.0.Final. I made some configurations and the app works pretty well on the test environment, using Postgresql, etc.
Junit Stach trace:
enter code here
java.lang.AssertionError: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]:
Invocation of init method failed; nested exception is javax.persistence.PersistenceException:
[PersistenceUnit: P_PROJET] Unable to build EntityManagerFactory
applicationContext.xml :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
<bean id="datasource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/projet" />
<property name="username" value="postgres" />
<property name="password" value="" />
</bean>
<bean id="persistenceUnitManager"
class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="defaultDataSource" ref="datasource"></property>
<property name="persistenceXmlLocation" value="classpath:META-INF/persistance.xml">
</property>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager" ref="persistenceUnitManager"></property>
<property name="persistenceUnitName" value="P_PROJET"></property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"></property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<context:annotation-config></context:annotation-config>
</beans>
Persistance.Xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ">
<persistence-unit name="P_PROJET" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
</properties>
</persistence-unit>
</persistence>
console stack trace:
INFO : org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#4476128: startup date [Mon Apr 07 21:55:10 WET 2014]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [applicationContext.xml]
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO : org.springframework.jdbc.datasource.DriverManagerDataSource - Loaded JDBC driver: org.postgresql.Driver
INFO : org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'P_PROJET'
INFO : org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
INFO : org.hibernate.cfg.Environment - Hibernate 3.6.0.Final
INFO : org.hibernate.cfg.Environment - hibernate.properties not found
INFO : org.hibernate.cfg.Environment - Bytecode provider name : javassist
INFO : org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
INFO : org.hibernate.ejb.Version - Hibernate EntityManager 3.6.0.Final
INFO : org.hibernate.ejb.Ejb3Configuration - Processing PersistenceUnitInfo [
name: P_PROJET
...]
INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.gestion.projet.entities.EquipeProjet
INFO : org.hibernate.cfg.annotations.EntityBinder - Bind entity com.gestion.projet.entities.EquipeProjet on table EquipeProjet
INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.gestion.projet.entities.MembreTache
INFO : org.hibernate.cfg.annotations.EntityBinder - Bind entity com.gestion.projet.entities.MembreTache on table MembreTache
INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.gestion.projet.entities.User
INFO : org.hibernate.cfg.annotations.EntityBinder - Bind entity com.gestion.projet.entities.User on table User
INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.gestion.projet.entities.Projet
INFO : org.hibernate.cfg.annotations.EntityBinder - Bind entity com.gestion.projet.entities.Projet on table Projet
INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.gestion.projet.entities.Phase
INFO : org.hibernate.cfg.annotations.EntityBinder - Bind entity com.gestion.projet.entities.Phase on table Phase
INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.gestion.projet.entities.Role
INFO : org.hibernate.cfg.annotations.EntityBinder - Bind entity com.gestion.projet.entities.Role on table Role
INFO : org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.gestion.projet.entities.Tache
INFO : org.hibernate.cfg.annotations.EntityBinder - Bind entity com.gestion.projet.entities.Tache on table Tache
INFO : org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.gestion.projet.entities.EquipeProjet.user -> User
INFO : org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.gestion.projet.entities.User.membretache -> MembreTache
INFO : org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.gestion.projet.entities.Projet.phases -> Phase
INFO : org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.gestion.projet.entities.Phase.tache -> Tache
INFO : org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.gestion.projet.entities.Tache.membreTaches -> MembreTache
INFO : org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
INFO : org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#8c3c315: defining beans [datasource,persistenceUnitManager,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
Looks like you're missing the hibernate-search jar.
See http://hibernate.org/search/

Categories