how to inject sonar-project.properties into msbuild in sonarqube - msbuild

I have a c-sharp solution (say sample.sln), but to run sonarqube analysis, as per the docs, i have run the following command:
".\3rdparty\sonarqube\msbuild\SonarScanner.MSBuild.exe" begin /k:"comm"
/n:"comm" /v:"2.0"
/d:sonar.cs.dotcover.reportsPaths=
"D:\Jenkins\workspace\comm\TEST\CoverageReport.html"
/d:sonar.host.url="http://101.149.24.128"
/d:sonar.sources="D:\Jenkins\workspace\comm\source\*.cs"
msbuild comm.sln /t:Rebuild
".\3rdparty\sonarqube\msbuild\SonarScanner.MSBuild.exe" end
but getting this error :
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
INFO: Scanner configuration file: D:\Jenkins\workspace\comm\3rdparty\sonarqube\msbuild\sonar-scanner-3.2.0.1227\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\Jenkins\workspace\comm\.sonarqube\out\sonar-project.properties
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_151 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: SONAR_SCANNER_OPTS=-Xmx1024m
INFO: User cache: C:\Users\jenkins\.sonar\cache
INFO: SonarQube server 6.7.5
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=278ms
INFO: Server id: 7950B4AD-AWYRoMpRpurWib7aM-qP
INFO: User cache: C:\Users\jenkins\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=84ms
INFO: Process project properties
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 13.565s
INFO: Final Memory: 6M/84M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.scanner.scan.ProjectLock
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.ProjectBuildersExecutor
ERROR: Caused by: Unable to load component class com.talanlabs.sonar.plugins.gitlab.CommitProjectBuilder
ERROR: Caused by: Unable to load component class com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.MutableProjectSettings
ERROR: Caused by: Unable to load component class org.sonar.api.batch.bootstrap.ProjectReactor
**ERROR: Caused by: Illegal char <*> at index 43: D:\Jenkins\workspace\comm\source\*.cs**
ERROR:
The SonarQube Scanner did not complete successfully
so i thought of adding, all the sonar related properties into sonar-project.properties, and kept inside the project root folder, and ran the analysis. but got an error below.
sonar-project.properties files are not understood by the SonarScanner for MSBuild. Remove those files from the following folders: D:\Jenkins\workspace\comm
have looked at this question
what i could infer from this post is, we cannot set sonar-project.properties for msbuild ? is it ?
So then how to do include/exclude files/folders from code coverage in sonar analysis ? I don't have admin access, to set administrative global exclusions
Any help ?
P.S using sonarqube LTS 6.7.6

Related

SonarQube not showing output

