TomEE Embedded stops as systemctl service - java

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.

Related

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.

CreateJavaVM Failed

I have installed one of the old project using Java 11.0.2. When I tried starting tomcat 9 as a service I am getting below errors.
[2019-05-03 05:01:36] [info] [13044] Starting service...
[2019-05-03 05:01:36] [error] [ 9764] CreateJavaVM Failed
[2019-05-03 05:01:36] [error] [ 9764] The system cannot find the file
specified.
[2019-05-03 05:01:36] [error] [13044] Failed to start Java
[2019-05-03 05:01:36] [error] [13044] ServiceStart returned 4
[2019-05-03 05:01:36] [info] [13152] Run service finished.
[2019-05-03 05:01:36] [info] [13152] Commons Daemon procrun finished
I verified jvm.dll path. Its correct. Below are the command used to start tomcat service
C:\Java11\bin\tomcat9.exe //IS//TOMCATSERVER --StartClass
org.apache.catalina.startup.Bootstrap --StopClass
org.apache.catalina.startup.Bootstrap --StartParams start --StopParams
stop
Any help is appreciated.
Thanks in advance,
AKJ.

Error while building Hadoop src using maven

I want to install hadoop single node setup on windows7 64 bit. I have installed cygwin, windows SDK 7.1, maven 3.1.1 and jdk 1.6.33.
Running Hadoop single node setup on windows 7 is very trooublesome.
While buiding the "mvn package -Pdist,native-win -DskipTests -Dtar" i am getting below error.
Can someone help how to fix this error or any other way to build hadoop on windows 7 64 bit?
portion of the Error log is as follows:
[INFO] Apache Hadoop Main ................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.461s
[INFO] Finished at: Wed Jun 11 19:42:25 IST 2014
[INFO] Final Memory: 53M/339M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
5.1:compile (default-compile) on project hadoop-common: Compilation failure: Com
pilation failure:
[ERROR] D:\hdfs\hadoop-common-project\hadoop-common\src\main\java\org\apache\had
oop\ipc\protocolPB\RefreshCallQueueProtocolPB.java:[26,65] package org.apache.ha
doop.ipc.proto.RefreshCallQueueProtocolProtos does not exist
[ERROR] D:\hdfs\hadoop-common-project\hadoop-common\src\main\java\org\apache\had
oop\ipc\protocolPB\RefreshCallQueueProtocolPB.java:[36,33] package RefreshCallQu
eueProtocolService does not exist
[ERROR] D:\hdfs\hadoop-common-project\hadoop-common\src\main\java\org\apache\had
oop\ipc\protocolPB\RefreshCallQueueProtocolServerSideTranslatorPB.java:[24,65] p
ackage org.apache.hadoop.ipc.proto.RefreshCallQueueProtocolProtos does not exist
You can download the latest hadoop release from this url:
http://apache.mirrors.tds.net/hadoop/common/stable/hadoop-2.2.0.tar.gz
You are complicating yourself for no reason: you only need to build hadoop in windows if your system is 32 bits (and good luck on that: I've been trying it for 3 weeks!). Since your system is 64 all you need to do is download a precompiled package

Build Issues in Jenkins

The following errors occurs in Jenkins on running a job.
[INFO] ------------------------------------------------------------------------<br>
[INFO] BUILD SUCCESS<br>
[INFO] ------------------------------------------------------------------------<br>
[INFO] Total time: 5.785s<br>
[INFO] Finished at: Tue Dec 24 16:40:15 IST 2013<br>
[INFO] Final Memory: 17M/42M<br>
[INFO] ------------------------------------------------------------------------<br>
Waiting for Jenkins to finish collecting data<br>
[JENKINS] Archiving C:\Program Files\Jenkins\jobs\Selenium Code\workspace\pom.xml to org.corp.selenium.framework/Selenium_Code/0.0.1-SNAPSHOT/Selenium_Code-0.0.1-SNAPSHOT.pom<br>
[JENKINS] Archiving C:\Program Files\Jenkins\jobs\Selenium Code\workspace\target\Selenium_Code-0.0.1-SNAPSHOT.jar to org.corp.selenium.framework/Selenium_Code/0.0.1-SNAPSHOT/Selenium_Code-0.0.1-SNAPSHOT.jar<br>
FATAL: hudson.maven.MavenBuild.isInProgress()Z<br>
java.lang.NoSuchMethodError: hudson.maven.MavenBuild.isInProgress()Z<br>
at hudson.maven.MavenBuild.access$700(MavenBuild.java:94)<br>
at hudson.maven.MavenBuild$ProxyImpl2.close(MavenBuild.java:621)<br>
at hudson.maven.AbstractMavenBuilder.end(AbstractMavenBuilder.java:106)<br>
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun<br>(MavenModuleSetBuild.java:839)<br>
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)<br>
at hudson.model.Run.execute(Run.java:1665)<br>
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)<br>
at hudson.model.ResourceController.execute(ResourceController.java:88)<br>
at hudson.model.Executor.run(Executor.java:230)<br>
As you can see from the above console output from jenkins, the below listed changes happen:
Build is successful
The Jar files gets created and succesfully installed into maven repository
Still the job fails with the java.lang.NoSuchMethodError
exception.
Please let me know, how to fix this exception?
I had the same issue here and downgrade of Maven Project Plugin to version 2.0-beta-1 solved it.
I hope it helps
Best Regards

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

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.

Categories