Tomee Server :java.net.ConnectException: Connection refused: connect - java

I am trying to deploy my webservice on tomee server.
When I use maven goal as "tomme:run" to start the server, it gives the following error:
[INFO] Running 'run'. Configured TomEE in plugin is localhost:8080 (plugin shutdown port is 8005)
EError opening zip file or JAR rror occurred during initialization of VM
agent library failed to init: instrument
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
manifest missing : C:\Documents
[INFO] Total time: 30.844s
[INFO] Finished at: Thu Nov 01 17:36:15 IST 2012
[INFO] Final Memory: 10M/26M
[INFO] ------------------------------------------------------------------------
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at java.net.Socket.<init>(Socket.java:372)
at java.net.Socket.<init>(Socket.java:186)
at org.apache.openejb.config.RemoteServer.stop(RemoteServer.java:366)
at org.apache.openejb.maven.plugin.AbstractTomEEMojo$2.run(AbstractTomEEMojo.java:568)
But if I use startup.bat file to start the server , everything works fine.
Does anybody has any idea for this issue?

This seems a bit old but just in case if it helps.
It seems that when you are using the tomee plugin failed to start the server at the first place, and that is the reason for the connection refused issue. Because it tries to connect to the shutdown port to shutdown the server but obviously it is not available as the server never started.
So you should focus on "Error opening zip file or JAR rror occurred during initialization of VM agent library failed to init: instrument". By any chance, the artifact in your local maven repo can be corrupt ?
Best Regards,
Nandana

Not precisely the same situation, but I encountered this error:
"Error occurred during initialization of VM
agent library failed to init: instrument
Error opening zip file or JAR manifest missing : C:apache-tomee-plus-1.5.2/lib/openejb-javaagent.jar
when I tried to fire up TomEE as "./catalina.sh start" in a Cygwin terminal on my Windows box. Same result whether I tried a new complete TomEE or an already-existing Tomcat with the TomEE war. Works fine when I use the batch file in a Windows terminal as "catalina start". I don't really care enough to chase the issue further, but it appears that Tommy likes you to use a native shell.

Related

Jenkins build and deployment of spring boot client microservice fails because of config-server at https://localhost:8888 not present on maven build

My goal is to deploy 1 spring-config-server application AND 1 spring-boot-client application to the same Linux server machine.
spring-boot-client application port is 8081
spring-config-server application port is 8888
In Jenkins I created 2 jobs. First job is to build and deploy the spring-config-server application and start the jar. Second job is is to build and deploy the spring-boot-client application and start the jar.
I was able to build and deploy the spring-config-server application to the Linux machine. I can see it running at localhost:8888
Problem : Build task/job for spring-boot-client application in Jenkins is failing because when maven clean install is run, I believe that it tries to locate presence of a config server running at localhost:8888. I don't know if it's because of actuator dependency I added.
In Jenkins build console, this is what I get
Caused by: org.springframework.web.client.ResourceAccessException: I/O
error on GET request for "http://localhost:8888/application/dev":
Connection refused (Connection refused); nested exception is
java.net.ConnectException: Connection refused (Connection refused) at
org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785)
at
org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711)
at
org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:602)
at
org.springframework.cloud.config.client.ConfigServerConfigDataLoader.getRemoteEnvironment(ConfigServerConfigDataLoader.java:303)
at
org.springframework.cloud.config.client.ConfigServerConfigDataLoader.doLoad(ConfigServerConfigDataLoader.java:118)
... 94 common frames omitted Caused by: java.net.ConnectException:
Connection refused (Connection refused)
In the spring-boot-client app's application.properties, the only setting I have are these :
# ANT_PATH_MATCHER is added to avoid NULL error in SwaggerConfig
spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER
server.port=8081
# Spring Config Server URL of Config Server Microservice :
spring.config.import=configserver:http://localhost:8888
# Environment configuration which you want to load :
spring.profiles.active=dev
In spring-boot-client's jenkins build job, this is what I have :
Now, theoretically, I believe that deploying 1 config-server and 1 client-app in the same linux machine should be possible. I just don't know how to properly configure it in Jenkins.
I have this spring cloud config client in pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
<version>3.1.3</version>
</dependency>
I have a copy of the spring-config-server app and spring-boot-client app in my local machine. I just start/run both and it works.
I am a beginner in Jenkins and I do everything in UI. This is just a build task with scp and ssh commands executed in shell to deploy.
I'd appreciate any help or comment.
Thank you.