I have a Kotlin project that I'm trying to analyse using SonarQube but I'm not getting any output on SonarQube after running the analyses using sonar-scanner.
Here is what my sonar-scanner.properties file looks like:
sonar.projectKey=my:Project
sonar.projectName=MyProject
sonar.projectVersion=1.0
Here is the output of running the "sonar-scanner" command in my root directory:
INFO: Scanner configuration file: /opt/sonarscanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /Users/mshah134/Documents/Clients/sonar-project.properties
INFO: SonarQube Scanner 4.2.0.1873
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Mac OS X 10.14.6 x86_64
INFO: User cache: /Users/mshah134/.sonar/cache
INFO: SonarQube server 8.0.0
INFO: Default locale: "en_AE", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=41ms
INFO: Server id: BF41A1F2-AW5-Bdo2nCvd9XLOhxPQ
INFO: User cache: /Users/mshah134/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=31ms
INFO: Load/download plugins (done) | time=76ms
INFO: Process project properties
INFO: Process project properties (done) | time=1ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: my:Project
INFO: Base dir: /Users/mshah134/Documents/Clients/
INFO: Working dir: /Users/mshah134/Documents/Clients/.scannerwork
INFO: Load project settings for component key: 'my:Project'
INFO: Load project settings for component key: 'my:Project' (done) | time=11ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=31ms
INFO: Load active rules
INFO: Load active rules (done) | time=1018ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 806 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for kotlin: Sonar way
INFO: Quality profile for web: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module MyProject
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=19ms
INFO: Using JAXBContext implementation: com.sun.xml.bind.v2.runtime.JAXBContextImpl
INFO: Sonargraph Integration: Custom metrics file '/Users/mshah134/.sonargraphintegration/metrics.properties' not found
INFO: Sonargraph Integration: Created 53 predefined and 0 custom metric(s)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/Users/mshah134/.sonar/cache/866bb1adbf016ea515620f1aaa15ec53/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
INFO: Sensor Kotlin Sensor [kotlin]
INFO: 305 source files to be analyzed
INFO: Load project repositories
INFO: Load project repositories (done) | time=8ms
INFO: Sensor Kotlin Sensor [kotlin] (done) | time=3815ms
INFO: 305/305 source files have been analyzed
INFO: Sensor JavaXmlSensor [java]
INFO: 290 source files to be analyzed
INFO: Sensor JavaXmlSensor [java] (done) | time=1077ms
INFO: 290/290 source files have been analyzed
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=351ms
INFO: Sensor XML Sensor [xml]
INFO: 290 source files to be analyzed
INFO: Sensor XML Sensor [xml] (done) | time=888ms
INFO: 290/290 source files have been analyzed
INFO: Sensor Sonargraph Integration [sonargraphintegration]
INFO: Sonargraph Integration: Processing SonarQube project 'my:Project'
WARN: Sonargraph Integration: XML report file '/Users/mshah134/Documents/Clients/target/sonargraph/sonargraph-sonarqube-report.xml' not found
INFO: Sonargraph Integration: Finished processing SonarQube project 'my:Project'
INFO: Sensor Sonargraph Integration [sonargraphintegration] (done) | time=0ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=78ms
INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 596 source files to be analyzed
INFO: SCM Publisher 594/596 source files have been analyzed (done) | time=3632ms
WARN: Missing blame information for the following files:
WARN: * HTML_Report.html
WARN: * XML_Report.xml
WARN: This may lead to missing/broken features in SonarQube
INFO: CPD Executor 57 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 249 files
INFO: CPD Executor CPD calculation finished (done) | time=108ms
INFO: Analysis report generated in 284ms, dir size=3 MB
INFO: Analysis report compressed in 1236ms, zip size=1 MB
INFO: Analysis report uploaded in 87ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=my%3AProject
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AW6MaqELqw9TfdaFvBVY
INFO: Analysis total time: 16.050 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 16.766s
INFO: Final Memory: 15M/64M
INFO: ------------------------------------------------------------------------
However, on SonarQube, I only see the following:
Here is what I get at the background tasks page:
And here is the output I get when I click the "Show Scanner Context" option:
SonarQube plugins:
- SonarPython 1.16.0.4432 (python)
- SonarCSS 1.1.1.1010 (cssfamily)
- JaCoCo 1.0.2.475 (jacoco)
- SonarGo 1.6.0.719 (go)
- SonarKotlin 1.5.0.315 (kotlin)
- Swift (Backelite) 0.4.5 (backelitesonarswiftplugin)
- 3D Code Metrics 3.7 (citymodel)
- Svn 1.9.0.1295 (scmsvn)
- SonarJS 5.2.1.7778 (javascript)
- SonarRuby 1.5.0.315 (ruby)
- SonarScala 1.5.0.315 (sonarscala)
- SonarC# 7.17.0.9346 (csharp)
- SonarJava 5.14.0.18788 (java)
- Sonargraph Integration 4.0.0 (sonargraphintegration)
- SonarHTML 3.2.0.2082 (web)
- Git 1.9.1.1834 (scmgit)
- SonarFlex 2.5.1.1831 (flex)
- SonarXML 2.0.1.2020 (xml)
- SonarPHP 3.2.0.4868 (php)
- SonarTS 1.9.0.3766 (typescript)
- SonarVB 7.17.0.9346 (vbnet)
Global server settings:
- sonar.core.id=BF41A1F2-AW5-Bdo2nCvd9XLOhxPQ
- sonar.core.startTime=2019-11-21T09:00:08+0400
Project server settings:
Project scanner properties:
- sonar.host.url=http://localhost:9000
- sonar.projectBaseDir=/Users/mshah134/Documents/Clients/
- sonar.projectKey=my:Project
- sonar.projectName=MyProject
- sonar.projectVersion=1.0
- sonar.scanner.app=ScannerCli
- sonar.scanner.appVersion=4.2.0.1873
- sonar.sourceEncoding=UTF-8
- sonar.working.directory=/Users/mshah134/Documents/Clients/.scannerwork
Figured it out.
Basically it was a permissions issue.
I had originally installed sonar-qube and the sonar scanner in /opt. When I ran the sonar scanner from another directory, it had problems pushing the files onto the local sonar-qube server.
I removed the sonar-scanner entry from /etc/paths, and placed all sonarqube and sonarscanner files in the ~/Documents folder.
I then did a chmod recursively on the folders, re-added the new location for sonar-scanner in /etc/paths and started up the sonar-qube server again.
Everything worked fine then. :)

