无法击中休息服务与春天启动

问题描述:

我已经配置RESTful Web服务,并与春启动的帮助托管运行。但我无法实现该服务。并获得响应状态:-1 - 请求失败(已取消或超时)无法击中休息服务与春天启动

日志: -

⁃ 2017-10-08 18:33:33.149 INFO 6806 --- [   main] com.mypleaks.PleaksRSApp     : Starting PleaksRSApp on 3inmderaj1.local with PID 6806 (/Users/deraj/home/code/leaks-rs/mypleaks-rs/myPleaks-RS/target/classes started by deraj in /Users/deraj/home/code/leaks-rs/mypleaks-rs/myPleaks-RS) 
⁃ 2017-10-08 18:33:33.155 INFO 6806 --- [   main] com.mypleaks.PleaksRSApp     : No active profile set, falling back to default profiles: default 
⁃ 2017-10-08 18:33:33.202 INFO 6806 --- [   main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]311bf055: startup date [Sun Oct 08 18:33:33 IST 2017]; root of context hierarchy 
⁃ 2017-10-08 18:33:33.998 INFO 6806 --- [   main] o.s.b.f.s.DefaultListableBeanFactory  : Overriding bean definition for bean 'requestContextFilter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.class]] with [Root bean: class [org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]] 
⁃ 2017-10-08 18:33:34.276 INFO 6806 --- [   main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 
⁃ 2017-10-08 18:33:34.372 INFO 6806 --- [   main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$af71e9e1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
⁃ 2017-10-08 18:33:34.745 INFO 6806 --- [   main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 
⁃ 2017-10-08 18:33:34.756 INFO 6806 --- [   main] o.apache.catalina.core.StandardService : Starting service Tomcat 
⁃ 2017-10-08 18:33:34.756 INFO 6806 --- [   main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6 

资源: - enter image description here

请求: - enter image description here

响应: - enter image description here

看来你正在使用的注解从javax.包,而不是春天的。

试试在类级别和@RequestMapping的方法利用水平@RestController(所有其他注释应该是从春天包也):

@RestController 
@RequestMapping(path = "/place") 
public class PlaceResource{ 


    @RequestMapping(method = RequestMethod.GET, path="/countries") 
    public Response getCountries(..){..} 
} 
+0

是的,我正在使用javax。 ,并且早些时候它像10天前一样工作当我测试这个代码时,它突然停止了。我必须使用javax。只有,不能切换到Spring注释。 –

对不起你们,它是可怕的,从我身边的错误。我在我的应用程序中使用了下面的代码。

public class NotificationEngine implements InitializingBean { 

@Override 
public void afterPropertiesSet() throws Exception {"Here I was running some stupid endless process, Due to which the tomcat was not getting up completely and because of that Iwas getting this issue."}}