Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SonarQube Analysis Fails with 401 Unauthorized Error in Maven Build #4966

Closed
mohdfurkan01 opened this issue Mar 2, 2025 · 2 comments
Closed
Labels
type:task Issues that are a change to the project that is neither a feature nor a bug fix.

Comments

@mohdfurkan01
Copy link

mohdfurkan01 commented Mar 2, 2025

I am using Spring Boot 3.4.3 with Java 17 and the following SonarQube Maven plugin:
<plugin> <groupId>org.sonarsource.scanner.maven</groupId> <artifactId>sonar-maven-plugin</artifactId> <version>5.0.0.4389</version> </plugin>
I have tried running the following commands but still face issues:

  1. .\mvnw clean install sonar:sonar → Using the default credentials (admin/admin at http://localhost:9000/)
  2. mvn clean verify sonar:sonar -Dsonar.token=<user_token> -X → Using a generated User Token
  3. mvn clean verify sonar:sonar -Dsonar.token=<global_token> -X → Using a Global Token

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar (default-cli)
on project journalApp: Error status returned by url
[https://api.sonarcloud.io/analysis/jres?os=windows&arch=amd64]: 401
{
"Message": "User is not authorized to access this resource with an explicit deny"
}

Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts
After logging in and updating my password, I generated both User & Global tokens, but the issue persists.
Has anyone faced a similar issue? How can I resolve this?

@mohdfurkan01 mohdfurkan01 added group:release type:task Issues that are a change to the project that is neither a feature nor a bug fix. labels Mar 2, 2025
@mohdfurkan01
Copy link
Author

Please find the full error logs below:
PS D:\spring\02_journalApp> mvn clean verify sonar:sonar -Dsonar.token=sqa_9exxf125xxxxxxad20xxxxxcfd8c4c
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< net.engineeringdigest:journalApp >------------------
[INFO] Building Journal App 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.4.0:clean (default-clean) @ journalApp ---
[INFO] Deleting D:\spring\02_journalApp\target
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ journalApp ---
[INFO] Copying 4 resources from src\main\resources to target\classes
[INFO] Copying 1 resource from src\main\resources to target\classes
[INFO]
[INFO] --- compiler:3.13.0:compile (default-compile) @ journalApp ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 15 source files with javac [debug parameters release 17] to target\classes
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ journalApp ---
[INFO] skip non existing resourceDirectory D:\spring\02_journalApp\src\test\resources
[INFO]
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ journalApp ---
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 3 source files with javac [debug parameters release 17] to target\test-classes
[INFO] /D:/spring/02_journalApp/src/test/java/net/engineeringdigest/journalApp/service/UserDetailsServiceImplTests.java: D:\spring\02_journalApp\src\test\java\net\engineeringdigest\journalApp\service\UserDetailsServiceImplTests.java uses or overrides a deprecated API.
[INFO] /D:/spring/02_journalApp/src/test/java/net/engineeringdigest/journalApp/service/UserDetailsServiceImplTests.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- surefire:3.5.2:test (default-test) @ journalApp ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running net.engineeringdigest.journalApp.JournalAppApplicationTests
25-03-02 22:53:47:165 [main] INFO o.s.t.c.s.AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class [net.engineerin
gdigest.journalApp.JournalAppApplicationTests]: JournalAppApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @configuration.
25-03-02 22:53:47:375 [main] INFO o.s.b.t.c.SpringBootTestContextBootstrapper -- Found @SpringBootConfiguration net.engineeringdigest.journalApp.JournalAppApplication for test class net.engineeringdigest.journalApp.JournalAppApplicationTests

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////

:: Spring Boot :: (v3.4.2)

25-03-02 22:53:48:022 [main] INFO n.e.j.JournalAppApplicationTests -- Starting JournalAppApplicationTests using Java 17.0.12 with PID 8848 (started by DELL in D:\spring\02_journalApp)
25-03-02 22:53:48:029 [main] INFO n.e.j.JournalAppApplicationTests -- The following 1 profile is active: "dev"
25-03-02 22:53:48:816 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate -- Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
25-03-02 22:53:48:919 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate -- Finished Spring Data repository scanning in 94 ms. Found 2 MongoDB repository interfaces.
25-03-02 22:53:50:314 [cluster-ClusterId{value='67c49426b544a34d508092d2', description='Cluster0'}-srv-cluster0.jvrdn.mongodb.net] INFO org.mongodb.driver.cluster -- Adding discovered server cluster0-shard-00-00.jvrdn.mongodb.net:27017 to client view of cluster
25-03-02 22:53:50:350 [main] INFO org.mongodb.driver.client -- MongoClient with metadata {"application": {"name": "Cluster0"}, "driver": {"name": "mongo-java-d
river|sync|spring-boot", "version": "5.2.1"}, "os": {"type": "Windows", "name": "Windows 10", "architecture": "amd64", "version": "10.0"}, "platform": "Java/Ora
cle Corporation/17.0.12+8-LTS-286"} created with settings MongoClientSettings{readPreference=primary, writeConcern=WriteConcern{w=majority, wTimeout=null ms, jo
urnal=null}, retryWrites=true, retryReads=true, readConcern=ReadConcern{level=null}, credential=MongoCredential{mechanism=null, userName='nawabsaab', source='ad
min', password=, mechanismProperties=}, transportSettings=null, commandListeners=[], codecRegistry=ProvidersCodecRegistry{codecProviders=[ValueC
odecProvider{}, BsonValueCodecProvider{}, DBRefCodecProvider{}, DBObjectCodecProvider{}, DocumentCodecProvider{}, CollectionCodecProvider{}, IterableCodecProvid
er{}, MapCodecProvider{}, GeoJsonCodecProvider{}, GridFSFileCodecProvider{}, Jsr310CodecProvider{}, JsonObjectCodecProvider{}, BsonCodecProvider{}, EnumCodecPro
vider{}, com.mongodb.client.model.mql.ExpressionCodecProvider@265c1a7c, com.mongodb.Jep395RecordCodecProvider@5b2b8d86, com.mongodb.KotlinCodecProvider@7fef0b40
]}, loggerSettings=LoggerSettings{maxDocumentLength=1000}, clusterSettings={hosts=[127.0.0.1:27017], srvHost=cluster0.jvrdn.mongodb.net, srvServiceName=mongodb,
mode=MULTIPLE, requiredClusterType=REPLICA_SET, requiredReplicaSetName='atlas-h1vt5a-shard-0', serverSelector='null', clusterListeners='[]', serverSelectionTim
eout='30000 ms', localThreshold='15 ms'}, socketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=0, receiveBufferSize=0, proxySettings=ProxySetting
s{host=null, port=null, username=null, password=null}}, heartbeatSocketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=10000, receiveBufferSize=0,
proxySettings=ProxySettings{host=null, port=null, username=null, password=null}}, connectionPoolSettings=ConnectionPoolSettings{maxSize=100, minSize=0, maxWait
TimeMS=120000, maxConnectionLifeTimeMS=0, maxConnectionIdleTimeMS=0, maintenanceInitialDelayMS=0, maintenanceFrequencyMS=60000, connectionPoolListeners=[], maxC
onnecting=2}, serverSettings=ServerSettings{heartbeatFrequencyMS=10000, minHeartbeatFrequencyMS=500, serverMonitoringMode=AUTO, serverListeners='[]', serverMoni
torListeners='[]'}, sslSettings=SslSettings{enabled=true, invalidHostNameAllowed=false, context=null}, applicationName='Cluster0', compressorList=[], uuidRepresentation=JAVA_LEGACY, serverApi=null, autoEncryptionSettings=null, dnsClient=null, inetAddressResolver=null, contextProvider=null, timeoutMS=null}
25-03-02 22:53:50:418 [cluster-ClusterId{value='67c49426b544a34d508092d2', description='Cluster0'}-srv-cluster0.jvrdn.mongodb.net] INFO org.mongodb.driver.cluster -- Adding discovered server cluster0-shard-00-01.jvrdn.mongodb.net:27017 to client view of cluster
25-03-02 22:53:50:431 [cluster-ClusterId{value='67c49426b544a34d508092d2', description='Cluster0'}-srv-cluster0.jvrdn.mongodb.net] INFO org.mongodb.driver.cluster -- Adding discovered server cluster0-shard-00-02.jvrdn.mongodb.net:27017 to client view of cluster
25-03-02 22:53:51:392 [main] INFO org.mongodb.driver.cluster -- Waiting for server to become available for operation with ID 5. Remaining time: 29982 ms. Selec
tor: WritableServerSelector, topology description: {type=REPLICA_SET, servers=[{address=cluster0-shard-00-00.jvrdn.mongodb.net:27017, type=UNKNOWN, state=CONNEC
TING}, {address=cluster0-shard-00-01.jvrdn.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, {address=cluster0-shard-00-02.jvrdn.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}].
25-03-02 22:53:52:011 [cluster-ClusterId{value='67c49426b544a34d508092d2', description='Cluster0'}-cluster0-shard-00-02.jvrdn.mongodb.net:27017] INFO org.mongo
db.driver.cluster -- Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-02.jvrdn.mongodb.net:27017, ty
pe=REPLICA_SET_PRIMARY, cryptd=false, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=25, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30,
roundTripTimeNanos=719229600, minRoundTripTimeNanos=0, setName='atlas-h1vt5a-shard-0', canonicalAddress=cluster0-shard-00-02.jvrdn.mongodb.net:27017, hosts=[clu
ster0-shard-00-02.jvrdn.mongodb.net:27017, cluster0-shard-00-01.jvrdn.mongodb.net:27017, cluster0-shard-00-00.jvrdn.mongodb.net:27017], passives=[], arbiters=[]
, primary='cluster0-shard-00-02.jvrdn.mongodb.net:27017', tagSet=TagSet{[Tag{name='availabilityZone', value='aps1-az2'}, Tag{name='diskState', value='READY'}, T
ag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='AP_SOUTH_1'}, Tag{name='workloadType', value='OPERATIONAL'}
]}, electionId=7fffffff000000000000010d, setVersion=248, topologyVersion=TopologyVersion{processId=67bc46cd90676d11eca605ea, counter=6}, lastWriteDate=Sun Mar 02 22:55:26 IST 2025, lastUpdateTimeNanos=79994238882800}
25-03-02 22:53:52:011 [cluster-ClusterId{value='67c49426b544a34d508092d2', description='Cluster0'}-cluster0-shard-00-01.jvrdn.mongodb.net:27017] INFO org.mongo
db.driver.cluster -- Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-01.jvrdn.mongodb.net:27017, ty
pe=REPLICA_SET_SECONDARY, cryptd=false, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=25, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30
, roundTripTimeNanos=727890200, minRoundTripTimeNanos=0, setName='atlas-h1vt5a-shard-0', canonicalAddress=cluster0-shard-00-01.jvrdn.mongodb.net:27017, hosts=[c
luster0-shard-00-02.jvrdn.mongodb.net:27017, cluster0-shard-00-01.jvrdn.mongodb.net:27017, cluster0-shard-00-00.jvrdn.mongodb.net:27017], passives=[], arbiters=
[], primary='cluster0-shard-00-02.jvrdn.mongodb.net:27017', tagSet=TagSet{[Tag{name='availabilityZone', value='aps1-az3'}, Tag{name='diskState', value='READY'},
Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='AP_SOUTH_1'}, Tag{name='workloadType', value='OPERATIONAL
'}]}, electionId=null, setVersion=248, topologyVersion=TopologyVersion{processId=67bc48fcbe12294c88fdc31b, counter=3}, lastWriteDate=Sun Mar 02 22:55:26 IST 2025, lastUpdateTimeNanos=79994238882300}
25-03-02 22:53:52:012 [cluster-ClusterId{value='67c49426b544a34d508092d2', description='Cluster0'}-cluster0-shard-00-00.jvrdn.mongodb.net:27017] INFO org.mongo
db.driver.cluster -- Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-00.jvrdn.mongodb.net:27017, ty
pe=REPLICA_SET_SECONDARY, cryptd=false, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=25, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30
, roundTripTimeNanos=730046300, minRoundTripTimeNanos=0, setName='atlas-h1vt5a-shard-0', canonicalAddress=cluster0-shard-00-00.jvrdn.mongodb.net:27017, hosts=[c
luster0-shard-00-02.jvrdn.mongodb.net:27017, cluster0-shard-00-01.jvrdn.mongodb.net:27017, cluster0-shard-00-00.jvrdn.mongodb.net:27017], passives=[], arbiters=
[], primary='cluster0-shard-00-02.jvrdn.mongodb.net:27017', tagSet=TagSet{[Tag{name='availabilityZone', value='aps1-az1'}, Tag{name='diskState', value='READY'},
Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='AP_SOUTH_1'}, Tag{name='workloadType', value='OPERATIONAL
'}]}, electionId=null, setVersion=248, topologyVersion=TopologyVersion{processId=67bc4776d79ffe9feb9fe20a, counter=4}, lastWriteDate=Sun Mar 02 22:55:26 IST 2025, lastUpdateTimeNanos=79994238882800}
25-03-02 22:53:52:040 [cluster-ClusterId{value='67c49426b544a34d508092d2', description='Cluster0'}-cluster0-shard-00-02.jvrdn.mongodb.net:27017] INFO org.mongo
db.driver.cluster -- Discovered replica set primary cluster0-shard-00-02.jvrdn.mongodb.net:27017 with max election id 7fffffff000000000000010d and max set version 248
25-03-02 22:53:54:063 [main] WARN o.s.s.c.a.a.c.InitializeUserDetailsBeanManagerConfigurer$InitializeUserDetailsManagerConfigurer -- Global AuthenticationManag
er configured with an AuthenticationProvider bean. UserDetailsService beans will not be used by Spring Security for automatically configuring username/password
login. Consider removing the AuthenticationProvider bean. Alternatively, consider using the UserDetailsService in a manually instantiated DaoAuthenticationProvi
der. If the current configuration is intentional, to turn off this warning, increase the logging level of 'org.springframework.security.config.annotation.authentication.configuration.InitializeUserDetailsBeanManagerConfigurer' to ERROR
25-03-02 22:53:55:444 [main] INFO n.e.j.JournalAppApplicationTests -- Started JournalAppApplicationTests in 7.854 seconds (process running for 9.569)
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.27 s -- in net.engineeringdigest.journalApp.JournalAppApplicationTests
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.4.2:jar (default-jar) @ journalApp ---
[INFO] Building jar: D:\spring\02_journalApp\target\journalApp-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot:3.4.2:repackage (repackage) @ journalApp ---
[INFO] Replacing main artifact D:\spring\02_journalApp\target\journalApp-0.0.1-SNAPSHOT.jar with repackaged archive, adding nested dependencies in BOOT-INF/.
[INFO] The original artifact has been renamed to D:\spring\02_journalApp\target\journalApp-0.0.1-SNAPSHOT.jar.original
[INFO]
[INFO] ------------------< net.engineeringdigest:journalApp >------------------
[INFO] Building Journal App 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar:5.0.0.4389:sonar (default-cli) @ journalApp ---
[INFO] Java 17.0.12 Oracle Corporation (64-bit)
[INFO] Windows 10 10.0 (amd64)
[INFO] User cache: C:\Users\DELL.sonar\cache
[INFO] JRE provisioning: os[windows], arch[amd64]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Journal App
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.016 s
[INFO] Finished at: 2025-03-02T22:54:07+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar (default-cli) on project journalApp: Error status returned by url [https://api.sonarcloud.io/analysis/jres?os=windows&arch=amd64]: 401 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@yanavasileva
Copy link
Member

Hi @mohdfurkan01,

This issue doesn't look to be related to Camunda 7 but Spring Boot, please reach out to them for help.
If you do use Camunda and have problems to set it up, you can create a new post in our forum - https://forum.camunda.io/

Best,
Yana

@yanavasileva yanavasileva closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:task Issues that are a change to the project that is neither a feature nor a bug fix.
Projects
None yet
Development

No branches or pull requests

3 participants