Question

7
Replies
3929
Views
moryh Member since 2017 7 posts
PEGA
Posted: 2 years ago
Last activity: 2 years ago
Closed
Solved

Resource not found error with REST service

I created a REST service with service package name "TGBHRAppsWorkOnboarding", service version as "1" and URI Template as "MyRest/{id}". EndPoint URL generated for this service is "http://localhost:8080/prweb/PRRestService/TGBHRAppsWorkOnboarding/1/MyR…{id}" Screenshot of rule form has been attached.

Then on Method tab i configured Get method to call activity "MyRestActivity", which has logic to fetch the case details on the basis of id received in request. And in the response tab of GET method i used XML stream rule.

When i unit tested this rest service it worked correctly.

I also tried to access above URL directly in browser and it worked correctl

Then i created a REST Connector to access the above REST service. I specified resource url as "http://localhost:8080/prweb/PRRestService/TGBHRAppsWorkOnboarding/1/MyR…{Id}". And then click on the Test Connectivity and got HTTP status code 200 which is for success.

Then i called this connector using activity and unit tested but getting below :

pyStatusMessage the server responded with an HTTP 404 code, indicating that the resource does not exist.
pyHTTPResponseCode 404
pyStatusValue

Fail: The server indicated that there is no resource at the endpoint.

Then i changed logging level to debug and observed following error logs:

2018-07-25 23:26:38,323 [http-nio-8080-exec-7] [  STANDARD] [                    ] [                    ] (     services.http.HTTPService) ERROR Harinder|127.0.0.1  - Resource not found 
com.pega.pegarules.pub.PRException: Couldn't find Rule-Service-Rest instance for the following uri:/TGBHRAppsWorkOnboarding/1/MyRest 
	at com.pega.pegarules.integration.engine.internal.services.http.HTTPService.invoke(HTTPService.java:308) ~[printegrint.jar:?] 
	at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._invokeEngine_privact(EngineImpl.java:331) ~[prprivate.jar:?] 
	at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.invokeEngine(EngineImpl.java:274) ~[prprivate.jar:?] 
	at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.invokeEngine(EngineImpl.java:251) ~[prprivate.jar:?] 
	at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngineInner(JNDIEnvironment.java:278) ~[prpublic.jar:?] 
	at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngine(JNDIEnvironment.java:223) ~[prpublic.jar:?] 
	at com.pega.pegarules.web.impl.WebStandardImpl.makeEtierRequest(WebStandardImpl.java:678) ~[prwebj2ee.jar:?] 
	at com.pega.pegarules.web.impl.WebStandardImpl.doPost(WebStandardImpl.java:394) ~[prwebj2ee.jar:?] 
	at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source) ~[?:?] 
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121] 
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121] 
	at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:370) ~[prbootstrap-7.3.1-218.jar:7.3.1-218] 
	at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:411) ~[prbootstrap-7.3.1-218.jar:7.3.1-218] 
	at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethodPropagatingThrowable(AppServerBridgeToPega.java:224) ~[prbootstrap-api-7.3.1-218.jar:7.3.1-218] 
	at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethod(AppServerBridgeToPega.java:273) ~[prbootstrap-api-7.3.1-218.jar:7.3.1-218] 
	at com.pega.pegarules.internal.web.servlet.WebStandardBoot.doPost(WebStandardBoot.java:129) ~[prbootstrap-api-7.3.1-218.jar:7.3.1-218] 
	at com.pega.pegarules.internal.web.servlet.WebStandardBoot.doGet(WebStandardBoot.java:100) ~[prbootstrap-api-7.3.1-218.jar:7.3.1-218] 
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[servlet-api.jar:?] 
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[servlet-api.jar:?] 
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:8.5.14] 
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.5.14] 
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) ~[catalina.jar:8.5.14] 
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) ~[catalina.jar:8.5.14] 
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) ~[tomcat-coyote.jar:8.5.14] 
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-coyote.jar:8.5.14] 
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) ~[tomcat-coyote.jar:8.5.14] 
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) ~[tomcat-coyote.jar:8.5.14] 
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:8.5.14] 
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121] 
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121] 
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:8.5.14] 
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121] 

I am not able to understand why resource not found error is being thrown because when i am trying to access that service URL directly its working fine.

Please help to resolve this.

Thanks in Advance.

Low-Code App Development
Moderation Team has archived post
Share this page LinkedIn