jueves, 30 de marzo de 2017
Spring Boot Camel Case (CamelCase) to Snake Case (snake_case)
spring:
...
jpa:
...
properties:
hibernate.physical_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
martes, 14 de febrero de 2017
NullPointerException in org.springframework.batch.item.database.JdbcBatchItemWriter
Spring Boot:v1.5.1.RELEASE
Exception:
java.lang.NullPointerException: null
at org.springframework.batch.item.database.JdbcBatchItemWriter$1.doInPreparedStatement(JdbcBatchItemWriter.java:189) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.item.database.JdbcBatchItemWriter$1.doInPreparedStatement(JdbcBatchItemWriter.java:185) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633) ~[spring-jdbc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662) ~[spring-jdbc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.item.database.JdbcBatchItemWriter.write(JdbcBatchItemWriter.java:185) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:392) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:135) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:306) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) [spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at com.sun.proxy.$Proxy54.run(Unknown Source) [na:na]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.execute(JobLauncherCommandLineRunner.java:214) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.executeLocalJobs(JobLauncherCommandLineRunner.java:231) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.launchJobFromProperties(JobLauncherCommandLineRunner.java:123) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.run(JobLauncherCommandLineRunner.java:117) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at batchtests.SpringBatchTestApplication.main(SpringBatchTestApplication.java:11) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
Sample code:
public ItemWriter<XxxDTO> xxxDTOItemWriter(DataSource dataSource, NamedParameterJdbcTemplate jdbcTemplate) {
JdbcBatchItemWriter<xxxDTO> writer = new JdbcBatchItemWriter<>();
String sql = "INSERT INTO xxx (x1, x2,...) VALUES (:x1, :x2,...)";
writer.setDataSource(dataSource);
writer.setJdbcTemplate(jdbcTemplate);
writer.setSql(sql);
ItemSqlParameterSourceProvider<xxxDTO> paramProvider = new BeanPropertyItemSqlParameterSourceProvider<>();
writer.setItemSqlParameterSourceProvider(paramProvider);
return writer;
}
Fix: call writer.afterPropertiesSet()
Example:
public ItemWriter<XxxDTO> xxxDTOItemWriter(DataSource dataSource, NamedParameterJdbcTemplate jdbcTemplate) {
JdbcBatchItemWriter<xxxDTO> writer = new JdbcBatchItemWriter<>();
String sql = "INSERT INTO xxx (x1, x2,...) VALUES (:x1, :x2,...)";
writer.setDataSource(dataSource);
writer.setJdbcTemplate(jdbcTemplate);
writer.setSql(sql);
ItemSqlParameterSourceProvider<xxxDTO> paramProvider = new BeanPropertyItemSqlParameterSourceProvider<>();
writer.setItemSqlParameterSourceProvider(paramProvider);
writer.afterPropertiesSet();
return writer;
}
Exception:
java.lang.NullPointerException: null
at org.springframework.batch.item.database.JdbcBatchItemWriter$1.doInPreparedStatement(JdbcBatchItemWriter.java:189) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.item.database.JdbcBatchItemWriter$1.doInPreparedStatement(JdbcBatchItemWriter.java:185) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633) ~[spring-jdbc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662) ~[spring-jdbc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.item.database.JdbcBatchItemWriter.write(JdbcBatchItemWriter.java:185) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) ~[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200) ~[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:392) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:135) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:306) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) [spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127) [spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) [spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at com.sun.proxy.$Proxy54.run(Unknown Source) [na:na]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.execute(JobLauncherCommandLineRunner.java:214) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.executeLocalJobs(JobLauncherCommandLineRunner.java:231) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.launchJobFromProperties(JobLauncherCommandLineRunner.java:123) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.run(JobLauncherCommandLineRunner.java:117) [spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at batchtests.SpringBatchTestApplication.main(SpringBatchTestApplication.java:11) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
Sample code:
public ItemWriter<XxxDTO> xxxDTOItemWriter(DataSource dataSource, NamedParameterJdbcTemplate jdbcTemplate) {
JdbcBatchItemWriter<xxxDTO> writer = new JdbcBatchItemWriter<>();
String sql = "INSERT INTO xxx (x1, x2,...) VALUES (:x1, :x2,...)";
writer.setDataSource(dataSource);
writer.setJdbcTemplate(jdbcTemplate);
writer.setSql(sql);
ItemSqlParameterSourceProvider<xxxDTO> paramProvider = new BeanPropertyItemSqlParameterSourceProvider<>();
writer.setItemSqlParameterSourceProvider(paramProvider);
return writer;
}
Fix: call writer.afterPropertiesSet()
Example:
public ItemWriter<XxxDTO> xxxDTOItemWriter(DataSource dataSource, NamedParameterJdbcTemplate jdbcTemplate) {
JdbcBatchItemWriter<xxxDTO> writer = new JdbcBatchItemWriter<>();
String sql = "INSERT INTO xxx (x1, x2,...) VALUES (:x1, :x2,...)";
writer.setDataSource(dataSource);
writer.setJdbcTemplate(jdbcTemplate);
writer.setSql(sql);
ItemSqlParameterSourceProvider<xxxDTO> paramProvider = new BeanPropertyItemSqlParameterSourceProvider<>();
writer.setItemSqlParameterSourceProvider(paramProvider);
writer.afterPropertiesSet();
return writer;
}
jueves, 9 de febrero de 2017
Unknown Microsoft SQL Server major version [12] using SQL Server 2000 dialect
Spring Boot version: 1.5.1.RELEASE (Hibernate 5.0.11.Final)
Dependencies:
This is the bug fix for the automatic dialect selection for SQL Server 2014: https://github.com/hibernate/hibernate-orm/pull/1353 (for Hibernate 5.1)
Dependencies:
- compile("org.springframework.boot:spring-boot-starter-batch")
- compile('org.springframework.boot:spring-boot-starter-data-jpa')
Fix:
The following property fixed the warning: spring.jpa.properties.hibernate.dialect (spring.jpa.databasePlatform didn't seem to have any effect)
spring:
datasource:
url: jdbc:sqlserver://localhost:1433;databaseName=xxx
username: yyy
password: zzz
test-on-borrow: true
validation-query: "select 1"
jpa:
generate-ddl: false
database: sqlserver
#databasePlatform: org.hibernate.dialect.SQLServer2012Dialect
properties:
delimited-identifiers: true
hibernate:
dialect: org.hibernate.dialect.SQLServer2012Dialect
hibernate:
ddl-auto: none
naming:
implicit-strategy: ...
physical-strategy: ...
This also fixed the following error due to the dialect selection: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '@P0'.
...
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
This is the bug fix for the automatic dialect selection for SQL Server 2014: https://github.com/hibernate/hibernate-orm/pull/1353 (for Hibernate 5.1)
martes, 10 de mayo de 2016
Visual Studio Code toggle line comment in non-english keyboard
The defaulr Ctrl+/ key binding for Toggle Line Comment doesn't work in my machine (spanish keyboard). To get the real key binding mapping in a specific environment, just
F1 → Open Keyboard Shortcuts
and look for the specific shortcut. In my case, "editor.action.commentLine"
there I can see the real binding in miy machine is Ctrl+}
F1 → Open Keyboard Shortcuts
and look for the specific shortcut. In my case, "editor.action.commentLine"
there I can see the real binding in miy machine is Ctrl+}
miércoles, 4 de mayo de 2016
Create a clean and complete EAR project with Maven (ear, war, ejb modules)
These orders are taken from the ones Netbeans uses when you create a New → Maven → Enterprise Application. It uses some nice archetypes from org.codehaus.mojo.archetypes:
cd C:\apps
mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=pom-root -DarchetypeVersion=1.1 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=co.com.acme -DartifactId=myApp -Dversion=1.0-SNAPSHOT -Dpackage=co.com.acme.app -Dbasedir=C:\apps -Darchetype.interactive=false --batch-mode archetype:generate
cd C:\apps\myApp
Then you can do a C:\apps\myApp>mvn install obtaining the following EAR:
cd C:\apps
mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=pom-root -DarchetypeVersion=1.1 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=co.com.acme -DartifactId=myApp -Dversion=1.0-SNAPSHOT -Dpackage=co.com.acme.app -Dbasedir=C:\apps -Darchetype.interactive=false --batch-mode archetype:generate
cd C:\apps\myApp
mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=ear-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=co.com.acme -DartifactId=myApp-ear -Dversion=1.0-SNAPSHOT -Dbasedir=C:\apps\myApp -Darchetype.interactive=false --batch-mode archetype:generate
mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=co.com.acme -DartifactId=myApp-web -Dversion=1.0-SNAPSHOT -Dbasedir=C:\apps\myApp -Darchetype.interactive=false --batch-mode archetype:generate
mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=ejb-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=co.com.acme -DartifactId=myApp-ejb -Dversion=1.0-SNAPSHOT -Dbasedir=C:\apps\myApp -Darchetype.interactive=false --batch-mode archetype:generate
Resulting structure:
It is needed however to include some dependencies between the projects:
Edit C:\apps\myApp\myApp-ear\pom.xml and include:
<dependencies>
<dependency>
<groupId>co.com.acme</groupId>
<artifactId>myApp-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>co.com.acme</groupId>
<artifactId>myApp-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
Example:
Then you can do a C:\apps\myApp>mvn install obtaining the following EAR:
martes, 26 de abril de 2016
Docker (docker-machine) build and disk space notes (Windows)
Docker Toolbox version: 1.10.3
Docker info server version: 1.10.3
Operating System: Boot2Docker 1.10.3
Windows: 7
Working with somewhat big images, I started receiving disk space errors when running docker build ("no space left on device" when executing ADD, etc.). Although my images are big, I knew they're not that big to fill the default 20GB Docker Machine Virtual Box VM disk (located in C:\Users\[User]\.docker\machine\machines\default), so before resizing its VirtualBox vmdk file, I started looking around.
I ssh'ed to the docker-machine host:
docker-machine.exe ssh
Tracing the wasted disk space (df -k, du -sh *,...) I ended up in the /mnt/sda1/var/lib/docker/tmp directory.
(note: the screenshots doesn't reflect the actual disk space in the problem's instant).
The docker user doesn't have permissions to see that directory, so you need to sudo sh.
I noticed several large docker-builder* directories storing the context for building some of my images (the Dockerfile and installers and assets needed by the build, etc....). After doing some tests building images, I noticed this directory is really a temporary directory (duh) and should not contain those docker-builder* folders if you are not actually building images (as I was not at the moment).
I deleted the folders, re ran the builds and they finished without space problems.
What caused docker not removing those temporary directories automatically? Maybe some Ctrl-C's I did when just "Sending build context to Docker daemon..." or interrupted builds?
Docker info server version: 1.10.3
Operating System: Boot2Docker 1.10.3
Windows: 7
Working with somewhat big images, I started receiving disk space errors when running docker build ("no space left on device" when executing ADD, etc.). Although my images are big, I knew they're not that big to fill the default 20GB Docker Machine Virtual Box VM disk (located in C:\Users\[User]\.docker\machine\machines\default), so before resizing its VirtualBox vmdk file, I started looking around.
I ssh'ed to the docker-machine host:
docker-machine.exe ssh
Tracing the wasted disk space (df -k, du -sh *,...) I ended up in the /mnt/sda1/var/lib/docker/tmp directory.
(note: the screenshots doesn't reflect the actual disk space in the problem's instant).
I deleted the folders, re ran the builds and they finished without space problems.
What caused docker not removing those temporary directories automatically? Maybe some Ctrl-C's I did when just "Sending build context to Docker daemon..." or interrupted builds?
martes, 16 de febrero de 2016
OSB 12c: "No acceptable representation for response..." invoking REST service
Error: No acceptable representation for response with "application/xml; charset=iso-8859-1" media type was found
service> AbstractResponseMessage. getPart, com.bea.alsb.ws.codec.
This error can be caused by a mismatch between the type of response you specified in the adapter and the real response the REST service is returning.
For example, if you specified that the service returns HTTP 200 OK with a JSON body, but the service returns just HTTP 200K withouth payload (body).
OSB: 12.1.3
CodecException: No acceptable representation for response with "application/xml; charset=iso-8859-1" media type was found
com.bea.alsb.ws.codec. CodecException: No acceptable representation for response with "application/xml; charset=iso-8859-1" media type was found
at com.bea.wli.sb.service. handlerchain.handlers. OutboundRestHandler$ AbstractResponseMessage. getPart(OutboundRestHandler. java:373)
at com.bea.wli.sb.service. handlerchain.handlers. OutboundRestHandler$ AbstractResponseMessage. getPart(OutboundRestHandler. java:316)
at com.bea.alsb.ws.codec. internal.runtime.soap. SoapDocCodec.marshallBody( SoapDocCodec.java:67)
at com.bea.alsb.ws.codec. internal.runtime.soap. SoapCodec.marshall(SoapCodec. java:147)
at com.bea.alsb.ws.codec. internal.runtime.soap. SoapDocClientCodec.marshall( SoapDocClientCodec.java:58)
at com.bea.wli.sb.service. handlerchain.handlers. OutboundRestHandler. handleResponse( OutboundRestHandler.java:208)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler$1. handleResponse( AbstractHandler.java:307)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler. handleResponse( AbstractHandler.java:139)
at com.bea.wli.sb.service. handlerchain.handlers. OutboundMessageContentHandler. handleResponse( OutboundMessageContentHandler. java:89)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler$1. handleResponse( AbstractHandler.java:307)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler. handleResponse( AbstractHandler.java:139)
at com.bea.wli.sb.service. handlerchain.handlers. LoadBalanceFailover$ LoadBalanceFailoverHelper. handleResponse( LoadBalanceFailover.java:475)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler. handleResponse( AbstractHandler.java:139)
at com.bea.wli.sb.service. handlerchain.handlers. UpdateOutboundStatistics. handleResponse( UpdateOutboundStatistics.java: 89)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler$1. handleResponse( AbstractHandler.java:307)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler. handleResponse( AbstractHandler.java:139)
at com.bea.wli.sb.service. handlerchain.handlers. EndpointManagementHandler. handleResponse( EndpointManagementHandler. java:122)
at com.bea.wli.sb.service. handlerchain.handlers. AbstractHandler$1. handleResponse( AbstractHandler.java:307)
at com.bea.wli.sb.service. handlerchain.handlers. TransportProviderInvoker$ ServiceTransportListener. onReceiveResponse( TransportProviderInvoker.java: 302)
at com.bea.wli.sb.transports. http.wls.rest. RestOutboundMessageContext$ Reply.run( RestOutboundMessageContext. java:467)
at weblogic.work. WorkAreaContextWrap.run( WorkAreaContextWrap.java:55)
at weblogic.work.ContextWrap.run( ContextWrap.java:40)
at com.bea.alsb.platform. weblogic. WlsWorkManagerServiceImpl$ WorkAdapter.run( WlsWorkManagerServiceImpl. java:194)
at weblogic.work. SelfTuningWorkManagerImpl$ WorkAdapterImpl.run( SelfTuningWorkManagerImpl. java:548)
at weblogic.work.ExecuteThread. execute(ExecuteThread.java: 311)
at weblogic.work.ExecuteThread. run(ExecuteThread.java:263)
>
This error can be caused by a mismatch between the type of response you specified in the adapter and the real response the REST service is returning.
For example, if you specified that the service returns HTTP 200 OK with a JSON body, but the service returns just HTTP 200K withouth payload (body).
OSB: 12.1.3
Suscribirse a:
Entradas (Atom)