Unable to start tomcat7 in ubuntu - tomcat7

I installed tomcat7 but when I tried to start it. It fails to start.
previously I'd installed tomcat7 and it was working fine, But when I tried to add tomcat7 server in netbeans it gave me error of some Catalina home or something. I looked for that solution and applied. Then after adding the tomcat7 server to the netbeans, it won't start. Later I install glassfish server. It also got failed. So again I uninstalled the tomcat7 and tried again to start it. But now it is not getting started.
Creating config file /etc/logrotate.d/tomcat7 with new version
* Starting Tomcat servlet engine tomcat7 [fail]
invoke-rc.d: initscript tomcat7, action "start" failed.
Setting up tomcat7-admin (7.0.52-1ubuntu0.3) ...
Setting up tomcat7-docs (7.0.52-1ubuntu0.3) ...
Setting up tomcat7-examples (7.0.52-1ubuntu0.3) ...
Processing triggers for ureadahead (0.100.0-16) ...

Try this!
Step 1:
When Install tomcat 7 on Ubuntu 14.04
$ sudo apt-get install tomcat7
Step 2
If You find an error post installation which could look something similar to the code below:
Creating config file /etc/logrotate.d/tomcat7 with new version
* no JDK or JRE found - please set JAVA_HOME
invoke-rc.d: initscript tomcat7, action "start" failed.
Setting up authbind (2.1.1) ...
Processing triggers for ureadahead (0.100.0-16) ...
To rectify the above please do the following:
$ sudo mkdir -p /home/data/backup_scripts
$ cp /etc/init.d/tomcat7 /home/data/backup_scripts/
$ sudo vim /etc/init.d/tomcat7
After you open the file i.e tomcat7, please find the following line
JDK_DIRS="/usr/lib/jvm/default-java ${OPENJDKS} /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-7-oracle"
Change the above line by appending the following to it:
/usr/lib/jvm/java-8-oracle
Thus the line would now become:
JDK_DIRS="/usr/lib/jvm/default-java ${OPENJDKS} /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-8-oracle"
Save the file and start the tomcat server. This time it should happen at ease:
$ sudo service tomcat7 start
Hope it works!!!

Related

Jenkins - Local checkout - Enable using script console

I am encountering below error. I am able to set the property using System.setProperty("hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT", "true")
However, the issue still persists. Any pointers?
ERROR: Checkout of Git remote '<path to project folder>' aborted
because it references a local directory, which may be insecure.
You can allow local checkouts anyway by setting the system property
'hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT' to true.
I found the info I needed and propably helps you too in
https://issues.jenkins.io/browse/JENKINS-68571:
So, follow these steps:
$ sudo systemctl stop jenkins
$ sudo systemctl edit jenkins
[Service]
Environment="JAVA_OPTS=-Dhudson.model.DirectoryBrowserSupport.CSP= -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true"
$ sudo systemctl restart jenkins
As per https://issues.jenkins.io/browse/JENKINS-68571:
it seems the System Property is read during initialization, thus changing it in Script Console does not change it.
In Script console use property on class directly:
hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT = true
Note that neither the System Property nor the class property persist across restarts.
A persistent solution depends on how you installed / start Jenkins.
If you are running via java -jar ..., add the system property there (java -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true -jar ...).
Or, if you installed it using your systems package manager and your system is using systemd:
$ sudo systemctl edit jenkins
[Service]
Environment="JAVA_OPTS=-Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true"
$ sudo systemctl restart jenkins

Cannot access Flink dashboard localhost:8081 on windows

I follow the first steps to install Flink.
I can start the cluster without any problem
$ start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host DESKTOP-....
Starting taskexecutor daemon on host DESKTOP-....
But I don't get any status from
$ ps aux | grep flink
I can also not access the dashboard via localhost:8081.
There is an older post having these issues, but the solution didn't work for me, since the described conf files do no longer exist, apparently.
My JAVA_HOME is set as C:\Progra~1\Java\jdk1.8.0_311 to avoid issues with the space in Program Files.
Can you check the logs in the /logs folder? I'm suspecting that C:\Program Files\ could still cause issues because of the space there.
go to download Flink folder and try bash command
$./bin/start-cluster.sh --daemon bootstrap-server localhost:8081
and run code one more
$ ./bin/flink run examples/streaming/WordCount.jar
if you finished run above code which not issue, go to localhost:8081
This still seems to be problematic. I tried to run from Windows Subsystem for Linux (WSL).
I have the following versions: java 11.0.16 and flink 1.15.2.
sudo apt-get update
sudo apt install openjdk-11-jre-headless
export FLINK_HOME=/mnt/c/Projects/Apache/flink-1.15.2
I set the following in flink-conf.yaml
rest.port: 8081
rest.address: localhost
rest.bind-adress: 0.0.0.0
Whereby I changed the bind address for localhost to 0.0.0.0 this seems to have fixed the problem.
$FLINK_HOME/bin/start-cluster.sh
Now I can access the Flink Web Dashboard.