activemq/apache-activemq-5.9.0/conf/activemq.xml (No such file or directory)?

i have just installed activemq, but when i try to run the following command:
./activemq start xbean:file:workspace/activemq/apache-activemq-5.9.0/conf/activemq.xml
I get the following:
emq/apache-activemq-5.9.0/conf/activemq.xml
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/home/pi/workspace/activemq/apache-activemq-5.9.0/data/activemq-pi.pid' (pid '2576')
activemq/apache-activemq-5.9.0/bin/activemq status returns the following:
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
ActiveMQ not running
The activemq.log says the following:
Caused by: java.io.FileNotFoundException: workspace/activemq/apache-activemq-5.9.0/conf/activemq.xml./activemq (No such file or directory)
But the activemq.xml file is there?. I am very new to activemq and dont know where to go from here, thank you.

SonarQube: errors in analysing C# and VB projects

I am trying to follow the instructions here to try SonarQube for MSBuild:
http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+MSBuild, but I got the following errors for C# and VB samples. I can't find any message in the sonar.log so don't know how to proceed.
C:\Tools\SonarQube\sonar-examples-master\projects\languages\csharp>where msbuild
C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
C:\Tools\SonarQube\sonar-examples-master\projects\languages\csharp>MSBuild.SonarQube.Runner.exe end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild End Step 1.1
WARNING: Duplicate project GUID: "12add147-fbaf-46aa-b8a4-f708d4d0f295". Check that the project is only being built for a single platform/co
nfiguration and that that the project guid is unique. The project will not be analyzed by SonarQube. Project file: C:\Tools\SonarQube\sonar-
examples-master\projects\languages\csharp\ConsoleApplication1\ConsoleApplication1.csproj
C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet>MSBuild.SonarQube.Runner.exe end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild End Step 1.1
WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\huj\AppData\Local\Temp\.NETFr
amework,Version=v4.5.AssemblyAttributes.vb, project: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\ConsoleApplication1\C
onsoleApplication1.vbproj
SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\bin\sonar-runner\bin\..
SonarQube Runner 2.4
Java 1.8.0_60 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
SONAR_RUNNER_OPTS=-Xmx1024m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\bin\sonar-runner\bin\..\conf\s
onar-runner.properties
INFO: Project configuration file: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\.sonar
INFO: SonarQube Server 5.2
15:43:49.634 INFO - Load global repositories
15:43:49.815 INFO - Load global repositories (done) | time=180ms
15:43:49.830 INFO - User cache: C:\Users\huj\.sonar\cache
15:43:50.224 INFO - Load plugins index
15:43:50.227 INFO - Load plugins index (done) | time=3ms
15:43:50.458 INFO - Process project properties
15:43:50.728 INFO - Load project repositories
15:43:50.741 INFO - Load project repositories (done) | time=13ms
15:43:50.747 INFO - Apply project exclusions
15:43:50.871 INFO - Load quality profiles
15:43:50.919 INFO - Load quality profiles (done) | time=48ms
15:43:50.924 INFO - Load active rules
15:43:51.344 INFO - Load active rules (done) | time=420ms
15:43:51.362 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to def
ine SCM of your project.
15:43:51.362 INFO - Publish mode
15:43:51.363 INFO - ------------- Scan ConsoleApplication1
15:43:51.459 INFO - Load server rules
15:43:51.629 INFO - Load server rules (done) | time=170ms
15:43:51.684 INFO - Base dir: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\ConsoleApplication1
15:43:51.684 INFO - Working dir: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\.sonar\vbnet_vbnet_65E63A
B4-1055-4104-B233-A9F7CF2233DA
15:43:51.685 INFO - Source paths: Module1.vb, My Project/AssemblyInfo.vb, My Project/Resources.resx, My Project/Application.myapp, My Proje
ct/Settings.settings, App.config
15:43:51.685 INFO - Source encoding: UTF-8, default locale: en_US
15:43:51.686 INFO - Index files
15:43:51.709 INFO - 2 files indexed
15:43:51.711 INFO - Quality profile for vbnet: Sonar way
15:43:51.885 INFO - All FxCop rules are disabled, skipping its execution.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 3.142s
Final Memory: 11M/308M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
Your C# project isn't being analysed because of the WARNING: Duplicate project GUID.... Check that your project guids are unique. You will also get this error if you run the begin step then call MSBuild multiple times for the same project before calling end. Try running begin, MSBuild .... end to see if that fixes the C# project issue. For the VB issue, please include more of the call stack from the Java error.

