Java Servlet - Null Pointer Exception & .jar not loaded - apache

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)

Related

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

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

Internal server error when trying to build and deploy to AEM

My local AEM instance suddenly stopped working when I switched branches in git and installed the package with
mvn clean install -PautoInstallPackage.
The build failed with [ERROR] Request to http://localhost:4502/crx/packmgr/service.jsp failed, response=Internal Server Error
My error log shows the following errors:
25.10.2018 11:52:33.607 *ERROR* [127.0.0.1 [1540504353564] POST /crx/packmgr/service.jsp HTTP/1.1] org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalLoginModule No IDP found with name 0654f74c177ec80b60f7922a9a6195cf. Will not be used for login.
25.10.2018 11:52:33.607 *ERROR* [127.0.0.1 [1540504353564] POST /crx/packmgr/service.jsp HTTP/1.1] org.apache.jackrabbit.oak.spi.security.authentication.external.impl.ExternalLoginModule No IDP found with name a9dea3b044e912071cbffd4839016d2e. Will not be used for login.
25.10.2018 12:00:30.005 *INFO* [sling-default-2-Registered Service.1079] com.adobe.granite.taskmanagement.impl.jcr.TaskArchiveService archiving tasks at: 'Thu Oct 25 12:00:30 HST 2018'
25.10.2018 12:00:58.610 *ERROR* [127.0.0.1 [1540504858546] POST /crx/packmgr/service.jsp HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
java.io.IOException: Unable to get component of class 'interface org.apache.sling.rewriter.Generator' with type 'htmlparser'.
I've tried adding <useProxy>false</useProxy> to my parent POM file as suggested on a similar thread posted here but that also did not work. I've tried recloning the repo and starting over but since it's a server error that did nothing.
Additional Info:
Running on Windows 10
AEM 6.4
Any assistance will be greatly appreciated.
Thanks!
Thanks for your help. The issue actually happened when I switched branches and installed and deployed the package over the existing package in AEM. By removing the quickstart folder and restarting the JAR file, thus creating a new AEM directory, I was able to install and deploy the correct branch without error.

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.

Where do i put JSTL taglibs after downloading them

kept getting this error when i run my web application :
HTTP Status 500 - The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
type Exception report
message The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
myPackage.Register.processRequest(Register.java:63)
myPackage.Register.doGet(Register.java:81)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
Apache Tomcat/7.0.42
and when i did some search i found that i need to download JSTL taglibs, i downloaded it but i don't know what to do with the files now, is there a specific folder i should put them so that my code runs fine?
From eclipse:
1.
Right Click --> properties --> Java Build Path --> Libraries -- > Add external jars
this will add jar to your eclipse biuld path
Right Click --> Deployment Assembly--> Java Build Path entries --> add JSTL jar
this will add the jar to WAR file when deploying it to the server.

Error in transporting an application from development worklight to Worklight Server Consumer Edition

I am using IBM Worklight environment. I have created a small application "SampleHybridProject" using Worklight Developer studio and tested it successfully.
Now when I am trying to deploy it on the Worklight Server Consumer Edition, and hitting the following URL: http://mymachine.com:9080/SampleHybridProject/console
I am getting this error in my browser:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /SampleHybridProject/console
I am using Worklight Edition 5.0.6. The Worklight Server is default "WAS with Liberty profile".
Here are the properties that I changed in worklight.properties file.
publicWorkLightHostname=localhost
publicWorkLightProtocol=http
publicWorkLightPort=9080
publicWorkLightContext=/SampleHybridProject
wl.db.type=MYSQL
wl.db.url=jdbc:mysql://mysqlinstalledonmypc:3306/WRKLGHT
wl.db.username=root
wl.db.password=admin
Here are the changes that I made in application-descriptor.xml:
<worklightServerRootURL>http://${local.IPAddress}:9080/SampleHybridProject</worklightServerRootURL>
Can you tell me what I am doing wrong or what I need to do?
I have found the problem and solved it. The problem is I was having this error in console.log file:
Error creating bean with name 'txManager' defined in URL [jar:file:/C:/ProgramData/IBM/Worklight/WAS85liberty-server/wlp/usr/shared/resou‌​rces/lib/worklight-jee-library.jar!/conf/core.xml]: Invocation of init method failed; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of com/ibm/ws/classloading/internal/UnifiedClassLoader) previously initiated loading for a different type with name "javax/sql/DataSource"
This was because I had a jar in the server/lib folder of my project which was causing this problem. I removed the jar from server/lib folder and redeployed the .war file. Now the console is getting loaded.
Are you getting any deployment errors in your liberty logs? A 404 on the context root generally means either the WAR was not found, or the context root defaults to something other than 'SampleHybridProject'. If the WAR appears to be loading correctly, it will output where it is listening on similar to:
[AUDIT ] CWWKT0016I: Web application available (default_host): http://[hostname]:port/SampleHybridProject/*
If it says the context root is anything other than SampleHybridProject, you can set it in the tag in liberty's server.xml:
<application id="SampleHybridProject" name="SampleHybridProject"
location="SampleHybridProject.war" type="war"
context-root="SampleHybridProject">
...
</application>