Spring boot #Cron taking a long time(5 min) to start up - spring

have a cron job class which is annotated with #Component.
when I am running the cron job its taking approx 5 min to start up.
the last logs are mentioned above
eligible.coupon.merchant.scheduler.cron=0 * * * * *
Sep 21, 2020 2:59:43 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.17.Final}
Sep 21, 2020 2:59:43 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Sep 21, 2020 2:59:43 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Sep 21, 2020 2:59:44 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
Sep 21, 2020 2:59:45 PM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [byte[]] overrides previous : org.hibernate.type.BinaryType#1410d645
Sep 21, 2020 2:59:45 PM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [[B] overrides previous : org.hibernate.type.BinaryType#1410d645
Sep 21, 2020 2:59:45 PM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [Byte[]] overrides previous : org.hibernate.type.WrapperBinaryType#13908f9c
Sep 21, 2020 2:59:45 PM org.hibernate.type.BasicTypeRegistry register
#Component
public class EligibleMerchantController extends DigitalApiRestServiceBinding implements MerchantSchedulerService {
protected final Logger log = LoggerFactory.getLogger(EligibleMerchantController.class);
#Value("${eligible.coupon.merchant.pagesize}")
Integer defaultPagesize;
#Autowired
EligibleMerchantBusinessService service;
#Override
#Scheduled(cron = "${eligible.coupon.merchant.scheduler.cron}")
public void eligibleMerchantScheduler() {
// my cron job
}
}
#Bean
public TaskScheduler taskScheduler() {
return new ConcurrentTaskScheduler();
}
}
its taking more than 5 min which it shouldnt

removed a property
spring.jpa.hibernate.ddl-auto=update
this was taking a long time

Related

Spring Boot 2.1 web-app does not work when deploy to standalone Apache Tomcat web server

