java.lang.NullPointerException

Spring JIRA | watanabe | 5 years ago
  1. 0

    SQLQuery with SQLQueryImpl goes correctly. But SQLQuery with QueryDslJdbcTemplate returns NullPointerException. see attachment file (eclipse project) @Component public class AppService { @Resource DataSource dataSource; public void runWithOutTemplate() { Connection connection = DataSourceUtils.getConnection(dataSource); SQLQuery query = new SQLQueryImpl(connection, new PostgresTemplates()); QEmployee qEmployee = QEmployee.employee; try { Employee emp = query.from(qEmployee).where(qEmployee.id.eq(1)) .uniqueResult(qEmployee); System.out.println("### RESULT: " + emp.getName()); } finally { DataSourceUtils.releaseConnection(connection, dataSource); } } public void runWithTemplate() { QueryDslJdbcTemplate tmpl = new QueryDslJdbcTemplate(dataSource); SQLQuery query = tmpl.newSqlQuery(); QEmployee qEmployee = QEmployee.employee; Employee emp = query.from(qEmployee).where(qEmployee.id.eq(1)) .uniqueResult(qEmployee); System.out.println("### RESULT: " + emp.getName()); } } 2011-10-04 17:13:09,921 INFO [org.springframework.context.support.ClassPathXmlApplicationContext] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7b6889: startup date [Tue Oct 04 17:13:09 JST 2011]; root of context hierarchy 2011-10-04 17:13:10,003 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml] 2011-10-04 17:13:10,031 DEBUG [org.springframework.beans.factory.xml.DefaultDocumentLoader] Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl] 2011-10-04 17:13:10,174 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Loading schema mappings from [META-INF/spring.schemas] 2011-10-04 17:13:10,179 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Loaded schema mappings: {http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/data/repository/spring-repository.xsd=org/springframework/data/repository/config/spring-repository-1.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/data/repository/spring-repository-1.0.xsd=org/springframework/data/repository/config/spring-repository-1.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd} 2011-10-04 17:13:10,224 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.5.xsd 2011-10-04 17:13:10,298 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/context/spring-context-2.5.xsd] in classpath: org/springframework/context/config/spring-context-2.5.xsd 2011-10-04 17:13:10,312 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/tool/spring-tool-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-tool-2.5.xsd 2011-10-04 17:13:10,321 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/tx/spring-tx-2.5.xsd] in classpath: org/springframework/transaction/config/spring-tx-2.5.xsd 2011-10-04 17:13:10,354 DEBUG [org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader] Loading bean definitions 2011-10-04 17:13:10,372 DEBUG [org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver] Loaded NamespaceHandler mappings: {http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/jdbc=org.springframework.jdbc.config.JdbcNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler} 2011-10-04 17:13:10,438 INFO [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] JSR-330 'javax.inject.Named' annotation found and supported for component scanning 2011-10-04 17:13:10,438 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Looking for matching resources in directory tree [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3] 2011-10-04 17:13:10,438 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Searching directory [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3] for files matching pattern [C:/nopafit-workspace/querydslsample3/target/classes/net/example/querydslsample3/**/*.class] 2011-10-04 17:13:10,443 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Searching directory [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\metadata] for files matching pattern [C:/nopafit-workspace/querydslsample3/target/classes/net/example/querydslsample3/**/*.class] 2011-10-04 17:13:10,447 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Searching directory [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\service] for files matching pattern [C:/nopafit-workspace/querydslsample3/target/classes/net/example/querydslsample3/**/*.class] 2011-10-04 17:13:10,451 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Resolved location pattern [classpath*:net/example/querydslsample3/**/*.class] to resources [file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\App.class], file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\metadata\Employee.class], file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\metadata\QEmployee.class], file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\service\AppService.class]] 2011-10-04 17:13:10,501 DEBUG [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] Identified candidate component class: file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\service\AppService.class] 2011-10-04 17:13:10,565 DEBUG [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loaded 11 bean definitions from location pattern [applicationContext.xml] 2011-10-04 17:13:10,565 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Bean factory for org.springframework.context.support.ClassPathXmlApplicationContext@7b6889: org.springframework.beans.factory.support.DefaultListableBeanFactory@1c6572b: defining beans [appService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,transactionManager]; root of factory hierarchy 2011-10-04 17:13:10,612 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,612 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,643 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,644 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,724 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,725 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,726 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,735 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,735 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,736 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,736 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,746 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.aop.config.internalAutoProxyCreator' to allow for resolving potential circular references 2011-10-04 17:13:10,775 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,782 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@17b0998] 2011-10-04 17:13:10,785 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@1e2befa] 2011-10-04 17:13:10,786 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c6572b: defining beans [appService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,transactionManager]; root of factory hierarchy 2011-10-04 17:13:10,786 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'appService' 2011-10-04 17:13:10,786 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'appService' 2011-10-04 17:13:10,804 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Found injected element on class [net.example.querydslsample3.service.AppService]: ResourceElement for javax.sql.DataSource net.example.querydslsample3.service.AppService.dataSource 2011-10-04 17:13:10,805 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'appService' to allow for resolving potential circular references 2011-10-04 17:13:10,808 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Processing injected method of bean 'appService': ResourceElement for javax.sql.DataSource net.example.querydslsample3.service.AppService.dataSource 2011-10-04 17:13:10,809 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'dataSource' 2011-10-04 17:13:10,809 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'dataSource' 2011-10-04 17:13:10,858 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'dataSource' to allow for resolving potential circular references 2011-10-04 17:13:10,890 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,890 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,892 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.transaction.config.internalTransactionAdvisor' to allow for resolving potential circular references 2011-10-04 17:13:10,917 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,917 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,921 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' to allow for resolving potential circular references 2011-10-04 17:13:10,928 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,928 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,935 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'dataSource' 2011-10-04 17:13:10,935 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'appService' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,942 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' to allow for resolving potential circular references 2011-10-04 17:13:10,947 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking afterPropertiesSet() on bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'dataSource' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'transactionManager' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'transactionManager' 2011-10-04 17:13:10,962 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'transactionManager' to allow for resolving potential circular references 2011-10-04 17:13:10,976 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'dataSource' 2011-10-04 17:13:10,977 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking afterPropertiesSet() on bean with name 'transactionManager' 2011-10-04 17:13:10,977 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,980 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'transactionManager' 2011-10-04 17:13:10,982 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@d6b059] 2011-10-04 17:13:10,982 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'lifecycleProcessor' 2011-10-04 17:13:10,983 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'appService' 2011-10-04 17:13:10,991 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 2011-10-04 17:13:11,339 DEBUG [com.mysema.query.sql.AbstractSQLQuery] query : select employee.id, employee.name from employee employee where employee.id = ? limit ? ### RESULT: dog 2011-10-04 17:13:11,400 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 2011-10-04 17:13:11,423 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 2011-10-04 17:13:11,432 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 2011-10-04 17:13:11,438 DEBUG [com.mysema.query.sql.AbstractSQLQuery] query : select employee.id, employee.name from employee employee where employee.id = ? limit ? Exception in thread "main" java.lang.NullPointerException at com.mysema.query.sql.AbstractSQLQuery.iterateSingle(AbstractSQLQuery.java:434) at com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:367) at com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:360) at com.mysema.query.sql.AbstractSQLQuery.uniqueResult(AbstractSQLQuery.java:576) at net.example.querydslsample3.service.AppService.runWithTemplate(AppService.java:43) at net.example.querydslsample3.App.main(App.java:19)

    Spring JIRA | 5 years ago | watanabe
    java.lang.NullPointerException
  2. 0

    SQLQuery with SQLQueryImpl goes correctly. But SQLQuery with QueryDslJdbcTemplate returns NullPointerException. see attachment file (eclipse project) @Component public class AppService { @Resource DataSource dataSource; public void runWithOutTemplate() { Connection connection = DataSourceUtils.getConnection(dataSource); SQLQuery query = new SQLQueryImpl(connection, new PostgresTemplates()); QEmployee qEmployee = QEmployee.employee; try { Employee emp = query.from(qEmployee).where(qEmployee.id.eq(1)) .uniqueResult(qEmployee); System.out.println("### RESULT: " + emp.getName()); } finally { DataSourceUtils.releaseConnection(connection, dataSource); } } public void runWithTemplate() { QueryDslJdbcTemplate tmpl = new QueryDslJdbcTemplate(dataSource); SQLQuery query = tmpl.newSqlQuery(); QEmployee qEmployee = QEmployee.employee; Employee emp = query.from(qEmployee).where(qEmployee.id.eq(1)) .uniqueResult(qEmployee); System.out.println("### RESULT: " + emp.getName()); } } 2011-10-04 17:13:09,921 INFO [org.springframework.context.support.ClassPathXmlApplicationContext] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7b6889: startup date [Tue Oct 04 17:13:09 JST 2011]; root of context hierarchy 2011-10-04 17:13:10,003 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml] 2011-10-04 17:13:10,031 DEBUG [org.springframework.beans.factory.xml.DefaultDocumentLoader] Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl] 2011-10-04 17:13:10,174 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Loading schema mappings from [META-INF/spring.schemas] 2011-10-04 17:13:10,179 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Loaded schema mappings: {http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/data/repository/spring-repository.xsd=org/springframework/data/repository/config/spring-repository-1.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/data/repository/spring-repository-1.0.xsd=org/springframework/data/repository/config/spring-repository-1.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd} 2011-10-04 17:13:10,224 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.5.xsd 2011-10-04 17:13:10,298 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/context/spring-context-2.5.xsd] in classpath: org/springframework/context/config/spring-context-2.5.xsd 2011-10-04 17:13:10,312 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/tool/spring-tool-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-tool-2.5.xsd 2011-10-04 17:13:10,321 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/tx/spring-tx-2.5.xsd] in classpath: org/springframework/transaction/config/spring-tx-2.5.xsd 2011-10-04 17:13:10,354 DEBUG [org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader] Loading bean definitions 2011-10-04 17:13:10,372 DEBUG [org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver] Loaded NamespaceHandler mappings: {http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/jdbc=org.springframework.jdbc.config.JdbcNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler} 2011-10-04 17:13:10,438 INFO [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] JSR-330 'javax.inject.Named' annotation found and supported for component scanning 2011-10-04 17:13:10,438 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Looking for matching resources in directory tree [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3] 2011-10-04 17:13:10,438 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Searching directory [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3] for files matching pattern [C:/nopafit-workspace/querydslsample3/target/classes/net/example/querydslsample3/**/*.class] 2011-10-04 17:13:10,443 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Searching directory [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\metadata] for files matching pattern [C:/nopafit-workspace/querydslsample3/target/classes/net/example/querydslsample3/**/*.class] 2011-10-04 17:13:10,447 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Searching directory [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\service] for files matching pattern [C:/nopafit-workspace/querydslsample3/target/classes/net/example/querydslsample3/**/*.class] 2011-10-04 17:13:10,451 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] Resolved location pattern [classpath*:net/example/querydslsample3/**/*.class] to resources [file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\App.class], file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\metadata\Employee.class], file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\metadata\QEmployee.class], file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\service\AppService.class]] 2011-10-04 17:13:10,501 DEBUG [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] Identified candidate component class: file [C:\nopafit-workspace\querydslsample3\target\classes\net\example\querydslsample3\service\AppService.class] 2011-10-04 17:13:10,565 DEBUG [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loaded 11 bean definitions from location pattern [applicationContext.xml] 2011-10-04 17:13:10,565 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Bean factory for org.springframework.context.support.ClassPathXmlApplicationContext@7b6889: org.springframework.beans.factory.support.DefaultListableBeanFactory@1c6572b: defining beans [appService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,transactionManager]; root of factory hierarchy 2011-10-04 17:13:10,612 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,612 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,643 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,644 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,724 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,725 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,726 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,726 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,727 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,735 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references 2011-10-04 17:13:10,735 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,736 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,736 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,746 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.aop.config.internalAutoProxyCreator' to allow for resolving potential circular references 2011-10-04 17:13:10,775 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,782 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@17b0998] 2011-10-04 17:13:10,785 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@1e2befa] 2011-10-04 17:13:10,786 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c6572b: defining beans [appService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,transactionManager]; root of factory hierarchy 2011-10-04 17:13:10,786 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'appService' 2011-10-04 17:13:10,786 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'appService' 2011-10-04 17:13:10,804 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Found injected element on class [net.example.querydslsample3.service.AppService]: ResourceElement for javax.sql.DataSource net.example.querydslsample3.service.AppService.dataSource 2011-10-04 17:13:10,805 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'appService' to allow for resolving potential circular references 2011-10-04 17:13:10,808 DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] Processing injected method of bean 'appService': ResourceElement for javax.sql.DataSource net.example.querydslsample3.service.AppService.dataSource 2011-10-04 17:13:10,809 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'dataSource' 2011-10-04 17:13:10,809 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'dataSource' 2011-10-04 17:13:10,858 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'dataSource' to allow for resolving potential circular references 2011-10-04 17:13:10,890 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,890 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,892 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.transaction.config.internalTransactionAdvisor' to allow for resolving potential circular references 2011-10-04 17:13:10,917 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,917 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,921 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' to allow for resolving potential circular references 2011-10-04 17:13:10,928 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,928 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,935 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'dataSource' 2011-10-04 17:13:10,935 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'appService' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,938 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,942 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' to allow for resolving potential circular references 2011-10-04 17:13:10,947 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking afterPropertiesSet() on bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'dataSource' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'transactionManager' 2011-10-04 17:13:10,948 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'transactionManager' 2011-10-04 17:13:10,962 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean 'transactionManager' to allow for resolving potential circular references 2011-10-04 17:13:10,976 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'dataSource' 2011-10-04 17:13:10,977 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking afterPropertiesSet() on bean with name 'transactionManager' 2011-10-04 17:13:10,977 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2011-10-04 17:13:10,980 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'transactionManager' 2011-10-04 17:13:10,982 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@d6b059] 2011-10-04 17:13:10,982 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'lifecycleProcessor' 2011-10-04 17:13:10,983 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'appService' 2011-10-04 17:13:10,991 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 2011-10-04 17:13:11,339 DEBUG [com.mysema.query.sql.AbstractSQLQuery] query : select employee.id, employee.name from employee employee where employee.id = ? limit ? ### RESULT: dog 2011-10-04 17:13:11,400 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 2011-10-04 17:13:11,423 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Fetching JDBC Connection from DataSource 2011-10-04 17:13:11,432 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] Returning JDBC Connection to DataSource 2011-10-04 17:13:11,438 DEBUG [com.mysema.query.sql.AbstractSQLQuery] query : select employee.id, employee.name from employee employee where employee.id = ? limit ? Exception in thread "main" java.lang.NullPointerException at com.mysema.query.sql.AbstractSQLQuery.iterateSingle(AbstractSQLQuery.java:434) at com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:367) at com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:360) at com.mysema.query.sql.AbstractSQLQuery.uniqueResult(AbstractSQLQuery.java:576) at net.example.querydslsample3.service.AppService.runWithTemplate(AppService.java:43) at net.example.querydslsample3.App.main(App.java:19)

    Spring JIRA | 5 years ago | watanabe
    java.lang.NullPointerException
  3. 0

    NPE in AbstractSQLQuery when no connection provided

    GitHub | 5 years ago | trisberg
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.mysema.query.sql.AbstractSQLQuery.iterateSingle()
    2. Querydsl - SQL support
      AbstractSQLQuery.uniqueResult
      1. com.mysema.query.sql.AbstractSQLQuery.iterateSingle(AbstractSQLQuery.java:434)
      2. com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:367)
      3. com.mysema.query.sql.AbstractSQLQuery.iterate(AbstractSQLQuery.java:360)
      4. com.mysema.query.sql.AbstractSQLQuery.uniqueResult(AbstractSQLQuery.java:576)
      4 frames
    3. net.example.querydslsample3
      App.main
      1. net.example.querydslsample3.service.AppService.runWithTemplate(AppService.java:43)
      2. net.example.querydslsample3.App.main(App.java:19)
      2 frames