Sonarqube Error when activating rules in new Quality Profile - sonarqube

I'm using SonarQube server version 5.6.1 in docker. I have correctly configured the default Quality Profiles but now when trying to activate existing rules in a new Quality profile, the application throws the following error in the log:
ERROR web[o.s.s.es.BulkIndexer] Fail to execute bulk index request: Bulk[1 index request(s) on index rules and type activeRule] org.elasticsearch.transport.RemoteTransportException: [sonar-470917037901][inet[/127.0.0.1:9001]][indices:data/write/bulk] Caused by: org.elasticsearch.index.mapper.MapperParsingException: The provided routing value [squid] doesn't match the routing key stored in the document: [squid:S2204]
Do any of you have an idea of what could be happening? The rule appears as active in that profile but the profile says 0 active rules.
Thank you for your help.

I manage to find another question that contains a lookalike problem like mine in: Elasticsearch bulk index error on Sonar startup.
Tried the same answer and it worked.
TL;DR Delete the directory $SONAR_HOME/data/es/ and restart server.

Related

Unable to connect to SQL Server using the quarkus-hibernate-reactive due to incorrect reactive.url

I had worked on Quarkus connecting to Postgres. But this is the first time I am trying to connect to SQL Server, which is the default server in my current project. I am following this guide to create a database component.
The properties file contains the following:
quarkus.datasource.db-kind=mssql
quarkus.datasource.username=<user-id>
quarkus.datasource.password=<pwd>
quarkus.datasource.reactive.url=sqlserver://localhost:1433/<db-name>?currentSchema=<schema-name>
quarkus.datasource.reactive.max-size=20
hibernate.default_schema=<schema-name>
The application starts fine, but when I make a request to the Resource that internally uses the repository, I get the following error:
Internal Server Error
Error id f0a959d2-3201-4015-bfd7-6628ae9914d1-1, io.vertx.mssqlclient.MSSQLException: {number=208, state=1, severity=16, message='Invalid object name ''.', serverName='<sql-instance>', lineNumber=1, additional=[io.vertx.mssqlclient.MSSQLException: {number=8180, state=1, severity=16, message='Statement(s) could not be prepared.', serverName='<sql-instance>', lineNumber=1}]}
This means, my application is able to connect to the database, but it is not able to find the table. The table exists in a schema, and I am unable to pass the schema which may be the cause of the issue. If you check the properties file, I have tried with two options:
Adding 'currentSchema' as a query param
Adding the property 'hibernate.default_schema'
But none of the two options are working. There is no documentation on SQL Server that can help me provide the right configuration to the Quarkus application. Please help.
The correct property is quarkus.hibernate-orm.database.default-schema It is possible to check all the available configuration properties in this url https://quarkus.io/guides/hibernate-orm#hibernate-configuration-properties

To perform search operation through UI in Jhipster using elastic search for existing database MySQL

I started Jhipster for PoC purpose and I need to perform search through UI for already existing data present in MySQL database.I have the following doubts:
Do we need to install/have elastic search in order to run it first and check for the results?
Or choosing elastic search while creating the Jhipster application and configuring it is enough to use it further?
I have tried using generator-jhipster-elasticsearch-reindexer module by installing it. but it did not worked as expected.After installing it I ended up with the following error.
java.lang.IllegalStateException: handshake failed, mismatched cluster name [Cluster [internal-test-cluster-name2843e241-29cc-4bc0-82db-600eb78ed261]] - {127.0.0.1:9300}{pbkSwq2SQ-CTopOjTqsVcg}{127.0.0.1}{127.0.0.1:9300}
at org.elasticsearch.transport.TransportService.handshake(TransportService.java:404)
at org.elasticsearch.transport.TransportService.handshake(TransportService.java:367)
at org.elasticsearch.discovery.zen.UnicastZenPing$PingingRound.getOrConnect(UnicastZenPing.java:366)
at org.elasticsearch.discovery.zen.UnicastZenPing$3.doRun(UnicastZenPing.java:471)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The above error was resolved by adding sprig.data.jest.uri in application-dev.yml, but still the search mechanism is not working. i.e., It is not able to query on existing database.
Actual result: able to perform search from UI when i create an entity from the UI. Reason being when an entity is made through API then it is updating the elastic search database and producing the result.
Expected result: To able to perform the same search for already existing data when I connect to the MySQL database.
Jhipster already explained how to work with elasticsearch on their website:
https://www.jhipster.tech/using-elasticsearch/
Here is short answer for your question:
1. You do not need to install elasticsearch if you run your app in dev profile, because it uses embedded Elasticsearch instance.
2. You must select Elasticsearch open while creating Jhipster app so that the generator add search capabilities to your code.
The generator-jhipster-elasticsearch-reindexer module only works if you have enabled Elasticsearch in your app.