I have a traditional project convert to Spring Boot,and it needs a custom listener to load the configuration file which referenced as static global variable in controller, it works well when I add the custom listener to ServletListenerRegistrationBean with the embedded tomcat.However,the custom listener does not work when the project deployed by traditional war package,and lead to startup failed.
This is a simplified demo https://github.com/xuande/spring-boot-demo
#RestController
public class ConfigController {
private Map<String, Object> configMap = ScaComponentFactory.getComponent();
#GetMapping("/properties/{key}")
public Object getConfig(#PathVariable("key") String key) {
return configMap.get(key);
}
}
public class ScaContextListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent sce) {
System.out.println("start listener ...");
ScaComponentFactory.map = new HashMap<>();
ScaComponentFactory.map.put("test", "this is a demo");
}
public void contextDestroyed(ServletContextEvent sce) {
ScaComponentFactory.map.clear();
ScaComponentFactory.map = null;
}
}
public class ScaComponentFactory {
protected static Map<String, String> map = null;
public static String getComponent(String key) {
return map.get(key);
}
public static Map<String, Object> getComponent() {
return Collections.unmodifiableMap(map);
}
}
Main class
#SpringBootApplication
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
#Bean
public ServletListenerRegistrationBean<?> scaListenerRegistrationBean() {
ServletListenerRegistrationBean<ScaContextListener> registration = new ServletListenerRegistrationBean<ScaContextListener>();
registration.setListener(new ScaContextListener());
return registration;
}
}
With embedded tomcat works well
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)
2019-07-03 17:25:20.465 INFO 379676 --- [ main] org.spring.demo.Application : Starting Application on xuande00 with PID 379676 (G:\git\spring-boot-demo\target\classes started by xuande in G:\git\spring-boot-demo)
2019-07-03 17:25:20.465 INFO 379676 --- [ main] org.spring.demo.Application : No active profile set, falling back to default profiles: default
2019-07-03 17:25:23.481 INFO 379676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 5050 (http)
2019-07-03 17:25:23.568 INFO 379676 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-07-03 17:25:23.568 INFO 379676 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-07-03 17:25:23.584 INFO 379676 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_144\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.8.0_111/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_111/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_111/bin/../jre/lib/amd64;D:\Program Files (x86)\NetSarang\Xshell 6\;d:\program files\graphicsmagick-1.3.30-q16;C:\Program Files\Java\jdk1.8.0_111\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\CCM;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Pandoc\;D:\Program Files\apache-maven-3.5.2\bin;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Program Files\Microsoft VS Code\bin;D:\Program Files\Redis\;C:\Users\xuande\AppData\Local\Microsoft\WindowsApps;C:\Users\xuande\AppData\Roaming\npm;C:\Program Files (x86)\Pandoc\;D:\Program Files\hadoop-2.7.4\bin;D:\Program Files\gradle-4.6\bin;;E:\eclipse-loushang;;.]
2019-07-03 17:25:24.006 INFO 379676 --- [ main] org.apache.jasper.servlet.TldScanner : 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.
2019-07-03 17:25:24.006 INFO 379676 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-07-03 17:25:24.006 INFO 379676 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3447 ms
start listener ...
2019-07-03 17:25:24.428 INFO 379676 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-03 17:25:25.037 INFO 379676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 5050 (http) with context path ''
2019-07-03 17:25:25.075 INFO 379676 --- [ main] org.spring.demo.Application : Started Application in 5.512 seconds (JVM running for 6.3)
With standalone tomcat not working
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Server version: Apache Tomcat/8.5.24
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Server built: Nov 27 2017 13:05:30 UTC
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Server number: 8.5.24.0
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: OS Name: Windows 10
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: OS Version: 10.0
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Architecture: amd64
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Java Home: C:\Program Files\Java\jdk1.8.0_144\jre
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: JVM Version: 1.8.0_144-b01
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: JVM Vendor: Oracle Corporation
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: CATALINA_BASE: G:\apache-tomcat-8.5.24
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: CATALINA_HOME: G:\apache-tomcat-8.5.24
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:8783
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Command line argument: -Dcatalina.base=G:\apache-tomcat-8.5.24
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Command line argument: -Dcatalina.home=G:\apache-tomcat-8.5.24
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Command line argument: -Dwtp.deploy=G:\apache-tomcat-8.5.24\wtpwebapps
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Command line argument: -Djava.endorsed.dirs=G:\apache-tomcat-8.5.24\endorsed
July 03, 2019 5:21:35 PM org.apache.catalina.startup.VersionLoggerListener log
Info: Command line argument: -Dfile.encoding=UTF-8
July 03, 2019 5:21:35 PM 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: [C:\Program Files\Java\jdk1.8.0_144\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0_144\jre\bin;C:/Program Files/Java/jdk1.8.0_111/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_111/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_111/bin/../jre/lib/amd64;D:\Program Files (x86)\NetSarang\Xshell 6\;d:\program files\graphicsmagick-1.3.30-q16;C:\Program Files\Java\jdk1.8.0_111\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\CCM;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Pandoc\;D:\Program Files\apache-maven-3.5.2\bin;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Program Files\Microsoft VS Code\bin;D:\Program Files\Redis\;C:\Users\xuande\AppData\Local\Microsoft\WindowsApps;C:\Users\xuande\AppData\Roaming\npm;C:\Program Files (x86)\Pandoc\;D:\Program Files\hadoop-2.7.4\bin;D:\Program Files\gradle-4.6\bin;;E:\eclipse-loushang;;.]
July 03, 2019 5:21:35 PM org.apache.coyote.AbstractProtocol init
Info: Initializing ProtocolHandler ["http-nio-9080"]
July 03, 2019 5:21:36 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
Info: Using a shared selector for servlet write/read
July 03, 2019 5:21:36 PM org.apache.coyote.AbstractProtocol init
Info: Initializing ProtocolHandler ["ajp-nio-9019"]
July 03, 2019 5:21:36 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
Info: Using a shared selector for servlet write/read
July 03, 2019 5:21:36 PM org.apache.catalina.startup.Catalina load
Info: Initialization processed in 1660 ms
July 03, 2019 5:21:36 PM org.apache.catalina.core.StandardService startInternal
Info: Starting service [Catalina]
July 03, 2019 5:21:36 PM org.apache.catalina.core.StandardEngine startInternal
Info: Starting Servlet Engine: Apache Tomcat/8.5.24
July 03, 2019 5:21:42 PM 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.
July 03, 2019 5:21:43 PM org.apache.catalina.core.ApplicationContext log
Info: 2 Spring WebApplicationInitializers detected on classpath
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)
2019-07-03 17:21:44.556 INFO 398420 --- [ost-startStop-1] org.spring.demo.Application : Starting Application on xuande00 with PID 398420 (G:\git\spring-boot-demo\target\demo\WEB-INF\classes started by xuande in E:\eclipse-loushang)
2019-07-03 17:21:44.556 INFO 398420 --- [ost-startStop-1] org.spring.demo.Application : No active profile set, falling back to default profiles: default
2019-07-03 17:21:46.041 INFO 398420 --- [ost-startStop-1] o.a.c.c.C.[.[localhost].[/demo] : Initializing Spring embedded WebApplicationContext
2019-07-03 17:21:46.056 INFO 398420 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1422 ms
2019-07-03 17:21:46.667 WARN 398420 --- [ost-startStop-1] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configController' defined in file [G:\git\spring-boot-demo\target\demo\WEB-INF\classes\org\spring\demo\controller\ConfigController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.spring.demo.controller.ConfigController]: Constructor threw exception; nested exception is java.lang.NullPointerException
2019-07-03 17:21:46.683 INFO 398420 --- [ost-startStop-1] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-03 17:21:46.699 ERROR 398420 --- [ost-startStop-1] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configController' defined in file [G:\git\spring-boot-demo\target\demo\WEB-INF\classes\org\spring\demo\controller\ConfigController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.spring.demo.controller.ConfigController]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1287) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1181) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171) [spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196) [catalina.jar:8.5.24]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.5.24]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [catalina.jar:8.5.24]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [catalina.jar:8.5.24]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.spring.demo.controller.ConfigController]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1279) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
... 26 common frames omitted
Caused by: java.lang.NullPointerException: null
at java.util.Collections$UnmodifiableMap.<init>(Collections.java:1446) ~[na:1.8.0_144]
at java.util.Collections.unmodifiableMap(Collections.java:1433) ~[na:1.8.0_144]
at org.spring.demo.listener.ScaComponentFactory.getComponent(ScaComponentFactory.java:15) ~[classes/:na]
at org.spring.demo.controller.ConfigController.<init>(ConfigController.java:13) ~[classes/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
... 28 common frames omitted
#Configuration
public class ScaContextInitializer implements ServletContextInitializer {
#Override
public void onStartup(ServletContext servletContext) throws ServletException {
System.out.println("start listener ...");
ScaComponentFactory.map = new HashMap<>();
ScaComponentFactory.map.put("test", "this is a demo");
}
}
Both embedded tomcat and standalone tomcat work well using ServletContextInitializer instead of ServletContextListener

Update not happening with Spring Data JPA

I'm using programmatic configuration of Spring Data JPA which goes like this:
package com.bosch.bip.Utils;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
#Configuration
#EnableTransactionManagement
#EnableJpaRepositories(basePackages="com.bosch.bip.Repositories",queryLookupStrategy=Key.CREATE_IF_NOT_FOUND)
public class PersistentContext {
#Bean
DataSource datasource()
{
BasicDataSource ds=new BasicDataSource();
ds.setUrl("jdbc:oracle:thin:#10.165.18.29:1521:ORCL");
ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
ds.setUsername("BIPUser");
ds.setPassword("BIP");
return ds;
}
#Bean
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource ds)
{
LocalContainerEntityManagerFactoryBean emf= new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(ds);
emf.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
emf.setPackagesToScan("com.bosch.bip.Entities");
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.dialect","org.hibernate.dialect.Oracle10gDialect");
jpaProperties.put("hibernate.hbm2ddl.auto", "update");
jpaProperties.put("hibernate.enable_lazy_load_no_trans", "true");
jpaProperties.put("hibernate.format_sql", "true");
jpaProperties.put("hibernate.show_sql", "true");
emf.setJpaProperties(jpaProperties);
return emf;
}
#Bean
JpaTransactionManager transactionManager(EntityManagerFactory emf)
{
JpaTransactionManager tm= new JpaTransactionManager();
tm.setEntityManagerFactory(emf);
return tm;
}
}
And I'm using a custom repository to update a row in my DB, the code of which goes like this:
package com.bosch.bip.Repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import com.bosch.bip.Entities.AdapterVersion;
public interface AdapterVersion_REP extends JpaRepository<AdapterVersion, Long>{
#Modifying(clearAutomatically=true)
#Query(value ="update ADAPTER_VERSION av SET av.DESCRIPTION=:description WHERE av.ADAPTER_ID=:adapterId AND av.VERSION=:version",nativeQuery=true )
#Transactional
int updateSelectedAdapterDetails(#Param("description") String description,#Param("adapterId") int adapterId, #Param("version") String serverVersion );
}
When I try executing the query using a REST client, the console just goes blank without any action.
Please help as I'm unable to get through this.
Logs for the SQL:
May 11, 2016 1:31:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
May 11, 2016 1:31:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:activiti-explorer' did not find a matching property.
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Dec 1 2015 22:30:46 UTC
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.30.0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre8
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_71-b15
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:5858
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30\endorsed
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 11, 2016 1:31:32 PM 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: C:\Program Files\Java\jre8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/lib/amd64;C:\Users\CHH7KOR\Documents\Maven\apache-maven-3.3.9\bin;C:\Program Files\Java\jdk1.8.0_74\bin;C:\Program Files (x86)\Maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\7-Zip;C:\Program Files (x86)\Toolbase Client;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program Files (x86)\Ant\apache-ant-1.9.6-bin\apache-ant-1.9.6\bin;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Users\CHH7KOR\Downloads\eclipse;;C:\Program Files\WinMagic\SecureDoc-NT\;.
May 11, 2016 1:31:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 11, 2016 1:31:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 11, 2016 1:31:33 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 11, 2016 1:31:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 11, 2016 1:31:33 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1387 ms
May 11, 2016 1:31:33 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 11, 2016 1:31:33 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.30
May 11, 2016 1:31:33 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [151] milliseconds.
May 11, 2016 1:31:41 PM 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.
May 11, 2016 1:31:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [com.bosch.bip.RESTfulServices.RESTfulInitializer#1e936f98]
May 11, 2016 1:31:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
01:31:41,738 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
01:31:41,929 [localhost-startStop-1] INFO org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Wed May 11 13:31:41 IST 2016]; root of context hierarchy
01:31:42,067 [localhost-startStop-1] INFO org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Registering annotated classes: [class com.bosch.bip.RESTfulServices.RESTfulConfiguration]
01:31:43,187 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/update],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.createUser(org.springframework.util.MultiValueMap<java.lang.Object, java.lang.Object>)
01:31:43,187 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/allAdapterDetails],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.serviceForFetchingAllAdapterDetails() throws java.io.IOException
01:31:43,188 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/selectedAdapterDetailsForUpdate/{adapterId}/{serverVersion}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.serviceForFetchingSelectedAdapterDetails(java.util.Map<java.lang.Object, java.lang.Object>) throws java.io.IOException
01:31:43,875 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: Root WebApplicationContext: startup date [Wed May 11 13:31:41 IST 2016]; root of context hierarchy
01:31:44,072 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 2332 ms
01:31:44,083 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization started
May 11, 2016 1:31:44 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
01:31:44,148 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization completed in 65 ms
May 11, 2016 1:31:44 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 11, 2016 1:31:44 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 11, 2016 1:31:44 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11078 ms
01:31:52,099 [http-nio-8080-exec-2] INFO org.springframework.context.annotation.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#12b5782d: startup date [Wed May 11 13:31:52 IST 2016]; root of context hierarchy
01:31:56,158 [http-nio-8080-exec-2] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'default'
01:31:56,416 [http-nio-8080-exec-2] INFO org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
name: default
...]
01:31:57,686 [http-nio-8080-exec-2] INFO org.hibernate.Version - HHH000412: Hibernate Core {4.3.11.Final}
01:31:57,725 [http-nio-8080-exec-2] INFO org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
01:31:57,738 [http-nio-8080-exec-2] INFO org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
01:32:00,394 [http-nio-8080-exec-2] INFO org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
01:32:02,658 [http-nio-8080-exec-2] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
01:32:02,790 [http-nio-8080-exec-2] INFO org.hibernate.engine.jdbc.internal.LobCreatorBuilder - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
01:32:04,883 [http-nio-8080-exec-2] INFO org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
01:32:09,570 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update
01:32:09,571 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000102: Fetching database metadata
01:32:09,860 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000396: Updating schema
01:32:10,679 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER
01:32:10,679 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [name, id, is_client, classification]
01:32:10,680 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,681 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [adapter_pk]
01:32:10,746 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER_SERVER_MAP
01:32:10,747 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [adapter_version_id, server_id]
01:32:10,748 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [adapter_server_map_server_fk, adapter_server_map_adapver_fk]
01:32:10,748 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: []
01:32:10,817 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER_VERSION
01:32:10,817 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [num_recon_attempt, polling_freq, tooltip, jar_path, description, adapter_id, id, category, type, version, status]
01:32:10,818 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [adapter_version_configval_fkv1, adapter_version_adapter_fk]
01:32:10,819 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [adapter_version_pk]
01:32:10,868 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.CONFIG_TYPE
01:32:10,868 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [id, type, value]
01:32:10,869 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,870 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [configuration_pk]
01:32:10,911 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.CONFIG_VALUE
01:32:10,911 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [config_value, id, config_type]
01:32:10,912 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [config_value_config_type_fk]
01:32:10,913 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [config_value_pk]
01:32:10,956 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.FEATURE
01:32:10,956 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [feature, id]
01:32:10,957 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,957 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [feature_pk]
01:32:11,003 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.SERVER
01:32:11,003 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [server, id, server_version]
01:32:11,004 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [server_adapter_fk]
01:32:11,004 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [server_pk]
01:32:11,049 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.SERVICE_ORCHESTRATION
01:32:11,049 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [orchestration_value, orchestration_name, id]
01:32:11,050 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:11,051 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [service_orchestration_pk]
01:32:11,092 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.TEMPLATE
01:32:11,092 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [feature_id, template, id, language_id]
01:32:11,093 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [template_language_fk, template_feature_fk]
01:32:11,094 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [template_pk]
01:32:11,201 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.LANGUAGE
01:32:11,201 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [language, id]
01:32:11,202 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:11,203 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [language_pk]
01:32:11,216 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000232: Schema update complete
hadfaj3
Hibernate:
update
ADAPTER_VERSION av
SET
av.DESCRIPTION=?
WHERE
av.ADAPTER_ID=?
AND av.VERSION=?
Can you please change it to the below and try:
#Modifying(clearAutomatically=true)
#Query(value ="update ADAPTER_VERSION av SET av.DESCRIPTION=:description WHERE av.ADAPTER_ID=:adapterId AND av.VERSION=:version",nativeQuery=true )
void updateSelectedAdapterDetails(#Param("description") String description,#Param("adapterId") int adapterId, #Param("version") String serverVersion );
Move the transactional to the service/component making a call to the update function.

Eclipse console maven output not showing after app is ran

Usually when you run a maven build in eclipse, it will show the results of each phase in the console in eclipse, and end with a big FAILURE or SUCCESS output.
But when I run an application in one of the build phases as part of my maven build, I see the maven output up until the application is running and then I see the application is starting up but no maven output after that.
Is it in a different console?
I want to start an application, and then in my integration-testphase, run the integration tests that use the running app.
here is the output I am seeing:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building UserRegistrationServices 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # rest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\pmandayam\git\UserRegistrationServices\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # rest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) # rest ---
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (my-execution) # rest ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.2.5.RELEASE)
Aug 04, 2015 3:45:38 PM org.springframework.boot.StartupInfoLogger logStarting
INFO: Starting Application on CNU43390VX with PID 21300 (C:\Users\pmandayam\git\UserRegistrationServices\target\classes started by pmandayam in C:\Users\pmandayam\git\UserRegistrationServices)
Aug 04, 2015 3:45:38 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e500635: startup date [Tue Aug 04 15:45:38 EDT 2015]; root of context hierarchy
Aug 04, 2015 3:45:39 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: 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]]
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [class org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$f7e4d7] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'objectPostProcessor' of type [class org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#6539808b' of type [class org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [class org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$b3d61949] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'methodSecurityMetadataSource' of type [class org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'metaDataSourceAdvisor' of type [class org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer initialize
INFO: Tomcat initialized with port(s): 8080 (http)
Aug 04, 2015 3:45:41 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Aug 04, 2015 3:45:41 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.23
Aug 04, 2015 3:45:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
Aug 04, 2015 3:45:41 PM org.springframework.boot.context.embedded.EmbeddedWebApplicationContext prepareEmbeddedWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 2808 ms
Aug 04, 2015 3:45:43 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#2bfb02e5, org.springframework.security.web.context.SecurityContextPersistenceFilter#b88096f, org.springframework.security.web.header.HeaderWriterFilter#213e002f, org.springframework.security.web.authentication.logout.LogoutFilter#67a54cef, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#4e56549f, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#750fdc80, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#7d01d0d, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#533cd22b, org.springframework.security.web.session.SessionManagementFilter#6d1025ca, org.springframework.security.web.access.ExceptionTranslationFilter#684e40c9, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#3140fe28]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.ServletRegistrationBean onStartup
INFO: Mapping servlet: 'dispatcherServlet' to [/]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.FilterRegistrationBean configure
INFO: Mapping filter: 'characterEncodingFilter' to: [/*]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.FilterRegistrationBean configure
INFO: Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.FilterRegistrationBean configure
INFO: Mapping filter: 'springSecurityFilterChain' to: [/*]
Aug 04, 2015 3:45:43 PM org.springframework.boot.autoconfigure.security.AuthenticationManagerConfiguration$DefaultInMemoryUserDetailsManagerConfigurer configure
INFO:
Using default security password: bf87906c-265c-4f62-baae-cdc80c66fc46
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e500635: startup date [Tue Aug 04 15:45:38 EDT 2015]; root of context hierarchy
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/register],methods=[POST]}" onto public main.User main.UserRestController.register(main.User)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/update],methods=[PUT]}" onto public main.User main.UserRestController.update(java.lang.String,main.User)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByAddress],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByAddress(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/getBasicUser],methods=[GET]}" onto public main.User main.UserRestController.getBasicUser(java.lang.String,java.lang.String) throws java.io.IOException
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/AllUsers],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getAllUsers()
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByFullName],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByFullName(java.lang.String,java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByUsername],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByUsername(java.lang.String,java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByEmail],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByEmail(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByPhoneNumber],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByPhoneNumber(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByFirstname],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByFirstname(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByLastname],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByLastname(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByZipCode],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByZipCode(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByCity],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByCity(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByState],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByState(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/login],methods=[POST]}" onto public main.RoleInfo main.UserRestController.login(main.Credentials)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/delete],methods=[DELETE]}" onto public void main.UserRestController.deleteUser(java.util.List<java.lang.String>)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/error]}" 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)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Aug 04, 2015 3:45:44 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Aug 04, 2015 3:45:44 PM org.springframework.jmx.export.MBeanExporter afterSingletonsInstantiated
INFO: Registering beans for JMX exposure on startup
Aug 04, 2015 3:45:44 PM org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer start
INFO: Tomcat started on port(s): 8080 (http)
Aug 04, 2015 3:45:44 PM org.springframework.boot.StartupInfoLogger logStarted
INFO: Started Application in 6.041 seconds (JVM running for 11.541)
EDIT: As per Nicoll's comment below, my maven build cannot find the start or stop goals and it is giving me an error that says it can't find it.
spring-boot:run is actually holding the build thread while the app is running. If we didn't do that, the process would just die once your application has started.
If you want to configure your build for a typical integration test scenario, we've added that as of Spring 1.3, check the updated documentation for more details (see Working with integration tests)

Issues with Oracle JDBC with Hibernate... Sometimes

I'm having a bit of a unique issue.
I'm able to successfully connect and manage entities when running JUnit tests, but once I start my actual application, I get "Specified JDBC Driver oracle.jdbc.OracleDriver class not found."
What confuses me is that it is there. It works when running my JUnit Tests.
Any insights are appreciated!
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="db">
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:#host:port/db</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.default_schema">db</property>
<property name="show_sql">true</property>
<mapping resource="org/entity/RunResultEntity.hbm.xml"/>
<mapping resource="org/entity/TransactionResultEntity.hbm.xml"/>
<mapping resource="org/entity/FailureResultEntity.hbm.xml"/>
</session-factory>
</hibernate-configuration>
HibernateUtil.java
package org.util;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.*;
public class HibernateUtil {
private static SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
Configuration configuration = new Configuration();
configuration.configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(
configuration.getProperties()
).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
return sessionFactory;
} catch (Throwable ex) {
// Exception thrown here!
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static void shutdown() {
// Close caches and connection pools
getSessionFactory().close();
}
}
pom.xml (dependency added to local repository)
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3.0</version>
<scope>provided</scope>
</dependency>
log
Oct 09, 2014 3:02:58 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Oct 09, 2014 3:02:58 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.0.1.Final}
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/entity/RunResultEntity.hbm.xml
Oct 09, 2014 3:02:59 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/entity/TransactionResultEntity.hbm.xml
Oct 09, 2014 3:02:59 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/entity/FailureResultEntity.hbm.xml
Oct 09, 2014 3:02:59 PM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: db
Oct 09, 2014 3:02:59 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Initial SessionFactory creation failed.org.hibernate.HibernateException: Specified JDBC Driver oracle.jdbc.OracleDriver class not found
Exception in thread "main" java.lang.ExceptionInInitializerError
I found my problem. Lower in my pom.xml I had this little snippet
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.1.Final</version>
<classifier>tests</classifier>
</dependency>
The classifier was only giving access to my test suite. Removing the classifier fixed the issue.
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.1.Final</version>
</dependency>

WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher' [duplicate]

This question already has answers here:
Why does Spring MVC respond with a 404 and report "No mapping found for HTTP request with URI [...] in DispatcherServlet"?
(13 answers)
Closed 6 years ago.
I had a issue in spring3 frameowrk.org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher'
Please see the following
Jun 01, 2014 11:16:27 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Sony\VAIO Improvement\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files\MySQL\MySQL Server 5.1\bin;;.
Jun 01, 2014 11:16:28 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:CustomerDetails' did not find a matching property.
Jun 01, 2014 11:16:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 01, 2014 11:16:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 01, 2014 11:16:28 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1635 ms
Jun 01, 2014 11:16:28 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 01, 2014 11:16:28 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.50
Jun 01, 2014 11:16:30 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\Smileanbu\Documents\Spring_JDBC\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CustomerDetails\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jun 01, 2014 11:16:33 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'customerdispatcher'
Jun 01, 2014 11:16:33 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'customerdispatcher': initialization started
Jun 01, 2014 11:16:33 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'customerdispatcher-servlet': startup date [Sun Jun 01 11:16:33 IST 2014]; root of context hierarchy
Jun 01, 2014 11:16:34 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/customerdispatcher-servlet.xml]
Jun 01, 2014 11:16:34 AM org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Jun 01, 2014 11:16:35 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#19705d39: defining beans [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,viewResolver,dataSource,sessionFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
300 [localhost-startStop-1] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
312 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - Hibernate 3.6.10.Final
315 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - hibernate.properties not found
321 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
327 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
479 [localhost-startStop-1] INFO org.hibernate.cfg.Configuration - configuring from url: file:/C:/Users/Smileanbu/Documents/Spring_JDBC/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/CustomerDetails/WEB-INF/classes/hibernate.cfg.xml
538 [localhost-startStop-1] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
594 [localhost-startStop-1] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
688 [localhost-startStop-1] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.springforbeginners.model.Customer
778 [localhost-startStop-1] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.springforbeginners.model.Customer on table CUSTOMER
900 [localhost-startStop-1] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
Jun 01, 2014 11:16:36 AM org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
INFO: Building new Hibernate SessionFactory
919 [localhost-startStop-1] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
929 [localhost-startStop-1] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
1606 [localhost-startStop-1] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect
1641 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Database ->
name : MySQL
version : 5.1.73-community
major : 5
minor : 1
1641 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Driver ->
name : MySQL-AB JDBC Driver
version : mysql-connector-java-5.1.14 ( Revision: ${bzr.revision-id} )
major : 5
minor : 1
1644 [localhost-startStop-1] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
1648 [localhost-startStop-1] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
1648 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
1648 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
1649 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
1649 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
1651 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
1651 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
1651 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
1653 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
1661 [localhost-startStop-1] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
1661 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
1661 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
1663 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
1663 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
1663 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
1681 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
1681 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
1699 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
1701 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
1751 [localhost-startStop-1] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [characters_clob] overrides previous : org.hibernate.type.PrimitiveCharacterArrayClobType#236f7565
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [clob] overrides previous : org.hibernate.type.ClobType#6a844c0f
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Clob] overrides previous : org.hibernate.type.ClobType#6a844c0f
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_characters_clob] overrides previous : org.hibernate.type.CharacterArrayClobType#139da36b
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_clob] overrides previous : org.hibernate.type.MaterializedClobType#5253cfdc
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType#7c739ebd
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_materialized_blob] overrides previous : org.hibernate.type.WrappedMaterializedBlobType#abaca20
1789 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [blob] overrides previous : org.hibernate.type.BlobType#6d2c0060
1789 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Blob] overrides previous : org.hibernate.type.BlobType#6d2c0060
2313 [localhost-startStop-1] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
Jun 01, 2014 11:16:38 AM org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
INFO: Using DataSource [org.apache.commons.dbcp.BasicDataSource#1c53ccd6] of Hibernate SessionFactory for HibernateTransactionManager
Jun 01, 2014 11:16:38 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'customerdispatcher': initialization completed in 4758 ms
Jun 01, 2014 11:16:38 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 01, 2014 11:16:38 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 01, 2014 11:16:38 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10104 ms
Jun 01, 2014 11:16:40 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher'
customerdispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<context:annotation-config />
<context:component-scan base-package="com.springforbeginners.controller.CustomerController" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/customerdb"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<tx:annotation-driven />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<servlet>
<servlet-name>customerdispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>customerdispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/index</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
CustomerController class
package com.springforbeginners.controller;
import com.springforbeginners.model.Customer;
import com.springforbeginners.service.CustomerService;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
#Controller
public class CustomerController {
#Autowired
private CustomerService customerService;
#RequestMapping("/index")
public String listCustomers(Map<String, Object> map) {
map.put("customer", new Customer());
map.put("customerList", customerService.listCustomer());
return "customer";
}
#RequestMapping(value = "/add", method = RequestMethod.POST)
public String addCustomer(#ModelAttribute("customer") Customer customer, BindingResult result) {
customerService.addCustomer(customer);
return "redirect:/index";
}
#RequestMapping("/delete/{customerId}")
public String deleteCustomer(#PathVariable("customerId") Integer customerId) {
customerService.removeCustomer(customerId);
return "redirect:/index";
}
}
I am not able to get my customer.jsp page it is present in my WEB_INF/jsp/customer.jsp.Please help me from this error No matching Http request for URL
WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher'
In your controller or your web.xml, there's nothing that maps yor URI to CustomerDetails. You should either change
<url-pattern>/</url-pattern> to <url-pattern>/CustomerDetails</url-pattern>
or add this in your controller
#Controller
#RequestMapping(value = "CustomerDetails")
public class CustomerController {
...
}
And then you can call the url by:
Context/CustomerDetails/index
And by the way, in your <welcome-file-list>, if you are trying to call the servlet on initializing, it won't work, the <welcome-file> has to be a "file".

Resources