Versions :
Sonar : 8.8.0.42792
Sonar-scanner : 4.5.0.2216
MacOS : Catalina 10.15.6
sonar-project.properties :
sonar.projectName=camel
sonar.projectKey=camel-key
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=java
sonar.sourceEncoding=UTF-8
sonar.java.binaries=build/classes
sonar-scanner :
#----- Default SonarQube server
sonar.host.url=http://localhost:9000 # tried with local IP 127.0.0.1 & network IP too
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
Sonar Qube is UP, status is running , can access console too.
I have ZScaler security firewall, protected with password so can't modify or stop it.
Now, while executing below command from Project root directory where sonar-project.properties file exists , I am getting following error.
Caused by: java.net.SocketTimeoutException: Read timed out
Any particular reason and how to solve this , please ?
For some reason, the port 9000 is blocked by Zscaler (My machine has Zscaler turned on, I've not made any changes to Zscaler settings). However the solution I found is to change the Sonarqube's port to something else, eg 9090
Steps
Go to sonarqube-8.7.0.41497/conf (Im using 8.7, so you need to go the version you're using)
Open up sonar.properties
Change sonar.web.port=9000 to sonar.web.port=9090
Launch your sonarqube again by running sonar.sh start
Try scanning your project, by running sonar-scanner where your sonar-project.properties is.
Related
I have to set host url in sonar for bamboo(bambo plugin) configuration.
While my local docker program is running sonarqube container, it is confused to use localhost:9000 at host url in app configuration.
The error message is saying An error occurred while connecting the given SonarQube server: localhost:9000 failed to respond.
What should I do? Am I doing wrong or Is there anything to set more thing?
enter image description here
As your SonarQube instance is running in a different server, you need to point your "Sonar for Bamboo" plugin to that server, port 9000 (default of SonarQube). So, for example, if your server containing the SonarQube instance has the IP address 192.168.15.1 in your network, you need to configure the plugin to http://192.168.15.1:9000.
I did it in my environment and it works perfectly.
My gradle seems to insist on downloading packages from what looks like a proxy address. With this command I stop all Gradle daemons, remove any Gradle configuration, and build a random project from GitHub that has no proxy settings in its gradle.properties (I tried other projects, same result):
./gradlew --stop ;\
pkill -f '.*GradleDaemon.*' ;\
rm -rf ~/.gradle ;\
env ;\
./gradlew build
The ./gradlew build part outputs this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'commons-app'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:4.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.0.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom'.
> Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused (Connection refused)
For reference, here is the output of the first commands, with a line break between each for clarity:
Stopping Daemon(s)
1 Daemon stopped
TERM_PROGRAM=Apple_Terminal
TERM=xterm-256color
SHELL=/bin/bash
TMPDIR=/var/folders/jh/ffpydh_90rz7fhyq9ycryhnw00plfm/T/
TERM_PROGRAM_VERSION=433
OLDPWD=/Users/nicolasraoul/src
TERM_SESSION_ID=59D12079-D9B2-4C13-8366-219454D7760C
USER=nicolasraoul
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.OejMgJbaF5/Listeners
PATH=/Users/nicolasraoul/Library/Android/sdk/emulator:/Users/nicolasraoul/Library/Android/sdk/tools:/usr/local/git/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/Users/nicolasraoul/Library/Python/2.7/bin
PWD=/Users/nicolasraoul/src/commons-app2
ANDROID_SDK=/Users/nicolasraoul/Library/Android/sdk
LANG=en_US.UTF-8
XPC_FLAGS=0x0
HISTCONTROL=
XPC_SERVICE_NAME=0
HOME=/Users/nicolasraoul
SHLVL=1
LOGNAME=nicolasraoul
_=/usr/bin/env
Downloading https://services.gradle.org/distributions/gradle-6.2.2-all.zip
[...]
What could be the problem?
I have found several similar questions, but none of their answers apply because:
I am using pure Gradle, so no Android Studio.
~/.gradle is empty
I don't have a proxy and I have not willingly configured one anywhere. By the way gradle-6.2.2-all.zip gets downloaded fine as part of the build, so my Internet is working.
macOS Catalina 10.15.5
If you had a proxy configured before but gradle still thinks that it is enabled, be sure to kill all gradle daemons:
pkill -f '.*GradleDaemon.*'
It seems that you have some proxy settings which are redirecting your https traffic to 127.0.0.1:8888
Do you have the HTTPS_PROXY environment variable set?
Do you have https.proxyHost and https.proxyPort properties configured in $USER_HOME/.gradle/gradle.properties?
To investigate I wrote this small Java program that output the system properties seen by Java:
public class Main {
public static void main(String[] args) {
System.out.println("Hello");
System.getProperties().list(System.out);
}
}
It revealed that Java sees a proxy even though env does not.
Even though I have never used a proxy, for some unfathomable reason HTTP and HTTPS proxy had got enabled in the Mac System Properties:
Unchecking them solved the problem, allowing Gradle to build successfully.
After trying all the above options without sucess, I restarted my computer and now it works. I isn't a really technical solution but on another hand it is.
After more than 1 occurrence, I think it is related with Proxyman software, but just turning it off didn't work
did you use charles to capture the http request?try to turn off the macos proxy in charles
I just get started to use a MacBook Pro Mid 2012 Release and trying to develop with IntelliJ. I use Tomcat 8 server for the deployment.
While I run the Tomcat, I get the following,
This 1099 comes from the JMX port in Run -> Edit Configurations. However, if I changed it to other port (say, 1098) doesn't help either.
I had this info as the output,
/Applications/Tomcat-8.5.15/bin/catalina.sh run
/Applications/Tomcat-8.5.15/bin/catalina.sh: line 366: /Applications/IntelliJ IDEA.app/Contents/bin/java: No such file or directory
Disconnected from server
/Applications/Tomcat-8.5.15/bin/catalina.sh: line 366: exec: /Applications/IntelliJ IDEA.app/Contents/bin/java: cannot execute: No such file or directory
Java related info,
$ which java
/usr/bin/java
$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Project SDK was provided IntelliJ IDEA IU-171.4694.23, but, tried with the 1.8 as well. No success with both of the SDKs.
I TOOK TO FOLLOWING STEPS SO FAR WITH NO SUCCESS,
—————————————————————————————
Provided the permission to run catalina.sh,
Initially, I didn't have the permission to run the Tomcat and compiled the catalina.sh after entering the /bin folder inside the Tomcat directory with the command,
$ chmod a+x catalina.sh
Appended the hostname in the /etc/hosts file,
I get the hostname from the terminal,
$ hostname
macbook-pro
/etc/hosts returns the following (Sublime),
$ subl /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Inserted the macbook-pro information with the localhost,
127.0.0.1 localhost macbook-pro
Tried to kill the process (which I had success with MacBook Air earlier),
$ ps -A | grep intellij
$ ps -A | grep 1099
Every time get the different process info and could not kill the process.
What to do to solve the issue?
Update
I created a new project with the IntelliJ and now it runs fine with Tomcat. The previous project along with the IdeaProjects directory was imported from the other MacBook Air and pasted in the base directory. Though, I'm still unable to understand why that would be an issue.
My project is so far small (LOC < 1000 with 7 sources .java file). So, I'm manually creating the files and pasting the code inside from the main project. I will up for the REAL solution though.
I was also facing similar issue, For me the issue was related to invalid VM Options configuration in Intellij
In Intellij Click on
Run > Edit Configuration
Server Tab
You will notice VM Options
My VM Options were
-Dflyway.enabled=false -Dquratz.cron=0 0 2 1/1 * ?
When I removed -Dquratz.cron=0 0 2 1/1 * ? Intellij started the server again and the above issue was resolved , Looks like you cannot pass special characthers in VM Options
Similar case - just because forgot to add by mistake -D before VM options configuration, i.e:
Instead of DB_USER=User should be -DDB_USER=User
Foolish mistake :)
Check if your Tomcat contains the file setenv.sh ([YOUR_CATALINA_HOME]/bin/setenv.sh) or check catalina.sh; it may redefine the CATALINA_OPTS / JAVA_OPTS variable that IntelliJ uses to set up JMX. Your JMX port config (*-Dcom.sun.management.jmxremote.port*) in the file (setenv.sh / catalina.sh) should be the same as in IntelliJ:
CATALINA_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1 ${CATALINA_OPTS}"
In my case I used ; as separator in VM options in mac os. I added \ to it and error disappeared:
-Dsome.props=prop1\;prop2\;prop3
I'm trying to get Sonar working locally on an OS X box to do some proof of concept work, I've downloaded the following:
Sonar Qube: 4.5.6
Sonar Runner: 2.4
Sonar Qube is configured as:
sonar.web.host=localhost
sonar.web.context=/sonar
sonar.web.port=9000
When I try and use Sonar Runner with one of the example projects I get the following error:
ERROR: Error during Sonar runner execution
ERROR: Fail to request server version
ERROR: Caused by: Status returned by url : 'http://localhost:9000/sonar/api/server/version' is invalid : 404
If I copy and paste the URL from the console into the browser then the page loads (displaying 4.5.6).
What could be causing the script to receive a 404?
The box is behind a proxy but nothing should be trying to get to the outside world
UPDATE:
Changing the configuration from localhost to using the machines IP address produces a timeout rather than a 404, everything still works fine through the browser.
So it turned out my problem was that the JVM wasn't using the proxy settings of my machine, I had to add the following to the Sonar runner script.
SONAR_RUNNER_OPTS="-Dhttp.proxyHost=myproxy -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=my.local.host"
It's possible that HTTP queries from sonar-runner are routed based on system proxy settings, while your browsers may use their own proxy settings.
Go check the system-wide setting:
System Preferences/Network/Advanced/Proxies/Bypass proxy settings for these Hosts & Domains
And make sure that localhost/127.0.0.1 is in there.
I have a jenkins job named 'SampleMavenDeploy1' which copies artifacts(war file,pom.xml) from upstream project('SampleMavenBuild1') successfully to this project.
I have following configuration for this project:
"
Build Steps:
Copy artifacts from another project
Project Name:SampleMavenBuild1
Post-build Actions:
War/Ear files:MavenWebAppV14/target/*.war
Context Path:webapps
Containers:
Tomcat7.x
Manager username:tomcat
Manager Password:tomcat
Tomcat Url:http://localhost:8080/manager/text
"
The build of SampleMavenBuild1(make war file of a maven project) has succeeded. In workspace of this job (SampleMavenDeploy1), there is war file (MavenWebAppV14/target/MavenWebAppV14.war). I have also configured tomcat-users.xml to add user of username 'tomcat' , password 'tomcat' and roles as 'manager-gui' and 'manager-script' .
I am facing following errors in a jenkins build of a job. This job is designed for deploying war file on tomcat7 via CI server. I have also 'deploy to tomcat' plugin installed in jenkins.
Started by user vikas
Building in workspace C:\Users\vikachou\.jenkins\jobs\SampleMavenDeploy1\workspace
Copied 2 artifacts from "SampleMavenBuild1" build number 4
Deploying C:\Users\vikachou\.jenkins\jobs\SampleMavenDeploy1\workspace\MavenWebAppV14\target\MavenWebAppV14.war to container Tomcat 7.x Remote
ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [C:\Users\vikachou\.jenkins\jobs\SampleMavenDeploy1\workspace\MavenWebAppV14\target\MavenWebAppV14.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:189)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
at hudson.FilePath.act(FilePath.java:918)
at hudson.FilePath.act(FilePath.java:896)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1770)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Unknown command /manager/text/list
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:686)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:699)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:174)
... 16 more
org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Unknown command /manager/text/list
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:686)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:699)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:174)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
at hudson.FilePath.act(FilePath.java:918)
at hudson.FilePath.act(FilePath.java:896)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1770)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Finished: FAILURE
Anyone who can figure out is most welcomed .
Thanks in advance!!!
You need to give permissions to the text-manager to be able to deploy.
Just go to tomcat-users.xml and add this:
<user username="tomcat" password="password" roles="manager-script"/>
Or just give the manager-script permission to your existing tomcat-manager user
You need to set the base URL to localhost:8080/ in the deploy URL, not the manager URL which is localhost:8080/manager/text (which is what happened in my case).
I have the same problem as you. But I had the tomcat users refresh like the first answer of this question and the problem still persists on Jenkins.
When I tried to connect to tomcat admin zone using my navigator, tomcat didn't display the page to me, because the tomcat-admin package was not installed. So I've installed the tomcat7-admin package and restarted tomcat :
sudo apt-get install tomcat7-admin
sudo service tomcat7 restart
Then the problem was fixed. It was because Jenkins couldn't connect with the program. So easy!
All you have to do is add the users and and assign the manager-gui (for GUI access) and manager-script (for access like Jenkins deployment ). Also, make sure to edit the file /webapps/manager/META-INF/context.xml, either to comment out valve or define appropriate reg ex for allow attribute
If it shows a connection error or fails to load when you deploy jenkins.war file on tomcat, then follow the steps below.
Paste the jenkins folder inside tomcat/webapps.
Restart the tomcat (localhost or ip:8080/jenkins)
Jenkins will load and may asks for password.
To get the jenkins admin password then run
{cat /opt/tomcat/.jenkins/secrets/initialAdminPassword}
If the permission is denied to access the password then
sudo chmod 0777 /opt/tomcat/.jenkins/secrets/initialAdminPassword
or else run ls -a there you will see .jenkins folder.