Not able to start SonarQube server after running StartSonar.bat file [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I tried running StartSonar.bat file, but it would stop or close abruptly.
Below is the snapshot of sonarqube server error:

We need to have the java 11 version installed for static tool analysis on sonarqube. For download and set up follow this link:
https://java.tutorials24x7.com/blog/how-to-install-java-11-on-windows
Even after this if you face an issue opening the StartSonar.bat file then, check task manager and kill all process/tasks related to java jdk. Because If you had already started Sonar and killed the process on command prompt, your JVM would still be running in the background.
If the issue is not solved then go to conf folder in sonarqube and open sonar properties file and search for the 9000 port number and change sonar.web.port value to some other port number Eg.9050 and uncomment it.
Similarly, search for port number 9001 and follow the same process.

The error suggest that you port 9001 is already use. Probable reasons:
Another program using it. Check Task Manager -> Performance -> Open Resource Monitor ->Network ->Listening Ports
Another instance of SonarCube is running and using it.
Previous instance of SomarCube was not ended properly.
Solutions:
If 1, then change the port of SonarCube server to something else. Read this.
If 2, then you can wait till it ends.
If 3, restart your system.

Sonar is trying to connect on port 9001 which is already in use. Take a look at what's running on port 9001 by navigating to Resource Monitor -->Network -->Listening Ports
In sonar.properties file, Change sonar port 9001 to any other available port. For example- 9003. Save the file and run the script StartSonar.bat to start sonar

Related

Force an java application to use specific jre [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have created an java application and it is working in some machine but not in few machines. I am not sure if it is because of the jre.
How can I find the path from which my application uses the jre and how can I force that application to use a jre in a specific location.
Thanks in advance
To answer the question at hand, Java system properties hold the values you seek:
String jreLocation = System.getProperty("java.home");
String javaVersion = System.getProperty("java.version");
I add the second of these as your problem may be caused by differing versions of Java (if the error is, say, a java.lang.UnsupportedClassVersionError).
In terms of enforcing a particular JRE, it's not possible to force the JVM version from a running Java program (this would need to be in a shell script or similar). You could check the value of "java.home" and exit if it's not the one you want but this would be unwise as this will vary from system to system. A slightly better options would be to exit with an error message if the "java.version" is not within a set of supported values.
However the best approach would be to fix the original problem such that your program works on all the systems you need it to run on. To this end, I'd recommend starting a new question with the error you get when running the program on these other systems.
You can write a script file to run a specific JRE, however do note that the problem is most likely not the JRE's fault unless the major version is different.
You cannot force a JRE to be ran in your Java program, because it would be too late.
You can find out the path of the JRE being use by checking the value of java.home system property. For example:
System.out.printf( "java.home = %s\n", System.getProperty( "java.home" ) );
Changing the JRE depends, particularly, on how you run your application:
If you are running your program through a command-line interface, you would need to modify your PATH environment variable to point to the correct java executable.
If you are running your program through an IDE, you may need to define a JRE_HOME environment variable and restart your IDE, or change the running configuration of your project.
To find out more about other useful properties in Java, take a look at https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html.
If your Java application requires a specific JRE, I think your best bet would be to package your application as "self-contained" bundle, containing the JRE. As many have already pointed out, once your application has started, the JRE is already chosen, and the only option you have, is to check the system variables, and possibly quit the application with some error message.
You can read more about the process of creating a self-contained application bundle at Oracle's Deployment Guide: Self-Contained Application Packaging.

Database Manager can't connect to hsqldb [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
After inserting the data into HSQLDB, I tried using database manager to connect to it but it failed to connect.
i launched the hsqldb in standalone mode. here is the error message:
Connection to HSQLDB (Local) - target failed Database lock acquisition failure:
lockFile: org.hsqldb.persist.LockFile#a9e38b36[file =C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\bin\target\misc.lck, exists=false, locked=false, valid=false, ]
method: openRAF
reason: java.io.FileNotFoundException: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\bin\target\misc.lck (The system cannot find the path specified)
If you are launch the hsqldb in standalone mode. It will happen like you said.
In this mode. DB engine will share the same jvm as application, the process will be faster than server mode. but the bad thing is you can't access it from outside. including database manager.
If you want view the data by tools. Please launching the db in server mode

Making a java application run automatically once in a day? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I did a reminder application in java.I want to run that application only at 12 P.M So that it then generates a mail to client .The thing to generate mail is done,but the main issue now is how to make application run exactly at 12 P.M daily...
Use cron (Unix only)
Add this to your cron tab
0 0 * * * /path/to/your/file.sh >/dev/null 2>&1
file.sh
#!/bin/sh
java com.package.YourMainClass
edit
On Windows 8, take a look here : Using Task Scheduler in Windows 8
You can keep the application running and do the scheduling yourself. For example, using Quartz
If you're on UNIX, you can use cron.
It can be solved in two ways. 1. Have the OS run it once a day using cron or other scheduler.
The other is to install your program as serice using http://sourceforge.net/projects/yajsw/ or other service wrapper helper.
Then have your program run in the back ground, with a timer every minute. When its time, do the tasks. This is great as your program can easily accept config for other triggers as well. Advantage of installing it as a service is that it will run automatically on system start and keep running in the back ground. Make sure you catch exceptions, log them but try to keep running so the program does not exit on recoverable and transient errors.
In both cases you will make a non UI program with an optional UI program that writes to java preferences API to tell the daemon any user specific preferences.
The service app can be run from command line as well if you dont want to install a few users do not want to install it as a service.
For timer can see How to set a timer in java

How to keep running a program in Java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have written some Java code to keep getting some value in other website every 10sec.
And I will keep writing the result to append a txt file.
How can I keep running this code.
Should I run it in some cloud server?
If so, how can I do it.
I just know in Eclipse, I click "run application".
How can I run in other ways(Linux, or without Eclipse)?
Here is what you can do, using a loop, shell script and a cron job to achieve what you need:
Make sure your program has the logic something like an infinite loop to run always.
Then write a shell script to invoke your java program with the necessary arguments.
Make sure that the classpath argument points to the jars that you need.
Make sure that the shell script has necessary linux permissions.
Schedule the script to be invoked by setting up a cron job. You can set the cron condition as per your need.
If you used eclipse, then you probably have created a jar file. In that case to run it outside eclipse:
java -jar <path-to-jar-file.jar>
Make sure you are in the correct folder before running above.
Eclipse is an IDE, meaning it allows you to edit and run code. When you click the Play button to run a project in eclipse, for each of your *.java files in the project workspace, another *.class file gets created. This is your code compiled to something the JVM (Java Virtual Machine) understands, and can be translated into machine languange and be ran.
These .class files can be run from the command line as well:
java myProgram.class
(Assuming you have the JRE in your environment variables). This can be done from any jvm on any platform, as long as your code is designed to be cross platform (Not using Windows specific APIs for example).
To stop the app, you can either implement a method that stops it, or kill its process. As for cloud computing, this is too broad a topic to just shoot you an answer here, but yes, you can run your code on a linux machine for example.

Apache Tomcat server isn't working when running Dynamic Web Application in Eclipse [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I want to add server to Eclipse which is Apache Tomcat 7.0 for running my web application but every time it is giving Error 404. I have tried all the solutions given on stack overflows other posts I will tell you what procedure I have followed:
I have downloaded windows installer for Apache tomcat and installed it.
I Placed a JAVA_HOME environment variable whose path is to the installed JDK.
Then in Eclipse: Window -> Preferences -> Server -> Add, I have added that server by giving the path up-to Apache bin folder.
Then I checked the build path of my project.
Firstly, it's giving the error that port no. is already in use, so I changed the port no. Secondly, it is giving Apache tomcat is already started. So I stopped it manually and started from Eclipse.
The URL is proper, I have checked it. And I have also given the URL manually. I have also created index.jsp
Now when I am running that project it is giving Error 404 . Requested file not found.
Have you look at your "web.xml" file? Look if the page you use as a welcome file exists, is there a index.jsp or index.html in your WebContent folder? ensure all the resources you´re pointing to, exist. As well, I strongly recommend you to use tomcat as a jar and not install it as a service on Windows, it is better. Also check the console of tomcat, there should be some red lines pointing to the issue that could be happening this behavior. Best regards.
error 404 implies that the tomcat server is up and running. your problem is with whatever you are trying to 'serve'
Ensure that your app is deployed properly.
Check if there is any error in any of logs.
Check if you typed in the right URL
Page not found or error 404 tells that there's no page at address url you trying to enter the browser. You need to check that server has configured properly to serve your application.
just double click on -- 1>Tomcat v7.0 Server at localhost.server .....
..
then at --------------- 2> Server Location ......
..
select second option -- 3> Use Tomcat Installation ....
..
and start the server again ... :)

Categories