RabbitMQ Docker Bash Script Issue - .sh Not Found

I am trying to create a RabbitMQ image that installs the rabbitmq_auth_backend_http plugin, and also executes a java application (.jar) via a bash script file. However, when I run the container I get this output from RabbitMQ:
/usr/local/bin/docker-deploy.sh: 2: /usr/local/bin/docker-deploy.sh:
: not found
Starting rabbit-sidecar application
Enabling plugins on node rabbit#039e6bd1bbfd:
bbitmq_auth_backend_http
The following plugins have been configured:
rabbitmq_auth_backend_http
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit#039e6bd1bbfd...
The following plugins have been enabled:
rabbitmq_auth_backend_http
set 4 plugins.
Offline change; changes will take effect at broker restart.
/usr/local/bin/docker-deploy.sh: 4: /usr/local/bin/docker-deploy.sh: rabbitmq-server
: not found
It's also not finding rabbitmq-server which is needed to restart rabbit for the plugin to work.
To note, the java application appears to be working as it should and is just logging what it normally logs when its spun up as its own container.
Dockerfile
FROM rabbitmq:3.8.2-management
COPY ./rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
RUN apt -y update && apt -y install openjdk-8-jdk
RUN mkdir /sidecar
ADD ./target/demo-0.0.1-SNAPSHOT.jar /sidecar/demo-0.0.1-SNAPSHOT.jar
ADD ./docker-deploy.sh /usr/local/bin/docker-deploy.sh
RUN chmod 755 /usr/local/bin/docker-deploy.sh #755
ENTRYPOINT ["sh", "/usr/local/bin/docker-deploy.sh"]
Script
#!/bin/bash
echo "Starting rabbit-sidecar application"
rabbitmq-plugins enable rabbitmq_auth_backend_http; rabbitmq-server
# starts the sidecar
java -jar /sidecar/demo-0.0.1-SNAPSHOT.jar
My original custom image that worked was this:
FROM rabbitmq:3.8.2-management
COPY rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
CMD ["sh", "-c", "rabbitmq-plugins enable rabbitmq_auth_backend_http; rabbitmq-server"]
Which worked fine, but obviously I needed to do what I am doing because I want to be able to run another service within the same container as it requires it.
I did notice that there is a docker-entrypoint.sh in /usr/local/bin. Is this something to be considered in this context?

Start Jenkins local server on Mac

I am trying to integrate CI/CD using Jenkins. I have properly set Jenkins up on my mac by installing Java JDK and all. The localhost url was also accessible. I was able to manage plugins using http://localhost:8081 url.
But I accidentally closed the terminal window and the Jenkins was stopped. The url stopped working. It now shows error
This site can’t be reached
localhost refused to connect.
I tried to run the Jenkins from terminal using this command
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
also this command:
sudo launchctl start /Library/LaunchDaemons/org.jenkins-ci.plist
The terminal asks for password, but the url still does not work. I even tried unloading the Jenkins using this command:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Then again loading and starting command. But its not working.
Any help would be appreciated. Thanks
This is how I solved the above problem
Go to Jenkins directory
/Users/me/Downloads/Jenkins
Then run Jenkins on any port (default 8080 or any other)
java -jar jenkins.war --httpPort=8081
And the localhost is working now.
This was a stupid situation.

Deploy vaadin 7 war file in EC2

I'm trying to deploy a Vaadin 7 example.war file in tomcat 7, using an EC2 server. I upload the file to /var/lib/tomcat7/webapps but then when I go to myIp:8080/example it doesn't find the resource.
Any idea why?
Thanks!
You have to use the tomcat manager (usually http://[YourHost]:8080/manager) to add a new webapp / war file, it is not just uploading the file to the webapps folder.
To install tomcat, the manager webapp, and configuring access credentials (debian or debian based distros), check this tutorial: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-apache-tomcat-on-a-debian-server
Solved!...
To install the manager:
sudo yum install tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps
To solve the Java Version mismatch, org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/prueba2]]:
On Eclipse:
Preferences >> Java >> Installed JREs
On EC2 server:
sudo yum remove java-1.7.0-openjdk
sudo yum install java-1.8.0
Then reinstall Tomcat7 and restart
Thanks #BlunT for all the help!!

Resources