502 Bad Gateway and "Please try again in 30 seconds" messages

First of all I know that http 502 on gcloud means any possible error.
Also, in logs there are no errors only standard spring boot info and debug messages.
The project I have troubles is a swagger generated spring boot java project (more than 160 java files).
Locally on intellij works well and fast.
After executing mvn clean spring-boot:run on gclod shell the project starts and I see the default generated page on the browser.
After executing mvn appengine:deploy on gclod shell I always see this message on the browser:
Error: Server Error The server encountered a temporary error and could not complete your request. Please try again in 30 seconds
or This error: 502 Bad Gateway nginx. Always.
This are the last messages from gcloud console (after mvn appengine:deploy):
..done.
[INFO] GCLOUD: Setting traffic split for service [default]...
[INFO] GCLOUD: ...................................done.
[INFO] GCLOUD: Deployed service [default] to [https://polishapi-psd2.appspot.com]
[INFO] GCLOUD:
[INFO] GCLOUD: You can stream logs from the command line by running:
[INFO] GCLOUD: $ gcloud app logs tail -s default
[INFO] GCLOUD:
[INFO] GCLOUD: To view your application in the web browser run:
[INFO] GCLOUD: $ gcloud app browse
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16:07 min
[INFO] Finished at: 2019-12-18T14:11:30+01:00
[INFO] ------------------------------------------------------------------------
C:\workspace\PolishAPI-psd2>gcloud app logs tail
In logs there are no errors.
A basic, super simple, spring boot "hello world" project works but not that swagger generated big one.
How to deal with this problem?
Thank you.
After dealing with this problem for more than 4 weeks I discovered that the app.yaml file should only contain this two lines:
runtime: java11
instance_class: F4
yes! only this two lines are enought to run on gcloud that swagger generated project.
There are so many different samples on stackoverflow, github, etc. including unalike sample app.yaml files made by google for the same task and the answer is so simple.
Best regards! :)
Exact same issue , i am having for this sample https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/appengine-java8/helloworld-springboot
Followed the two lines it worked.
runtime: java11
instance_class: F4
By analogy with the answers above, the following helped:
runtime: java
env: flex
instance_class: B4
manual_scaling:
instances: 1
resources:
memory_gb: 4
It can also be used if necessary automatic_scaling and instance_class F4.

TomEE Embedded stops as systemctl service

i have some confusing behavior in one of our projets. We build a maven project which we stage by git. In our project we use tomee-embedded (v. 8.0.0) to start and run our application with a few commands on diffrent environments. That works pretty wells that far.
Acutally we wanted to deploy it on a server, so we did git clone ... and mvn clean install tomee-embedded:runand it worked pretty well.
To get some testing experience we wanted to keep the application running as service so we created a systemd service which contains:
[Unit]
Description=[… our description …]
After=network-online.target
[Service]
ExecStart = /bin/bash -c '/usr/share/maven/bin/mvn clean install tomee-embedded:run -f [path/to/our/application]
Restart=on-failure
User=root ## necessary to run on port 80.
WorkingDirectory=[onceagain/path/to/our/application]
[Install]
WantedBy=multi-user.target
This was also so far so good, when we start our service it runs the maven stuff, builds our application and starts up our tomcat, but then it stops immediately with log:
[INFO] TomEE embedded started on localhost:8080
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.717 s
[INFO] Finished at: 2019-12-03T10:28:16+01:00
[INFO] Final Memory: 56M/204M
[INFO] ------------------------------------------------------------------------
[INFO] Stopping ProtocolHandler ["http-nio-8080"]
[INFO] Pausing ProtocolHandler ["http-nio-8080"]
[INFO] Pausing ProtocolHandler ["https-jsse-nio-8443"]
[INFO] Stopping service [Tomcat]Dez 03 10:28:17 h2790697.stratoserver.net rhorun.sh[31795]: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:267)
at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:473)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:994)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:466)
at org.apache.tomee.embedded.Container.stop(Container.java:846)
at org.apache.openejb.maven.plugins.TomEEEmbeddedMojo$2.run(TomEEEmbeddedMojo.java:425)
Dez 03 10:28:17 h2790697.stratoserver.net rhorun.sh[31795]: Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/core/ContainerBase$StopChild
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:976)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
... 7 more
Dez 03 10:28:17 h2790697.stratoserver.net rhorun.sh[31795]: Caused by: java.lang.ClassNotFoundException: org.apache.catalina.core.ContainerBase$StopChild
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 9 more
So it looks as if maven builds correctly and our tomcat starts properly but immediately after the start of our tomcat is completed, the procedure is finished and the tomcat stops again. A behaviour we do not have if we run sudo mvn clean install tomee-embedded:run.
Is there may someone who could help us?
So due to some project pressure we build up a quick & dirty solution which works currently:
We moved our maven command to screen and have it running in background. The executing script ist handeled #rebootas cronjob for having a running server also when a machine-reboot was necessary.

