Troubleshooting with installation newrelic agent on tomcat - java

Trying to install java agent on tomcat.
successfully run
java -jar newrelic.jar install
then run apache, but not see any newrilc initialization messages in catalina out, and not found any logs in newrelic directory.

General guidance on this install process:
The script should print out a good amount of detail on what it's done, including where it detected your Tomcat instance. If nothing's showing up in your CLI, then it's likely you haven't started the install script.
You can use -h to see usage help, and -s /path/to/applicationserver if you want to make sure the script find your web app. Note that a clear error message should show up if the install script can't find your web app.
The install script is fairly simple, and you can perform a manual install with the steps in the New Relic documentation (broken out by framework).

Related

Running application with java + maven + tomcat (embedded) the port is not found

I've got no previous experience with java. Trying to run project from github - https://github.com/ESPD/ESPD-Service. The Service uses Maven for building multi-module Maven project. I'm using mvn clean package in order to generate the project.war file. Then type java -Dspring.profiles.active=prod -Xms768m -Xmx768m -jar project.war and the app is running in a Tomcat container with port 8080 and it shows on the cmd console that the app is running perfectly but the problem comes when i try to access the localhost:8080. It says Not Found and I've been looking all over the internet to find a solution but without success. Will appreciate a lot if someone gives me a hand on that one.
Java version should be JDK 1.8,
Maven version must be no greater than 3.5.0
Then add 2 libraries to ESPD-Service\espd-web\target\espd-web\WEB-INF\lib folder: mail-1.4.7.jar and activation-1.1.1.jar cuz they are currently missing.
After that run mvn install in order to install all the jars files and then run the java -Dspring.profiles.active=prod -Xms768m -Xmx768m -jar espd-web.war as it's written on the docs. And also when the app is running on localhost:8080 make sure you add localhost:8080/espd

Container did not start during docker stack deploy, could not find or load main class, unable to diagnose further

I am helping on a project which consists of a Docker stack with a bunch of services all working together. All of them start except for one.
Using docker service ps my-service --no-trunc gives me: task: non-zero exit(1)
Using docker service logs my-service gives me: Error: could not find or load main class
This particular container has a Java application running in support of a NodeJS server. After npm install, npm run init, npm run build, and mvn clean install, I was able to successfully build the Docker image. No errors.
However, now it's not actually starting. I can't figure out how to diagnose it any further. The error message doesn't tell me a whole lot. The Java code is old, but it should work, I never touched it.
Mainly, I don't know where to progress from here. Google searches turn up only stuff where they have access to a lot more debugging information, and I just don't have enough to go on. Java is not my strength. What am I missing?
UPDATE 3/21/19: Thanks to #VinDev, I was able to get some more detailed information (it should've been obvious to me to try this, but it's good to learn).
Used docker run --name TestMyContainer -it my-image bash to start up the container, then ran the normal starting command for the container in the stack, which is catalina.sh run. That gave me the following output:
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /docker-java-home/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Error: Could not find or load main class
UPDATE #2 3/21/19: I was able to solve the issue. I should've included more information: I'm on a Windows machine, but making Linux containers. I found the answer here: Tomcat startup - Error: Could not find or load main class
Windows had reverted the setenv.sh file to CRLF EOL. I changed it back in Visual Studio Code, ran the container again, and everything works!
Run docker service ls to see if the service shows up ...
also run docker service inspect my-service
This should give you a container id you can use to get the logs
docker logs CONTAINER_ID
You can also run the container by itself
docker run IMAGE_NAME
to see the result of just running it as a container
/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Seems it can't find bootstrap.jar or tomcat-juli.jar
Maybe not being copied by Dockerfile?
I added this to the original post, but adding it here as well to properly mark the question as answered:
I was able to solve the issue. I should've included more information: I'm on a Windows machine, but making Linux containers. I found the answer here: Tomcat startup - Error: Could not find or load main class
Windows had reverted the setenv.sh file to CRLF EOL. I changed it back in Visual Studio Code, ran the container again, and everything works!

Why doesn't my JBoss AS bin directory contain a run.sh script?

I am running Ubuntu 16.04 and I need to install and run Restcomm JSS7 stack as a JBoss AS Service.
I followed this video tutorial to install JBoss AS 7. Then I set the JBOSS_HOME environment variable to installation directory of JBoss AS 7. As a result, I was able to start the JBoss AS successfully by executing ./run.sh in the bin sub-folder of the installation directory.
Then I followed this guide to install Restcomm JSS7 stack. For that, I downloaded restcomm-jss7-7.4.1404.zip, unzipped it to /opt/ and then navigated to the ss7-jboss sub-directory and then executed ant deploy,
and the result was
...
BUILD SUCCESSFUL
which according to the guide is an indication of the service deployed successfully.
Then I am following CHAPTER 4 SECTION 4.1 of this user manual to run it as a JBoss AS Service. According to it,
All you have to do to start the Service is start the JBoss AS. This
will automatically start the SS7 Service. To start the JBoss Server
you must execute the run.sh (Unix) or run.bat (Microsoft Windows)
startup script in the /bin folder (on Unix or
Windows).
TWO PROBLEMS:
My <jboss_install_directory>/bin does NOT have a run.sh script. Because of this reason, I tried by running JBoss AS by using the regular standalone.sh script.
Next in the user manual, it is stated:
Result: If the service started properly you should see following lines
in the Unix terminal or Command Prompt depending on your environment:
(Note: I have pasted the following excerpt from user manual here, since it is too long to paste in this question.)
But I see none of those lines in my terminal. Rather, my terminal output of running ./standalone.sh is pasted here.
So I don't know how and where to proceed from here. Please help.
NOTE: This question is NOT a duplicate of my other question. Like I mentioned in the question titles, this question is about why my JBoss AS installation doesn't contain a run.sh script, and what would be its alternative. The other question is about some possible command to find out the JBoss Services started when it is running? When a beginner is starting to learn something, their entire purpose Not getting the job done. They have many confusions/questions in their mind.
The documentation documents how to start a JBoss 5.1 server but your installation uses a JBoss 7.1 server, which is why you have to use standalone.sh instead of run.sh to start the server and why the logs are different.
Since you correctly reach the JBoss AS 7.1.0.Final "Thunder" started in 3955ms line I wouldn't worry too much (except about using a documentation that is clearly outdated).
The documentation of your product only declares compatibility with JBoss 5.1.0. While it may work on later releases, you might want to check if there's a more recent version of your product. I wouldn't recommend installing JBoss AS 5.1.0 as it isn't supported anymore and will contain security breaches.

