Wrong registration url in slave nodes of SymmetricDS - java

I've recently deployed SymmetricDS tutorial example to my Tomcat 8. I have three .war files created from corresponding .properties files: corp-000.war, store-001.war and store-002.war. The sync.url in corp-000.properties file is:
sync.url=http://localhost:8080/corp-000/sync
and in my store-XXX.properties files I have this:
registration.url=http://localhost:8080/corp-000/sync
For some reason, when started all three of them on Tomcat, the log says:
[store-002] - PullService - Failed to connect to the transport: http://localhost:31415/sync/corp-000
[store-002] - PullService - Could not communicate with corp:000:000 at http://localhost:31415/sync/corp-000 because: Connection refused: connect
[store-002] - DefaultOfflineClientListener - Failed to connect to the transport: http://localhost:31415/sync/corp-000
But that is the url that was in files by default, and I've changed it to what I've written above!
When I run corp-000 node on Tomcat and start store-XXX node using the command `bin\sym' (this runs embedded jetty server) everything connects and works. What am I doing wrong?

Related

Two war files deployed in same docker container is not accessible

I have deployed two war file in docker container, say app1.war and app2.war. app1.war is calling internally app2.war to access few services. I am able to access service in app1.war from browser and internally when app1.war tries to call service in app2.war I am getting following error
I am using Apache server and each request will be first hit to apache server and then directed to the services running in container. Apache server is running in my host as a service.
I have created Dockerfile by taking tomcat as base and copied app1.war and app2.war in webapps folder and expose port is 8080
and build image as
docker build -t myapp .
execute it as
docker run -it -p 9999:8080 myapp
http://localhost:9999/app1/service1 ----- this is accessible and this URL is internally calling a service which is deployed in app2 http://localhost:9999/app2/calculation
on hitting http://localhost:9999/app2/calculation URL I am getting below error
Connection error for URL[http://localhost/app2/calculation/]. Exception: [I/O error on POST request for "http://localhost/app2/calculation/": Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused)].
I am looking for a solution for this issues and want to know where exactly the issue is. Any response is highly appreciated.
Your app2 deployed on Tomcat is exposed on port 8080 within the container, not 9999. Therefore, you're getting error when trying to access it on port 9999 from within the container. If you change internal endpoint to 8080 for app2, it should work.
Now, deploying 2 war files on the same Tomcat like this is actually an anti-pattern in containerized world. The usual architecture would be to have 2 separate images/containers, each having its own war file.

Not able to debug webservice using eclipse

i have tried the webservice example mentioned in the below link.
https://codezone4.wordpress.com/2012/11/08/restful-web-services-java-mysql-and-json/.
i build the application with maven deployed in tomcat then clicked on the webservice link in the chrome , not able to access my code.
Now i tried to debug with postman .
I clicked on my webservice class -> then debug -> debug configiuration
then i selected remote application
there values of host and port are
Host : localhost
Port : 8080
then it is showing establishing connection for long time and after that it is showing Failed to connect to remote vm .connection timedout
Can you please guide me how to make deugger working in eclipse to debug the rest api call.
I can find quick solution (In Windows Environment with local host):
1) Download tomcat in your favorite drive (E.g. d: drive)
2) Open startup.bat file under tomcat/bin folder in notepad
3) Replace following line (Which appear at the end of file)
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
with
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
4) Restart your tomcat as it will start with listening port 8000
5) Open Eclipse->"Run"->"Debug configuration"-> Create "Remote Java Application" and provide following information:
Name: sample-name
Project: your project folder
6) Click on Debug button
Note: Make sure Connection properties will have
Host: localhost
Port: 8000
7) Put debug point in your code
8) Open Postman and Hit sample REST API call as you will see the debug point will appear in your code
That's It!
Quoting from your query,
clicked on my webservice class -> then debug -> debug
The project you created requires the restApplication to be deployed on a running server.
Prior To Testing -> check http://localhost:8080 is up or not, and then publish the war into the server.
choose Debug As-> Debug on Server

Running multiple Spring boot executable jars on self contained server as Linux services

I have deployed my first spring boot web application executable jar in self contained tomcat server successfully and accessing it on port 8080 but when I deployed my second app on different port using init.d on port 42000 I am unable to access it. I have looked the log in /var/log the application starts successfully without any errors. What would be the causes for my problem?

Remote debug a standalone java application in IntelliJ

I'm trying to remote debug a standalone java application. I have done all that was recommended by IntelliJ, that is to add and edit a remote configuration on IntelliJ and added the recommended parameters:-
agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
But when I run the debugger I get Unable to open debugger port:
java.net.ConnectionException "Connection refused: connect"
Is there anything I need to on application side:that how will the application know on which port to attach to?How can I make my application listens on the specified port?

Unable to start WebLogic remotely to Debug

I setup my remote WebLogic server to debug, using these options:
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=${DEBUG_PORT},server=y,suspend=n -Djava.compiler=NONE"
I started WebLogic on the server and saw that it was listening on 8453 for dt_socket. I added the remote server on my local Eclipse and tested the connection. I also see that the server is STARTED and I can view the details. However, I'm unable to restart in DEBUG. I also stopped WebLogic on the server and now in Eclipse I see that it is stopped, but I'm not able to start it (the icons for debug and start are greyed out). When I set up my Remote Java Application in Eclipse I did check "Allow termination of remote VM".
Before stopping the server, the debug icon wasn't disabled and when I clicked it I got this message:
Cannot attach to remote server.
Please make sure the server myserver.com is running and listening for transport dt_socket at address: 8453
Failed to connect to remote VM. Connection refused.
Connection refused: connect
Instead of using java startup options, modify the following scripts:
setDomainEnv.sh -> make sure DEBUG_PORT is set ie. 8453
startWebLogic.sh -> set PRODUCTION_MODE=false and set debugFlag=true
Restart server, remote debug should work on port 8453.

Categories