Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I'm playing with ESB, and I created a simple job using a tRestRequest and tRestResponse. It works perfectly executing from the Studio, and Postman (or directly in the browser). However, when I use trun locally (after stopping the job in the Studio), it doesn't work, I have no response. My bundle is Active (bundle:status id)...
In the browser I get the message :
localhost doesn't authorize connection
ERR_CONNECTION_REFUSED
I might not have done something which is necessary
Thank you for your light 🙂
OK, I believe I know what is going wrong for you here. This is down to a configuration of the TOS ESB settings. Open Preferences and go to the Maven branch. You should see this....
The 2 tick boxes that I have circle, need to be unticked. Then click "Apply and Close".
After that, recompile your service, remove the old one from your deploy folder and add the new one. You should then see it appear on the http://localhost:8040/services screen.
EDIT: On second thoughts, only untick the "Offline" tick box. That should solve this for you. Leave the other one ticked. Try with that first. If it doesn't work, then untick the other option.
What is the URL of you web service that is failing? This will be affected by your Apache Karaf configuration. If you are running a browser from your server (on the same machine), this url should reveal your service urls....
http://localhost:8040/services/
Otherwise, use the IP address of the server to replace "localhost"
In the job, in the tRESTRequest :
REST Endpoint : "http://localhost:8088/hello/v1/"
Mapping, hello, GET, pattern : "/hello"
Produce JSON
Then I simply use a tXMLMap and tRESTResponse, to display a simple message, hello.
This works perfectly from the Studio, I go in Chrome, and use the URL "http://localhost:8088/hello/v1/hello".
It works in Postman too.
However, when I build as an OSGI for ESB, deploy, check that the bundle status is Active, when I go in Chrome or postman, and run the same URL than above, it doesn't work.
The URL will change when it is running somewhere else. In your tRestRequest you should set your endpoint from after the "domain" and "port". So if you want it to be ....
"http://localhost:8088/hello/v1"
....in your Studio, then set the tRestRequest to....
"/hello/v1"
When you run it in Studio, it will tell you what the URL is.
It works like this as the domain and port are set by the settings of your Karaf (or Runtime). When you publish a service in your Runtime, it will be running with a different "domain" and "port".
So, change your tRestRequest as shown above, build the service, deploy it and then look at .....
http://{Runtime IP address}:8040/services
....and you will see your service's URL there.
I show you each step here :
Global view of the job :
tRESTRequest :
tXMLMap :
tRESTResponse :
When I run it from the Studio :
Endpoint deployed at: http://127.0.0.1:8090/hello/v1
[statistics] connecting to socket on port 3465
[statistics] connected
mars 09, 2022 7:11:42 AM org.apache.cxf.endpoint.ServerImpl initDestination
INFOS: Setting the server's publish address to be http://127.0.0.1:8090/hello/v1
And indeed, from Postman, I can send request and I get the expected result :
Now I build the job as OSGI jar
I stop the job from the Studio
I deploy it LOCALLY in the runtime deploy folder on my computer and run trun, and check that my service is active :
And in Postman :
😕
You won't get the same URL in Studio and in the Runtime.
You need to try this URL....
http://{Runtime IP address}:8040/services
....(replace the "{Runtime IP address}" with the IP address of the machine that your Runtime is on).
You will see any services you have deployed there and you can use those URLs.
As for my tests I deploy on my local machine, I tried this URL as you say : http://localhost:8040/services
I get a message : No services have been found.
My bundle is said to be active using bundle:list | grep mybundlename
I have quickly put together a basic service and tested what you have done. When I call the URL (http://localhost:8040/services), I get the following.....
You should be seeing something like the above.
All have made absolutely no changes to the Runtime config, this is just as it is delivered, with my new service dropped into the deploy folder.
If yours is not showing up here, you will need to look in the tesb.log file. This is found in the log folder which is in the container folder (the same level as the deploy folder).
Do you see any errors in there?
Hello @Richard Hall
I stopped trun.
I deleted the current tesb.log file, and restarted trun to get a fresh tesb.log file.
I checked that my bundle is active.
I put its content right here : https://pastecode.io/s/3jfwpwhk
I see no error level message
There is no reference to the bundle in that section of the log file you've sent.