Ok, this is strange. I have WAMP and Tomcat on a win7 workstation. I downloaded a copy of a live website, that is working fine. I also set up a copy of the db. Website is a very old jsp website.
Everything is fine when I work on the homepage. If I click on other pages, like "news", "features", I can see everything working perfectly.
But if I open the news.jsp, features.jsp... files, and I change even the smallest thing, or nothing at all, but I save them again, I get the nefarious nullpointerexception error:
message java.lang.NullPointerException
description The server encountered an internal error that prevented it from fulfilling this request.
exception`enter code here`
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:584)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.NullPointerException
org.apache.jsp.Pages.features_jsp.jspDestroy(features_jsp.java:42)
org.apache.jasper.runtime.HttpJspBase.destroy(HttpJspBase.java:59)
org.apache.jasper.servlet.JspServletWrapper.destroy(JspServletWrapper.java:477)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:165)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
What the heck is going on? How is it possible that the files work fine but if I open them they stop working? Is this a permission problem? I come from php and have no idea on how to deal with this environment.
Have you automatically changed the encoding of file by saving? Check the old encoding and u can compare the size of former and latter files.
Have you automatically changed its line break? Some line break in windows doesn't perform well in Linux, as the well-known \n and \r\n problem. Besides, I once edited a bash file in Notepad++ in widows, but it has exception when executing it in Linux. Then the solution is re-typing it in Linux.
By the way, would you mind pasting the code of jspDestroy(features_jsp.java:42) and so on so I can have more information?
Hope it helps!
Related
When i have placed ".war" file in Apache Tomcat/8.5.39 and tried to start server getting the below error
java.lang.NoClassDefFoundError: org/apache/naming/resources/FileDirContext but in previous version tomcat 7.0.34 its working fine
Root Cause
java.lang.NoClassDefFoundError: org/apache/naming/resources/FileDirContext
com.anz.fit.fitas.tomcat.share.StaticContentController.initResources(StaticContentController.java:127)
com.anz.fit.fitas.tomcat.share.StaticContentController.doGet(StaticContentController.java:63)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
org.apache.catalina.servlets.DefaultServlet.service(DefaultServlet.java:418)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
Do i need to add any library or else ?
The org.apache.naming.resources package got removed in Tomcat 8.0 with no direct replacement. There is no alternative library you could add to the classpath to make it work.
Neither the release notes nor the changelog mentions the removal of that package, so I guess the Tomcat authors regarded it is internal.
You should look at your StaticContentController to understand why it has a dependency on on Tomcat's FileDirContext, and replace that dependency with something ideally not dependent on Tomcat internals.
I have a Java-web application running on Tomcat 9. It works fine on a Windowns machine. But after deploying this app on a Debian Linux server I've encountered java.lang.StackOverflow exceptions on some particular pages. Here is the beginning of the stacktrace log:
27-Dec-2017 08:54:43.746 SEVERE [https-jsse-nio-9443-exec-3]
org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for
servlet [jsp] threw exception
java.lang.StackOverflowError
at java.io.UnixFileSystem.canonicalize0(Native Method)
at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:172)
at java.io.File.getCanonicalPath(File.java:618)
at org.apache.catalina.webresources.AbstractFileResourceSet.file(AbstractFileResourceSet.java:90)
Please, see full stacktrace here:
https://pastebin.com/0AmFDY8F
As far as I understand, the exception occurs while compiling the JSP page source by Jasper and it's somehow related to the resolving of Linux paths / directories. Could anybody please help me to figure out what the exact problem is? I didn't create any symbolic links, if the problem can be related to this.
According to your stack trace, the problem is caused by not being able to find a specific path as resolved by your Spring framework:
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
...
Caused by: java.io.IOException: JSPException including path '/struct/context/tutorials.jsp'.
The Spring framework is likely using the canonical paths to resolve the file, and it fails perhaps because there is some quirk in the framework related to the type of Unix system you are deploying to.
Please reference this in the Spring documentation:
https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html#deployment-install-supported-operating-systems
The default script supports most Linux distributions and is tested on CentOS and Ubuntu. Other platforms, such as OS X and FreeBSD, will require the use of a custom embeddedLaunchScript.
Notice that Debian was not listed. Hopefully this puts you on the right path.
If I'm chasing a red herring here, I'm sorry - but you haven't given us much to go on.
Finally I've found what caused the StackOverflow exception. I have a recursive JSP tag call to render nested options for a <select> tag. After removing the recursion, the exception disappeared. Sure, it's just a workaround, so I'm still wondering why it works fine on Windows and doesn't on Linux.
Everything is running well when debugging my webapp at localhost, but when deploying it to to server (Microsoft Azure, OS:Ubuntu 14.04 tomcat7+apache ), the jcaptcha servlet cannot be found, and it throws Exception as "java.lang.NoClassDefFoundError: Could not initialize class "
type Exception report
message Servlet execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
java.lang.NoClassDefFoundError: Could not initialize class com.tjw.hrmanage.util.jcaptcha.CaptchaServiceSingleton
com.tjw.hrmanage.util.jcaptcha.JcaptchaServlet.doGet(JcaptchaServlet.java:40)
javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.52 (Ubuntu) logs.
This is because your app in ubuntu can not find the corresponding jar file. You can add this class's jar file to /lib and add reference for this jar in 'build path' in eclipse and then redeploy your project to azure again.
As I known, there are three common reasons that will cause this error.
The class belongs to a missing JAR file or JAR was not added into classpath or sometimes jar's name has been changed.
The class is not in the path CLASSPATH, there is no sure shot way of knowing it but many a times you can just have a look to print System.getProperty("java.classpath") and it will print the classpath from there you can at least get an idea of your actual runtime classpath.
Just try to run with explicitly -classpath option with the classpath you think will work and if it's working then it's a sure short sign that someone is overriding java classpath.
Per my experience, I think your issue matches the first case. Please check your code and the referenced library.
I changed the jdk version from openjdk7 to java-8-oracle and restart my tomcat, then everything is running well, thanks a lot for your answers.
I have a problem with upserting csv file data using jitterbit, into a salesforce instance. I am going to provide as much information as I can here, but if there is anything else the experts would like to know, please ask me to provide.
I am not sure what to do to resolve this. I would appreciate some suggestions. Thank you very much.
The error in jitterbit, when uploading csv, is:
Failure to deploy - "The file "tran9015s.jtr" does not exist. Looked for it here: "1503/1495/jtr/tran9015s.jtr". [GENERIC_EXCEPTION_OTHER]"`
This is quite a large file (>400 MB), which is in csv format, tab
delimited. I am using jitterbit 6.0.4.3. Operating system: Mac OS X
Maverick (with all relevant updates up-to-date) java : version 7
update 45
I had installed the jitterbit cloud data loader client, just today.
I am trying upload the contents of the csv file into my company's salesforce instance.
I had logged into jitterbit, chose new upsert, and then selected the appropriate salesforce object.
I then selected an external ID field.
Then I selected the file to upsert.
In the preview pane which followed, I had made sure that is the right file I would like to upload.
Then I chose file type delimited file, with header. It is a tab delimited file, so I added \t as delimiter.
I skipped the scheduling options, maintaining it as "none", and chose "Map and Finish"
After linking all the approipriate fields, I then clicked on "Finish" and then "Run Upsert"
Then as it is "deploying project data", error occurs.
I have checked my java version, to make sure it is up to date.
I have uninstalled and reinstalled Java, and uninstalled and reinstalled jitterbit - still not fixed.
restarting PC did not fix the problem.
I have a Microsoft 7 machine at work, and it also gives me the same error.
Googling has not been helpful, as no results could be found.
From the entire error message below, it might be that there is something wrong with Java, but I am not sure, and would appreciate some opinion and suggestion.
Thank you very much.
The entire error message is below:
java.lang.Exception: The file "tran9015s.jtr" does not exist. Looked for it here: "1503/1495/jtr/tran9015s.jtr". [GENERIC_EXCEPTION_OTHER]
Client version: 6.0.4.3
Client platform: Mac OS X - Java 1.7.0_25
org.jitterbit.integration.client.server.IntegrationServerException: java.lang.Exception: The file "tran9015s.jtr" does not exist. Looked for it here: "1503/1495/jtr/tran9015s.jtr". [GENERIC_EXCEPTION_OTHER]
at org.jitterbit.integration.client.server.webservice.RestServiceConfiguration.convertErrorResponseToException(RestServiceConfiguration.java:183)
at org.jitterbit.integration.client.server.webservice.RestServiceConfiguration.rethrowFailure(RestServiceConfiguration.java:176)
at com.jitterbit.integration.server.api.ws.agent.SyncAgentRestApi$Worker.callServer(SyncAgentRestApi.java:71)
at com.jitterbit.integration.server.api.ws.agent.SyncAgentRestApi$Worker.syncAgent(SyncAgentRestApi.java:55)
at com.jitterbit.integration.server.api.ws.agent.SyncAgentRestApi.syncAgent(SyncAgentRestApi.java:37)
at com.jitterbit.integration.server.api.ws.deploy.DeployWorker.syncAgent(DeployWorker.java:264)
at com.jitterbit.integration.server.api.ws.deploy.DeployWorker.sendToServer(DeployWorker.java:149)
at com.jitterbit.integration.server.api.ws.deploy.DeployWorker.run(DeployWorker.java:98)
at com.jitterbit.integration.server.api.ws.deploy.ProjectDeployerWsImpl.deployProject(ProjectDeployerWsImpl.java:51)
at org.jitterbit.integration.client.project.deploy.DeployManager.sendDataToServer(DeployManager.java:134)
at org.jitterbit.integration.client.project.deploy.DeployManager.deploy(DeployManager.java:87)
at org.jitterbit.integration.client.ui.deploy.DeployJob.runImpl(DeployJob.java:40)
at org.jitterbit.application.ui.job.UiJob.callRunImpl(UiJob.java:521)
at org.jitterbit.application.ui.job.UiJob.run(UiJob.java:478)
at org.jitterbit.application.ui.job.DefaultJobManager$UiJobWrapper.run(DefaultJobManager.java:205)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
I have two servers running on Glassfish 2.1 both have the same web app.
Two times this error occurred: Some jsp pages stop displaying only showing a blank page, and the following errors are printed in the logs...
PWC1231: Servlet.service() for servlet jsp threw exception
java.io.FileNotFoundException: /path/to/jsp/file/jsp_file.jsp.java
(Permission denied) at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:179) at
java.io.FileOutputStream.(FileOutputStream.java:70) at
org.apache.jasper.compiler.AntJavaCompiler.getJavaWriter(AntJavaCompiler.java:213)
at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:173)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:409) at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at
org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:855)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:542)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
at
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
at
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:316)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at
com.my.app.filtro.FiltroCallcenter.doFilter(FiltroCallcenter.java:90)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Followed by this:
PWC6344: Unable to create output writer for file /path/to/jsp/file/jsp_file.jsp.java|#]
Sometimes only the PWC6344 error is printed and sometimes both, the PWC1231 error is always followed by PWC6344 (which somewhat makes sense, because that exception is thrown when an IOException occurs).
Well, both times this errors happened, the only thing I did was stop and start the instance, and everything was alright again, also this error has only occurred in one of the servers.
Whats is happening ?... Or how can I diagnose what is causing this so I can fix the problem instead of stopping and re starting for eternity...
UPDATES:
I was looking into the possibility of this been a file descriptor problem, as suggested by sbridges but!, the maximum number of file handlers is 811975 with 4520 opened files in one server and 359532 with only 6894 in the other.
So, I guess its safe to say this is not the problem!
Does someone have another theory?
It looks like the permissions are set incorrectly and you can't write the compiled jsp page to disk,
/path/to/jsp/file/jsp_file.jsp.java (Permission denied)
Are the permissions correct on that directory/file?
Rename jsp_file.jsp.java to jsp_file.jsp.
PWC6344: Unable to create output writer for file /path/to/jsp/file/jsp_file.jsp.java|#]
This can also happen if the underlying operating system has run out of file handlers/descriptors which are required in order to open a file for reading or writing. I'm not closely familiar with CentOS, but Google hints that it has a "relatively low" limit of 1024 given the lot of problems related to it in the search results. Among the results you'll see a lot of questions/answers as to how to increase it, such as the following blog:
Increase the number of file descriptors on Centos and Fedora Linux
Raising the number of file descriptors for a regular user on CentOS/Fedora/Redhat is surprisingly difficult to learn how to do. There are lots of incomplete walk throughs on the web, some with typos and other problems.
Here are the steps that worked for me to raise the open file descriptor limit from 1024 (the default) to 65535:
As root, edit /etc/sysctl.conf and add the line:
fs.file-max = 512000
At the bash prompt, run:
$ sysctl -p
That will cause the settings to take effect. You can also cat 512000 > /proc/sys/fs/file-max but that may reset on reboot.
Edit /etc/security/limits.conf and add the following:
* - nofile 65535
See the inline comments for more details on what that does and how to make it more restrictive if you prefer.
As root, run
$ ulimit -n 65535
and make sure you have no errors. To double check, run ulimit -n and make sure the response is 65535.
Ensure that PAM authentication is turned on for SSH, or else when you try to connect as a regular user, you won’t see the new limits. Edit /etc/ssh/sshd_config and make sure you have:
UsePAM yes
Restart SSH /sbin/service sshd restart if you made any changes.
Login as a regular user with a new SSH session & shell and run:
$ ulimit -n 65535
Run ulimit -n again to check and good luck!