dimanche 8 mars 2015

Debugging does not step into function Spring REST Service @Controller with curl

I've a Spring Version: 3.6.3.RELEASE Project with a REST Service and I want to debug the @RequestMapping @Controller class by initiating a request throug curl. Ive set debugging Breakepoints in the function of the @RequestMapping


and Ive started the project in debug mode .... and everything is starting up fine .....



. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.1.RELEASE)

2015-03-08 11:38:00.288 INFO 4252 --- [ main] com.pekam.Application : Starting Application on KABUL with PID 4252 (C:\Users\pk\Documents\workspace-sts-3.6.3.RELEASE\MyRestDataRepository\target\classes started by pk)
2015-03-08 11:38:00.333 INFO 4252 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6b6776cb: startup date [Sun Mar 08 11:38:00 CET 2015]; root of context hierarchy
2015-03-08 11:38:00.682 INFO 4252 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'org.springframework.boot.autoconfigure.AutoConfigurationPackages': replacing [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2015-03-08 11:38:01.140 INFO 4252 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$3fc9350d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-03-08 11:38:01.162 INFO 4252 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-03-08 11:38:01.172 INFO 4252 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-03-08 11:38:01.179 INFO 4252 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-03-08 11:38:01.380 INFO 4252 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080
2015-03-08 11:38:01.523 INFO 4252 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2015-03-08 11:38:01.523 INFO 4252 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.52
2015-03-08 11:38:01.640 INFO 4252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2015-03-08 11:38:01.640 INFO 4252 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1310 ms
2015-03-08 11:38:02.103 INFO 4252 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2015-03-08 11:38:02.105 INFO 4252 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2015-03-08 11:38:02.353 INFO 4252 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: org.h2.Driver
2015-03-08 11:38:02.353 INFO 4252 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
2015-03-08 11:38:02.353 INFO 4252 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: com.mysql.jdbc.Driver
2015-03-08 11:38:02.493 INFO 4252 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2015-03-08 11:38:02.514 INFO 4252 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2015-03-08 11:38:02.590 INFO 4252 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.1.Final}
2015-03-08 11:38:02.592 INFO 4252 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2015-03-08 11:38:02.594 INFO 4252 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2015-03-08 11:38:02.795 INFO 4252 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
2015-03-08 11:38:03.064 INFO 4252 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2015-03-08 11:38:03.181 INFO 4252 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2015-03-08 11:38:03.510 INFO 4252 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2015-03-08 11:38:03.510 INFO 4252 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2015-03-08 11:38:03.516 INFO 4252 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2015-03-08 11:38:03.533 INFO 4252 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: test.tblgps
2015-03-08 11:38:03.533 INFO 4252 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [date, descr, provider, lon, id, deviceid, userid, lat]
2015-03-08 11:38:03.533 INFO 4252 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: []
2015-03-08 11:38:03.533 INFO 4252 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [primary]
2015-03-08 11:38:03.534 INFO 4252 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000232: Schema update complete
2015-03-08 11:38:03.941 INFO 4252 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-03-08 11:38:04.064 INFO 4252 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/TblGps/List/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<com.pekam.TblGps> com.pekam.TblGpsController.findAll()
2015-03-08 11:38:04.064 INFO 4252 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/TblGps/get],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.pekam.TblGps com.pekam.TblGpsController.findById(long)
2015-03-08 11:38:04.064 INFO 4252 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/TblGps/update3/],methods=[POST],params=[],headers=[],consumes=[*/*],produces=[application/json || */*],custom=[]}" onto public com.pekam.TblGps com.pekam.TblGpsController.post1(com.pekam.TblGps)
2015-03-08 11:38:04.064 INFO 4252 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/TblGps/update],methods=[POST],params=[],headers=[],consumes=[*/*],produces=[*/*],custom=[]}" onto public com.pekam.TblGps com.pekam.TblGpsController.post(com.pekam.TblGps)
2015-03-08 11:38:04.065 INFO 4252 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/*],methods=[GET || POST || DELETE || PUT || HEAD],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.pekam.TblGpsController.allFallback()
2015-03-08 11:38:04.065 INFO 4252 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/TblGps/update2/],methods=[POST],params=[],headers=[],consumes=[*/*],produces=[*/*],custom=[]}" onto public java.lang.String com.pekam.TblGpsController.post2(java.lang.String)
2015-03-08 11:38:04.093 INFO 4252 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-03-08 11:38:04.094 INFO 4252 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-03-08 11:38:04.161 INFO 4252 --- [ main] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in restResponseEntityExceptionHandler
2015-03-08 11:38:04.345 INFO 4252 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2015-03-08 11:38:04.378 INFO 4252 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2015-03-08 11:38:04.380 INFO 4252 --- [ main] com.pekam.Application : Started Application in 4.383 seconds (JVM running for 4.904)


but when i execute the Request with curl the debuger does not step into the function.



C:\Users\pk>curl -H "Content-Type:application/json" -d {"date":1425811355985,"de
scr":null,"deviceID":"1","provider":"fused","id":0,"lat":4.0,"userid":1,"lon":4.
0} http://ift.tt/1wgMaMS


The curl output is: just nothing


It seems linke the debugger is not properly attached to the process but when i change my curl request to bad mapping entry STS is showing me the errors on the console debugging windows.


any Ideas appreciated !!


code



@Controller
public class TblGpsController {

private static final Logger logger = LoggerFactory.getLogger(TblGpsController.class);

@RequestMapping(value = "*", method = { RequestMethod.GET, RequestMethod.POST ,RequestMethod.DELETE,RequestMethod.PUT,RequestMethod.HEAD })
@ResponseBody
public String allFallback() {
return "Fallback for All Requests";
}

@RequestMapping(value="/TblGps/update", method=RequestMethod.POST,consumes = MediaType.ALL_VALUE,produces= MediaType.ALL_VALUE)
@ResponseBody public TblGps post(@RequestParam("object") TblGps gps){

return Application.DataRepository.save(gps);
}

Aucun commentaire:

Enregistrer un commentaire