Trying to Use MSBuild SonarQube and unable to make it work

I have been using SonarQube for code analyzing at a basic level however now I would like to measure the code against FX-COP rules. Hence I am attempting to use MSBuild SonarQube scanner. I read the documentation thoroughly and have setup my project likewise however when I execute it gives me error.
Below is the extract from the log:
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\....\1c36691bf5270463\SonarQube.Analysis.xml
Loading analysis properties from C:\....\1c36691bf5270463\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
MSBuild SonarQube Runner Pre-processor 1.0.2.0
Loading analysis properties from C:\...\1c36691bf5270463\SonarQube.Analysis.xml
Updating build integration targets...
Fetching analysis configuration settings...
Generating rulesets...
Pre-processing succeeded.
Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 11/20/2015 1:46:41 PM.
Project "C:\Project1.sln" on node 1 (rebuild target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Build succeeded.
9 Warning(s)
0 Error(s)
Time Elapsed 00:01:07.86
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\...\1c36691bf5270463\SonarQube.Analysis.xml
Loading analysis properties from C:\...\1c36691bf5270463\SonarQube.Analysis.xml
Post-processing started.
MSBuild SonarQube Runner Post-processor 1.0.2.0 gives several warnings similar to one below:
WARNING: File is not under the project directory and cannot currently be analysed
by SonarQube.
File: C:\Users\...\AppData\Local\Temp\2\.NETFramework,Version=v4.0.AssemblyAttributes.cs,
project: C:\...\1c36691bf5270463\SOURCE\x\y.csproj**
Calling the sonar-runner:
SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
C:\...\1c36691bf5270463\.sonarqube\bin\sonar-runner\bin\..
SonarQube Runner 2.4
Java 1.8.0_51 Oracle Corporation (64-bit)
Windows Server 2008 R2 6.1 amd64
SONAR_RUNNER_OPTS=-Xmx1024m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\...\1c36691bf5270463\.sonarqube\bin\sonar-runner\bin\..\conf\sonar-runner.properties
INFO: Project configuration file: C:\TeamCity\buildAgent\work\1c36691bf5270463\.sonarqube\out\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\...\1c36691bf5270463\.sonarqube\out\.sonar
INFO: SonarQube Server 5.1.1
13:47:51.150 INFO - Load global repositories
13:47:51.743 INFO - Load global repositories (done) | time=593ms
13:47:51.758 INFO - Server id: 20151120125423
13:47:51.758 INFO - User cache: C:\...\cache
13:47:51.758 INFO - Install plugins
13:47:51.836 INFO - Install JDBC driver
.
.
.
13:47:55.518 INFO - ------------- Scan file1
13:47:55.534 INFO - Load module settings
13:47:55.658 INFO - Load rules
13:47:56.017 INFO - Base dir: C:\...\1c36691bf5270463\SOURCE\xxx
13:47:56.017 INFO - Working dir: C:\...\1c36691bf5270463\.sonarqube\out\.sonar\AC1_AC1_497EBFF2-C710-4843-8263-F534AF803D3E
13:47:56.017 INFO - Source encoding: UTF-8, default locale: en_US
13:47:56.532 INFO - Quality profile for cs: Sonar way
13:48:00.635 INFO - Sensor org.sonar.plugins.csharp.CSharpFxCopProvider$CSharpFxCopSensor#73c82ec1
INFO: -----------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: -----------------------------------------------------------------
Total time: 10.156s
Final Memory: 16M/306M
INFO: -----------------------------------------------------------------
13:48:00.791 Creating a summary markdown file...
Press any key to continue . . .
You need to run all your commands in a Developer Command Prompt for Visual Studio 2013 or higher and:
use at least MSBuild 12.0
have .NET 4.5.2+ installed
You have this error because the FxCop Results are not generated.
Do you see in the MSBuild's logs, execution of FxCop? This is visible inside the RunCodeAnalysis section of MSBuild's logs.
You need to run this from command line and use the "-X" flag on your command, this will give you verbose debugging, I would highly reccomend doing the following for troubleshooting.
sonar-runner.exe <arg> <arg> -X > sonar-runnerLog.txt
Then read or dump that log back here. either way you'll know a lot more about what the actual problem is.
You can get Visual Studio Express 2013 (or 15) for free and both of those come with their respective developer command prompts.

Java Servlet - Null Pointer Exception & .jar not loaded

So my situation is a bit odd because I am looking at a server with no access to the source code. Everything regarding the servlets has worked fine up until now, but there is this sudden, spontaneous error that has come up regarding one of the Java servlets having a null pointer exception.
Here is the error log:
INFO: Added header: Cache-Control: no transform
8-Apr-2014 10:57:16 AM org.apache.catalina.core.ApplicationContext log
INFO: Added header: Cache-Control: no cache
8-Apr-2014 10:57:16 AM org.apache.catalina.core.ApplicationContext log
INFO: Attempted context: null
8-Apr-2014 10:57:16 AM org.apache.catalina.core.ApplicationContext log
INFO: Request URI: /public_stage//def.jsp
8-Apr-2014 10:57:16 AM org.apache.catalina.core.ApplicationContext log
INFO: Real path: /opt/apps/tomjet/webapps/public_stage/def.jsp
8-Apr-2014 10:57:16 AM org.apache.catalina.core.ApplicationContext log
INFO: servlet context: null
8-Apr-2014 1:35:02 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet PushServletMAG threw exception
java.lang.NullPointerException
at com.openwave.wappush.Pusher.netSendRequest(Pusher.java:312)
at com.openwave.wappush.Pusher.send(Pusher.java:230)
at ca.test.servlet.ExtendedPush.pushServiceIndication(ExtendedPush.java:105)
at ca.test.servlet.CDMAPushServlet.doPost(CDMAPushServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:419)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
However going over to the catalina file I notice that it states that in a few locations, it is trying to validate .jar files, and that there are servlet.jar files not being loaded in the WEB-INF/lib directory.
Here is an example of a line with a certain location:
8-Apr-2014 2:02:00 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/opt/apps/tomjet/webapps/wapMIG/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Overall I am quite baffled by this problem as in terms of user interaction with the source code there was absolutely none as no one has access to it. It was just so sudden and spontaneous.
Any ideas/sources that could possibly help me with this problem? Much appreciated.
The error is the jar servlet-api.jar in your WEB-INF/folder, the container provide the servlet-api.jar and it cause the problem in deployment, you need to remove this jar from your lib folder.
You could need this jar to compile your project, so you must configure the project to use this jar in your IDE, in eclipse you can add it in the Java Build Path as an external jar, but I recommend you to enable the Web Dynamic Project Facet and configuring tomcat as your runtime enviroment. (Project -> Properties -> Project Facets)