Netbeans 8.1 + tomcat 8.0.39 build-impl.xml 1045 error

I get this error when I try to deploy my web application:
Deployment is in progress...
deploy?
config=file%3A%2FC%3A%2FUsers%2FEDGE%2FAppData%2FLocal%2FTemp%2Fcontext3172741505011533351.xml&path=/mywebapp
FAIL - Unable to create directory [C:\Program
Files\apache-tomcat-8.0.39\conf\Catalina\localhost]
C:\Users\EDGE\Documents\NetBeansProjects\mywebapp\nbproject\build-impl.xml:1045:
The module has not been deployed. See the server log for details.
BUILD FAILED (total time: 4 seconds)
How do go about solving this error??

Axis2 - always getting 404 errors

I'm trying to move some Web Service stubs from Metro to Axis2, however after generating my stubs using wsdl2java I'm constently getting 404 errors whenever I try and make a service call.
16/12/2010 11:14:57 AM org.apache.axis2.deployment.ModuleDeployer deploy
INFO: Deploying module: addressing-1.5.3-jar - file:/C:/Users/xxx/.m2/repository/org/apache/axis2/axis2/1.5.3/axis2-1.5.3-jar.jar
16/12/2010 11:14:57 AM org.apache.axis2.transport.http.HTTPSender sendViaPost
INFO: Unable to sendViaPost to url[xxxx]
org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:307)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at au.com.jpaterso.betcalc.axis2.tab.LoginStub.getKey(LoginStub.java:184)
at au.com.jpaterso.betcalc.axis2.tab.Test.main(Test.java:13)
Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:307)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at au.com.jpaterso.betcalc.axis2.tab.LoginStub.getKey(LoginStub.java:184)
at au.com.jpaterso.betcalc.axis2.tab.Test.main(Test.java:13)
The URL that it's trying to connect to is definitely correct as I can access it via my browser/SoapUI.
Any help would be greatly appreciated!
Thanks, Joseph.
You didn't provide much information about the environment in which you try to deploy your WS. E.g. is this a webapp running under Tomcat/JBoss or maybe the standalone server deployed with Axis2?
From the trace that you have posted I suppose that there is a connection with your server but your WS is not successfully deployed. I assume that you may use the standalone server for your tests and I suggest:
Go to your WS repository. On my test machine this would be something like ~/axis2-x.x.x/repository/services and make sure that your service is there (either the .aar file or the unpacked version).
Start the server and check if your service is really deployed. On my installation, for example the server will generate the following output (not complete):
me#melinuxpc:~/axis2-1.5.1/bin> ./axis2server.sh
Using AXIS2_HOME: xxx
Using JAVA_HOME: xxx
Using JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Listening for transport dt_socket at address: 8000
[INFO] [SimpleAxisServer] Starting
[INFO] [SimpleAxisServer] Using the Axis2 Repository xxx
[SimpleAxisServer] Using the Axis2 Repository xxx
[SimpleAxisServer] Using the Axis2 Configuration File xxx
[INFO] Clustering has been disabled
[INFO] Deploying module: xxx
[INFO] Deploying Web service: MyTestService - file: ~/axis2-1.5.1/repository/services/MyTestService/
Check if your web service is deployed and there are no errors. You may check if the WSDL of the service is available "in the browser". On my test machine the URL will be:
http://localhost:8080/axis2/services/MyTestService?wsdl
While a list with all deployed services may be seen at:
http://localhost:8080/axis2/services/
And do not be too quick in abandoning Axis2 ;)
Good luck!
I also see this error when use "axis2-wsdl2code-maven-plugin" to generate stub for a .NET webservice (.asmx).
I fixed by disable "chunked" of _serviceClient. Only add below code in method Constructor of file stub.
_serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED, "false");

Categories