java missing class when supervisor running process but not when running as www-data user

I've made my first clojure app and I've built it with leiningen by running lein ring uberjar. I can run this on my dev machine (fedora 23) and I can run this on my ubuntu production machine java -jar tomahawk.jar. I've followed the digital ocean tutorial here that describes how to set up the environment. My supervisor conf is the following:
[program:tomahawk]
environment=TOMAHAWK_DB=$TOMAHAWK_DB
command=/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -jar tomahawk.jar
logfile=/tmp/supervisord.log
directory=/var/www/tomahawk/app
user=www-data
autostart=true
autorestart=true
startretries=3
redirect_stderr=true
stdout_logfile=/var/www/logs/tomahawk.app.log
However, when using this through nginx, i get the error
2016-03-19 23:34:08.594:WARN:oejs.AbstractHttpConnection:/
java.sql.SQLException: No suitable driver found for jdbc:sqlserver:$
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:255)
This comes from the com.microsoft.sqldbc4.jar file. However, I can run this standalone jar file, as well as I can run sudo -u www-data env TOMAHAWK_DB=$TOMAHAWK_DB java -jar tomahawk.jar just fine. Also, while this is running, I can hit it through the nginx reverse proxy.
I've searched around and found an unanswered email on the supervisor mailing list from 2011. Why can I only sometimes see the missing jar file?
I've tried putting it inside of the /usr/lib/jvm/.../lib/ext location for my jvm, bundled inside of the jar file, running from Tomcat, etc. I've made an upstart script as well with identical results as well. I am not sure what other paths I can try and was wondering if anyone had any insights.

Neo4J Server Installation Linux AWS Centos OS -- service user cannot find java

I have downloaded Neo4J enterprise from the Neo site and have untar'd it under /opt
I have successfully downloaded and installed the Java 7 Server edition from the Oracle web site. Note after indicating I want a server JRE, Oracle downloads this : jdk1.7.0_51
I have untar'd both under /opt giving me /opt/neo4j-2.0.0 and /opt/jdk1.7.0_51
I have successfully installed Neo4J 2.O on AWS with Centos Linux, such that it should run as a Service under a service account. To do this I used the Neo install command. The command ran successfully
I can successfully start Neo4J as myself. After editing my ~/.bash_profile to define JAVA_HOME and exporting.
export JAVA_HOME="/opt/jdk1.7.0_51/"
export NEO4J_HOME="/opt/neo4j-2.0.0"
export PATH=$JAVA_HOME/bin:$NEO4J_HOME:$PATH
Apply
source ~/.bash_profile
cd /$NEO$J_HOME
bin/neo4j start
Works just fine.
However, we are not able to successfully get Neo to start as a service
sudo service neo4j-service start
which: no java in (/sbin:/usr/sbin:/bin:/usr/bin)
ERROR: Unable to find java. (Cannot execute )
* Please use Oracle(R) Java(TM) 7 to run Neo4j Server. Download "Java Platform (JDK) 7" from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
* Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.
If I echo $JAVA_HOME it returns as expected
If I echo $PATH it returns as expected
by as expected we can see java on the path.
If I simply type java -version before I run sudo service neo4j-service start
the response shows the java version.
A bit of background: the Linux service command is not available unless I first run a special script per our normal it policies. However, the script clobbers the exports that I would otherwise use.
Accordingly the command
service neo4j-service start
returns
-bash: neo4j-service: command not found
indicating that the 'service' command cannot be found
So sudo is required in our environment to execute the service command
We have tried simply placing jdk1.7.0_51 under /sbin/jdk1.7.0_51 that does not work. We have also tried extracting the jre folder from jdk1.7.0_51 and placing it under /sbin/jre
Also tried creating a java.sh file under /etc/profile.d/
Still no success.
So the simple question....
Where is Neo4J 2.0.0 looking for Java when running as a service? Is it using the environment variable JAVA_HOME, or is it looking in one of the following locations as the Neo4J server error message would seem to indicate? "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"
Under my installation configuration the neo4j service is intended to run under the account neo4jservice. Is this as simple as making sure JAVA_HOME is available to the neo4jservice accound? Why the error message "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"?
Thanks in advance
I ran a test on my solaris and Linux Mint install and this seems to work for me
Perhaps it's not elegant, but it will get you going. Just drop the sudo part for your startup script.
sudo NEO4J_HOME="/opt/neo4j" JAVA_HOME="/usr/java" /opt/neo4j/bin/neo4j start
Obviously, modify the environment variables to your situation:
JAVA_HOME="/opt/jdk1.7.0_51/" NEO4J_HOME="/opt/neo4j-2.0.0" service neo4j-service start
Not quite the answer I was hoping for... as the answer seems to disregard this part of the original POST: "So sudo is required in our environment to execute the service command"
What does seem to work is modifying the neo4j-service script to include the exports.
neo4j-service is found at /etc/init.d

Categories

Resources