Spring boot jpa not saving
I've got the next problem, I cant figure out why I can't insert in my database. Maybe I'm missing something.
Here's the code:
Application:
@SpringBootApplication
public class GeolocalizacionApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(GeolocalizacionApplication.class, args);
}
}
Controller:
@Controller
@EnableScheduling
public class GeoController {
@Autowired
IUsigResponseService usigResponseService;
@Scheduled(cron = "0 * * ? * * ")
public void ejecutar() throws ParseException, IOException {
UsigResponse usigp = new UsigResponse();
//this is for testing
usigp.setRequest_id(4);
usigp.setResponse_id(1);
usigResponseService.save(usigp);
}
Service interface:
public interface IUsigResponseService {
public void save(UsigResponse usigResponse);
}
Service:
@Service
public class UsigResponseService implements IUsigResponseService{
@Autowired
private UsigResponseService repository2;
public void save(UsigResponse usigResponse) {
repository2.save(usigResponse);
}
}
Bean:
@Entity
@Table(name= "usig_response", schema="cprodriguez")
public class UsigResponse{
@Id
private int response_id;
private int request_id;
private String altura;
private String cod_calle;
private String cod_calle_cruce;
private int srid;
private String x;
private String y;
private String direccion;
private String nombre_calle;
private String nombre_calle_cruce;
private String nombre_localidad;
private String nombre_partido;
private String tipo;
private String cod_partido;
//getters and setters
}
The only message that I get is:
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2018-12-28 15:47:22.441 INFO 9020 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-12-28 15:47:22.927 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:23.161 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:23.958 INFO 9020 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-12-28 15:47:25.240 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:25.366 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:26.073 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@27c6e487: startup date [Fri Dec 28 15:47:18 ART 2018]; root of context hierarchy
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 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)
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.355 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.582 INFO 9020 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-12-28 15:47:26.593 INFO 9020 --- [ main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2018-12-28 15:47:26.684 INFO 9020 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-12-28 15:47:26.700 INFO 9020 --- [ main] c.F.Geo.GeolocalizacionApplication : Started GeolocalizacionApplication in 8.602 seconds (JVM running for 9.382)
2018-12-28 15:48:00.038 ERROR 9020 --- [pool-1-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
java.lang.StackOverflowError: null
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
And it keeps running. I also hace another service call from my controller(I delete it for this example) and I did it work(inserting in a table).
RESOLVED!:
I had some circular reference in my service call UsigResponseService. An Autowired variable UsigResponseService.
@Autowired
private UsigResponseService repository2;
The solution is using the repository that whas created for it, correct way;
@Autowired
private UsigResponseRepository repository2;
Didn't see it.
Thanks.
java spring-boot jpa spring-data-jpa spring-data
|
show 1 more comment
I've got the next problem, I cant figure out why I can't insert in my database. Maybe I'm missing something.
Here's the code:
Application:
@SpringBootApplication
public class GeolocalizacionApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(GeolocalizacionApplication.class, args);
}
}
Controller:
@Controller
@EnableScheduling
public class GeoController {
@Autowired
IUsigResponseService usigResponseService;
@Scheduled(cron = "0 * * ? * * ")
public void ejecutar() throws ParseException, IOException {
UsigResponse usigp = new UsigResponse();
//this is for testing
usigp.setRequest_id(4);
usigp.setResponse_id(1);
usigResponseService.save(usigp);
}
Service interface:
public interface IUsigResponseService {
public void save(UsigResponse usigResponse);
}
Service:
@Service
public class UsigResponseService implements IUsigResponseService{
@Autowired
private UsigResponseService repository2;
public void save(UsigResponse usigResponse) {
repository2.save(usigResponse);
}
}
Bean:
@Entity
@Table(name= "usig_response", schema="cprodriguez")
public class UsigResponse{
@Id
private int response_id;
private int request_id;
private String altura;
private String cod_calle;
private String cod_calle_cruce;
private int srid;
private String x;
private String y;
private String direccion;
private String nombre_calle;
private String nombre_calle_cruce;
private String nombre_localidad;
private String nombre_partido;
private String tipo;
private String cod_partido;
//getters and setters
}
The only message that I get is:
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2018-12-28 15:47:22.441 INFO 9020 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-12-28 15:47:22.927 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:23.161 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:23.958 INFO 9020 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-12-28 15:47:25.240 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:25.366 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:26.073 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@27c6e487: startup date [Fri Dec 28 15:47:18 ART 2018]; root of context hierarchy
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 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)
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.355 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.582 INFO 9020 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-12-28 15:47:26.593 INFO 9020 --- [ main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2018-12-28 15:47:26.684 INFO 9020 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-12-28 15:47:26.700 INFO 9020 --- [ main] c.F.Geo.GeolocalizacionApplication : Started GeolocalizacionApplication in 8.602 seconds (JVM running for 9.382)
2018-12-28 15:48:00.038 ERROR 9020 --- [pool-1-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
java.lang.StackOverflowError: null
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
And it keeps running. I also hace another service call from my controller(I delete it for this example) and I did it work(inserting in a table).
RESOLVED!:
I had some circular reference in my service call UsigResponseService. An Autowired variable UsigResponseService.
@Autowired
private UsigResponseService repository2;
The solution is using the repository that whas created for it, correct way;
@Autowired
private UsigResponseRepository repository2;
Didn't see it.
Thanks.
java spring-boot jpa spring-data-jpa spring-data
That's not a stack trace. That's 3 line sf a stack trace. The error type, and message are missing (i.e. the very first line of the stack trace), as well as the remaining (containing the cause of the exception). Post the complete stack trace.
– JB Nizet
Dec 28 '18 at 17:53
Maybe i've forgot to say that it's "something like" a stack trace cause it shows me, in a way, that something is wrong. It keeps running and throwing the same message, that's why I only put 3 lines.
– Carolina Ponce
Dec 28 '18 at 18:33
Again, post one of the complete stack traces. Not just 3 lines.
– JB Nizet
Dec 28 '18 at 18:34
The specific error (SQLException,NullPointerException, etc.) is really necessary to help resolve this issue. It is likely at the top of the stack trace, just before theat com.Geo.service.... There may be a column in the db that cannot be null, or a unique value you are having conflicts with, but without the specific error it is impossible to say.
– Wrokar
Dec 28 '18 at 18:37
1
The stack trace shows what the problem is. You're injecting UsigResponseService inside UsigResponseService, and calling the its save() method from its save() method. So save() calls save(), which calls save(), which calls save(), etc. You probably want to inject a repository into your service. Not the service itself.
– JB Nizet
Dec 28 '18 at 19:31
|
show 1 more comment
I've got the next problem, I cant figure out why I can't insert in my database. Maybe I'm missing something.
Here's the code:
Application:
@SpringBootApplication
public class GeolocalizacionApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(GeolocalizacionApplication.class, args);
}
}
Controller:
@Controller
@EnableScheduling
public class GeoController {
@Autowired
IUsigResponseService usigResponseService;
@Scheduled(cron = "0 * * ? * * ")
public void ejecutar() throws ParseException, IOException {
UsigResponse usigp = new UsigResponse();
//this is for testing
usigp.setRequest_id(4);
usigp.setResponse_id(1);
usigResponseService.save(usigp);
}
Service interface:
public interface IUsigResponseService {
public void save(UsigResponse usigResponse);
}
Service:
@Service
public class UsigResponseService implements IUsigResponseService{
@Autowired
private UsigResponseService repository2;
public void save(UsigResponse usigResponse) {
repository2.save(usigResponse);
}
}
Bean:
@Entity
@Table(name= "usig_response", schema="cprodriguez")
public class UsigResponse{
@Id
private int response_id;
private int request_id;
private String altura;
private String cod_calle;
private String cod_calle_cruce;
private int srid;
private String x;
private String y;
private String direccion;
private String nombre_calle;
private String nombre_calle_cruce;
private String nombre_localidad;
private String nombre_partido;
private String tipo;
private String cod_partido;
//getters and setters
}
The only message that I get is:
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2018-12-28 15:47:22.441 INFO 9020 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-12-28 15:47:22.927 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:23.161 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:23.958 INFO 9020 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-12-28 15:47:25.240 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:25.366 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:26.073 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@27c6e487: startup date [Fri Dec 28 15:47:18 ART 2018]; root of context hierarchy
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 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)
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.355 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.582 INFO 9020 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-12-28 15:47:26.593 INFO 9020 --- [ main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2018-12-28 15:47:26.684 INFO 9020 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-12-28 15:47:26.700 INFO 9020 --- [ main] c.F.Geo.GeolocalizacionApplication : Started GeolocalizacionApplication in 8.602 seconds (JVM running for 9.382)
2018-12-28 15:48:00.038 ERROR 9020 --- [pool-1-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
java.lang.StackOverflowError: null
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
And it keeps running. I also hace another service call from my controller(I delete it for this example) and I did it work(inserting in a table).
RESOLVED!:
I had some circular reference in my service call UsigResponseService. An Autowired variable UsigResponseService.
@Autowired
private UsigResponseService repository2;
The solution is using the repository that whas created for it, correct way;
@Autowired
private UsigResponseRepository repository2;
Didn't see it.
Thanks.
java spring-boot jpa spring-data-jpa spring-data
I've got the next problem, I cant figure out why I can't insert in my database. Maybe I'm missing something.
Here's the code:
Application:
@SpringBootApplication
public class GeolocalizacionApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(GeolocalizacionApplication.class, args);
}
}
Controller:
@Controller
@EnableScheduling
public class GeoController {
@Autowired
IUsigResponseService usigResponseService;
@Scheduled(cron = "0 * * ? * * ")
public void ejecutar() throws ParseException, IOException {
UsigResponse usigp = new UsigResponse();
//this is for testing
usigp.setRequest_id(4);
usigp.setResponse_id(1);
usigResponseService.save(usigp);
}
Service interface:
public interface IUsigResponseService {
public void save(UsigResponse usigResponse);
}
Service:
@Service
public class UsigResponseService implements IUsigResponseService{
@Autowired
private UsigResponseService repository2;
public void save(UsigResponse usigResponse) {
repository2.save(usigResponse);
}
}
Bean:
@Entity
@Table(name= "usig_response", schema="cprodriguez")
public class UsigResponse{
@Id
private int response_id;
private int request_id;
private String altura;
private String cod_calle;
private String cod_calle_cruce;
private int srid;
private String x;
private String y;
private String direccion;
private String nombre_calle;
private String nombre_calle_cruce;
private String nombre_localidad;
private String nombre_partido;
private String tipo;
private String cod_partido;
//getters and setters
}
The only message that I get is:
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-12-28 15:47:22.412 INFO 9020 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2018-12-28 15:47:22.441 INFO 9020 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-12-28 15:47:22.927 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:23.161 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:23.958 INFO 9020 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-12-28 15:47:25.240 INFO 9020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.TeradataDialect
2018-12-28 15:47:25.366 INFO 9020 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-12-28 15:47:26.073 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@27c6e487: startup date [Fri Dec 28 15:47:18 ART 2018]; root of context hierarchy
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 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)
2018-12-28 15:47:26.260 INFO 9020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.308 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.355 INFO 9020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-28 15:47:26.582 INFO 9020 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-12-28 15:47:26.593 INFO 9020 --- [ main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2018-12-28 15:47:26.684 INFO 9020 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-12-28 15:47:26.700 INFO 9020 --- [ main] c.F.Geo.GeolocalizacionApplication : Started GeolocalizacionApplication in 8.602 seconds (JVM running for 9.382)
2018-12-28 15:48:00.038 ERROR 9020 --- [pool-1-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
java.lang.StackOverflowError: null
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
at com.Geo.service.UsigResponseService.save(UsigResponseService.java:25) ~[classes/:na]
And it keeps running. I also hace another service call from my controller(I delete it for this example) and I did it work(inserting in a table).
RESOLVED!:
I had some circular reference in my service call UsigResponseService. An Autowired variable UsigResponseService.
@Autowired
private UsigResponseService repository2;
The solution is using the repository that whas created for it, correct way;
@Autowired
private UsigResponseRepository repository2;
Didn't see it.
Thanks.
java spring-boot jpa spring-data-jpa spring-data
java spring-boot jpa spring-data-jpa spring-data
edited Dec 28 '18 at 19:02
Carolina Ponce
asked Dec 28 '18 at 17:49
Carolina PonceCarolina Ponce
12
12
That's not a stack trace. That's 3 line sf a stack trace. The error type, and message are missing (i.e. the very first line of the stack trace), as well as the remaining (containing the cause of the exception). Post the complete stack trace.
– JB Nizet
Dec 28 '18 at 17:53
Maybe i've forgot to say that it's "something like" a stack trace cause it shows me, in a way, that something is wrong. It keeps running and throwing the same message, that's why I only put 3 lines.
– Carolina Ponce
Dec 28 '18 at 18:33
Again, post one of the complete stack traces. Not just 3 lines.
– JB Nizet
Dec 28 '18 at 18:34
The specific error (SQLException,NullPointerException, etc.) is really necessary to help resolve this issue. It is likely at the top of the stack trace, just before theat com.Geo.service.... There may be a column in the db that cannot be null, or a unique value you are having conflicts with, but without the specific error it is impossible to say.
– Wrokar
Dec 28 '18 at 18:37
1
The stack trace shows what the problem is. You're injecting UsigResponseService inside UsigResponseService, and calling the its save() method from its save() method. So save() calls save(), which calls save(), which calls save(), etc. You probably want to inject a repository into your service. Not the service itself.
– JB Nizet
Dec 28 '18 at 19:31
|
show 1 more comment
That's not a stack trace. That's 3 line sf a stack trace. The error type, and message are missing (i.e. the very first line of the stack trace), as well as the remaining (containing the cause of the exception). Post the complete stack trace.
– JB Nizet
Dec 28 '18 at 17:53
Maybe i've forgot to say that it's "something like" a stack trace cause it shows me, in a way, that something is wrong. It keeps running and throwing the same message, that's why I only put 3 lines.
– Carolina Ponce
Dec 28 '18 at 18:33
Again, post one of the complete stack traces. Not just 3 lines.
– JB Nizet
Dec 28 '18 at 18:34
The specific error (SQLException,NullPointerException, etc.) is really necessary to help resolve this issue. It is likely at the top of the stack trace, just before theat com.Geo.service.... There may be a column in the db that cannot be null, or a unique value you are having conflicts with, but without the specific error it is impossible to say.
– Wrokar
Dec 28 '18 at 18:37
1
The stack trace shows what the problem is. You're injecting UsigResponseService inside UsigResponseService, and calling the its save() method from its save() method. So save() calls save(), which calls save(), which calls save(), etc. You probably want to inject a repository into your service. Not the service itself.
– JB Nizet
Dec 28 '18 at 19:31
That's not a stack trace. That's 3 line sf a stack trace. The error type, and message are missing (i.e. the very first line of the stack trace), as well as the remaining (containing the cause of the exception). Post the complete stack trace.
– JB Nizet
Dec 28 '18 at 17:53
That's not a stack trace. That's 3 line sf a stack trace. The error type, and message are missing (i.e. the very first line of the stack trace), as well as the remaining (containing the cause of the exception). Post the complete stack trace.
– JB Nizet
Dec 28 '18 at 17:53
Maybe i've forgot to say that it's "something like" a stack trace cause it shows me, in a way, that something is wrong. It keeps running and throwing the same message, that's why I only put 3 lines.
– Carolina Ponce
Dec 28 '18 at 18:33
Maybe i've forgot to say that it's "something like" a stack trace cause it shows me, in a way, that something is wrong. It keeps running and throwing the same message, that's why I only put 3 lines.
– Carolina Ponce
Dec 28 '18 at 18:33
Again, post one of the complete stack traces. Not just 3 lines.
– JB Nizet
Dec 28 '18 at 18:34
Again, post one of the complete stack traces. Not just 3 lines.
– JB Nizet
Dec 28 '18 at 18:34
The specific error (
SQLException, NullPointerException, etc.) is really necessary to help resolve this issue. It is likely at the top of the stack trace, just before the at com.Geo.service.... There may be a column in the db that cannot be null, or a unique value you are having conflicts with, but without the specific error it is impossible to say.– Wrokar
Dec 28 '18 at 18:37
The specific error (
SQLException, NullPointerException, etc.) is really necessary to help resolve this issue. It is likely at the top of the stack trace, just before the at com.Geo.service.... There may be a column in the db that cannot be null, or a unique value you are having conflicts with, but without the specific error it is impossible to say.– Wrokar
Dec 28 '18 at 18:37
1
1
The stack trace shows what the problem is. You're injecting UsigResponseService inside UsigResponseService, and calling the its save() method from its save() method. So save() calls save(), which calls save(), which calls save(), etc. You probably want to inject a repository into your service. Not the service itself.
– JB Nizet
Dec 28 '18 at 19:31
The stack trace shows what the problem is. You're injecting UsigResponseService inside UsigResponseService, and calling the its save() method from its save() method. So save() calls save(), which calls save(), which calls save(), etc. You probably want to inject a repository into your service. Not the service itself.
– JB Nizet
Dec 28 '18 at 19:31
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53962405%2fspring-boot-jpa-not-saving%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53962405%2fspring-boot-jpa-not-saving%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
That's not a stack trace. That's 3 line sf a stack trace. The error type, and message are missing (i.e. the very first line of the stack trace), as well as the remaining (containing the cause of the exception). Post the complete stack trace.
– JB Nizet
Dec 28 '18 at 17:53
Maybe i've forgot to say that it's "something like" a stack trace cause it shows me, in a way, that something is wrong. It keeps running and throwing the same message, that's why I only put 3 lines.
– Carolina Ponce
Dec 28 '18 at 18:33
Again, post one of the complete stack traces. Not just 3 lines.
– JB Nizet
Dec 28 '18 at 18:34
The specific error (
SQLException,NullPointerException, etc.) is really necessary to help resolve this issue. It is likely at the top of the stack trace, just before theat com.Geo.service.... There may be a column in the db that cannot be null, or a unique value you are having conflicts with, but without the specific error it is impossible to say.– Wrokar
Dec 28 '18 at 18:37
1
The stack trace shows what the problem is. You're injecting UsigResponseService inside UsigResponseService, and calling the its save() method from its save() method. So save() calls save(), which calls save(), which calls save(), etc. You probably want to inject a repository into your service. Not the service itself.
– JB Nizet
Dec 28 '18 at 19:31