Quality profile weirdness (active/inactive rules) after sonarqube upgrade 6.3.1

I have upgraded sonarqube server from 6.2 to 6.3.1 and since then I see a weird behaviour regarding the quality profile (it might have occurred before, it is only now I see it).
When I click on the Quality Profile SonarWay (Java) I see
so it seems, that all rules are inactive.
When I click Activate More I see the following
so it looks, that there are rules are active (I assume due to the "Deactivate" option").
But when switching in the left bar to "active" under Quality Profile results in this
so clearly, no rules are active.
What is the second image then showing, what does the "Deactivate" mean, although it is inactive ?
How could this happen that suddenly all rules seem to be inactivated ?
This specific behaviour is a common symptom of a corrupted Elastic Search index (no longer in sync with SonarQube database).
Solution
Rebuild the SonarQube ElasticSearch index:
stop your SonarQube server
delete the ElasticSearch index # sonar_install_dir/data/es
start your SonarQube server
(reminder: ElasticSearch is a search engine used by SonarQube to index issues, rules etc. so that it can access this data rapidly without having to query the database all the time, see SonarQube Architecture)
Root-cause
Why did that happen ? A common case is an ElasticSearch index not being properly rebuilt after upgrading and/or changing database. Here's a typical scenario: you first start SonarQube on embedded H2 database, experiment a bit with it, then plug it to a full-fledged database. If the ElasticSearch index does not get scratched/rebuilt in between, then the index gets corrupted as the database/dataset it used to be in synch with just changed all of the sudden.
FYI there's an improvement planned to handle this more gracefully: SONAR-5681 .
Note: independently from above solution, do not take ElasticSearch index rebuild as a lightweight operation that should be performed regularly. SonarQube does self-manage its ElasticSearch index, so any issue must be investigated first.

SonarQube 5.0.1 - Error declaring a false-positive issue

I've a "Failed" message displayed when I declare a "false-positive" issue from the Web UI of Sonarqube (5.0.1).
A 400 error is returned with this response : "Transition from state RESOLVED does not exist: falsepositive"
But the issue is declared "unresolved" in the web ui (both on global issues and project page) and it broke the build (since I'm using Build Breaker plugin).
I have a doubt on the shown issue because it should be logically solved by my previous commit (cache problem ?).
How can I resolve this problem ?
This can happen when the ElasticSearch index of issues is out of sync with the database. You should stop your server, remove the $SQ_HOME/data/es directory and restart the server. It might take some time, depending on the number of issues in your database, but it should solve the problem.

Configuration Issue for IBM Filenet 5.2

I installed IBM Filenet Content Engine 5.2,on my machine.I am getting problem while configuring GCD datasources for new profile.
Let me first explain the setps I did,then I would mention the problem that I am getting.
First,I created GCD database in DB2,then I created datasources required for configuration of profile in WAS Admin Console.I created J2C Authentication Alias,for user which has access to GCD database and configured it with datasources.I am getting test database connection as successful but when I run task of configuring GCD datasources,it fails with the following error:-
Starting to run Configure GCD JDBC Data Sources
Configure GCD JDBC Data Sources ******
Finished running Configure GCD JDBC Data Sources
An error occurred while running Configure GCD JDBC Data Sources
Running the task failed with the following message: The data source configuration failed:
WASX7209I: Connected to process "server1" on node Poonam-PcNode01 using SOAP connector; The type of process is: UnManagedProcess
testing Database connection
DSRA8040I: Failed to connect to the DataSource. Encountered java.sql.SQLException: [jcc][t4][2013][11249][3.62.56] Connection authorization failure occurred. Reason: User ID or Password invalid. ERRORCODE=-4214, SQLSTATE=28000 DSRA0010E: SQL State = 28000, Error Code = -4,214.
It looks like simple error of user id and password not valid.I am using same alias for other datasources as well and they are working fine.so not sure,why I am getting error.I have also tried changing scope of datasources,but no success.Can somebody please help?
running "FileNet Configuration Manager" task of configuring GCD datasources will create all the needs things in WAS (including Alias), do not created it before manually.
I suspect it had an issue with exciting JDBC data sources/different names Alias
Seems from your message that you are running it from Filene configuration manager. Could you please double check from your database whether user id is authorised to execute query in GCD database. It is definitely do it with permission issue.

Resources