We are facing this issue in production environment but unable to track it out.
Technology: JSP/Servlets,
Jetty Server Version: jetty-distribution-8.1.15,
Following is exception, what we are getting in Jetty Logs:
2014_08_10.stderrout.log.05300:
SEVERE: PWC6117: File "%2Ftmp%2Fjetty-0.0.0.0-8090-ExpireApp.war-_ExpireApp-any-%2Fwebapp%2FExpiry.jsp" not found
The application worked fine before but end users are unable to access .jsp file and we need a restart for the same but we want to get it resolved. Please help
We see things like this when there is a process in the background that cleans up tmp directories and things like that. The jsp gets compiled there and then gets scraped away and the JSP impl still believes it to be there resulting in an error like this.
Oh Sorry, i have not shared answer before.
Here it is:
Issue: By Default Jetty unpacks .WAR file in /TMP directory of Linux. The /TMP directory got cleared after some days by some scripts which i am unable to find.
Resolution: I have created another directory named βworkβ in jetty, where Jetty will unpack .WAR by default, thereby preventing jetty to unpack contents in /TMP.
So issue was unpacked contents got deleted and after restart it got created again. This time i checked unpacked content before restarting so i got what issue actually was :)
Thanks all for help
I have meet the same SEVERE: PWC6117: error, the reason is
I changed below code(Spring mvc controller)
model.addAttribute("foo", foo);
return "foo";
to just
return model;
Related
New poster here so I'll dive right in. Sorry if I miss any important information, let me know and I'll update you.
My problem is that when I go to my application: localhost:8080/GettingStartedSpringMVC/ - I get a 404 error on the screen and a 404 1034 error on the logs but that is it, no other useful information in any log I can find.
I am creating a basic Spring MVC Web application in Java. I am following the "Spring in Action" vol. 4. I have identical code including the test case, which returns success. When I go to "Export > WAR file" and put it into my local Apache instance the WAR file successfully explodes. I am able to access localhost:8080, localhost:8080/test/index.html, and even localhost:8080/GettingStartedSpringMVC/helloworld.html which are .html files I created to make sure deployment was going normally - the last one is inside the project that I cannot access. I have the logs in my apache tomcat instance but there doesn't appear to be anything useful in them - unless I don't know where to look.
If I could find an error, I would be happy to look into it but I can't manage to find anything. Not sure how to post files either - just copy/paste? If anything is needed, I'll add it.
Did you check Catalina.out and other server logs inside logs folder?
Also, double check if your static files are not in web-inf which is not accessible.
In addition, check that javac is on the path of you are using JSP
Turns out there was an error in one of the files that meant it did not scan for all the components. Also, was not able to confirm but there potentially may have been an issue with the WAR bringing necessary JAR files. I placed them in the lib file instead of relying on the Eclipse linking.
Thanks,
I understand that many people have mine problem, but the causes may be different, in fact I have not solved looking at other solutions. To be noted that initially my application tests worked!! [run as -> server (after I configure the server)]. Days ago, I move the Tomcat's folder in another root, and then, after that, there was an error for the root. I resolved this step copying tomcat's folder in the old root. But now, whe I run my application as a server, there are "HTTP Status 404 - " with no message and the descripton: "The requested resource is not available.". Moreover, in the console there are this text copyed in pastebin.com:
http://pastebin.com/kv5H2MrJ
Somebody can help me? Please
Thanks
First, you just cannot access files and (sub)folders in the WEB-INF folder directly, the servlet engine (Tomcat in your case) just won't allow you to do that. That is by specification.
Second, *.java files are not to be accessed directly, they are to be compiled and deployed.
Third, and most important: get back to the basics, and read the tutorial. Or at least this shorter one.
I got this error in Catalina.2011-03-30.log when my display.war file executed on Tomcat. The error is shown below:
Mar 30, 2011 8:01:31 PM org.apache.catalina.startup.ContextConfig init
SEVERE: Exception fixing docBase for context [/Display]
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:72)
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:72)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:48)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:70)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:71)
at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:148)
at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:886)
at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1021)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5602)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4378)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:662)
Mar 30, 2011 8:01:31 PM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file
at org.apache.naming.resources.WARDirContext.setDocBase(WARDirContext.java:135)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4249)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4418)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:662)
Thanks in advance.
Unfortunately, the cause and the solution is not that obvious as Buhake Sindi suggests. I've seen this problem several times before in several forums. I've even experienced it myself at least once. Google gives currently over 500 hits on the exact exception message. All remains unanswered. There are however hints that it works in IDE X, but not on IDE Y and that it works on Server X, but not on Server Y. Or that removing or adding something from/to the WAR works (a typical example can be found here). Nobody has however explained the real root cause in depth.
I think that it has something to do with a combination of the JDK/JRE version used and the file size of the WAR. Here are some things you can try:
Try to update/align the JDK/JRE version in your IDE and/or appserver environment.
Try to add something to the WAR, some random JAR or JSP file or whatever and then rebuild.
I've encountered the error randomly. I think the cause is quite simple.
It can happen when you create the WAR file and transfer it into the tomcat directory by a "slow" process. In my case it is a tranfer from a remote machine by scp. The tomcat can notice that the file has changed (modification date, etc.) before the transfer is over. It may then try to deploy the incomplete file. It will encounter a zip error.
The same can in theory happen if you copy the file from another directory; though the chances are smaller, since the copy is faster.
To avoid the error altogether, the file should be moved (not copied) from another location on the same disk. Such a move is (I think) atomic.
While I am developing, having the error occur every once in a while is not a big problem, though; when I encounter it I just restart the transfer.
If you are deploying on Linux then make sure it is readable by the user that the tomcat process is running as. Run "chmod +r" to the war file to add read rights to everyone.
Same problem here. war file can be opened by 7-zip.
Edit: I figured out why. "Invalid or unreadable WAR file : error in opening zip file" is definitely a confusing error message. The real reason is simply "Tomcat unable to deploy the war because there are some initializing errors". In my case, my War file is missing a few config files which throws out file not found exception. Different Tomcat version seems to report different errors. On 6.0.26, it correctly reports the error. But on 6.0.32, it reports the confusing "Invalid or unreadable WAR file".
I faced this issue, I didn't add anything or modify anything to my build. But I guess my issue raised because I was directly uploading my war file to remote tomcat7/webapps/ directory.
Solution your war file to intermediate directory like /home/yourusername or something then move to your webapps directory. Probably for me this issue raised because file was not fully uploaded yet and tomcat was trying to extract/deploy it.
Hope this will help someone.
i face same issue many times and finally i found the solution .. exact solution
anyway i was using Tomcat 8.0.9 locally for testing and when upload the war file to server i got the error message with unzipping the war .. so i checked the server Tomcat and it was 6 so i installed that version and checked the version of Java on the server and found it 5 so i also make sure that i use version 5 on my local machine.
the issue happen with how the war file packing so if you use same version and tomcat it will packed in correct way that server can understand ...
another solution .. update the server version to match the one you use locally.
they should be the same.
hope this will solve your issue.
Aby's specific problem seems to be resolved, but in case someone else stumbles onto this page with the same problem I had...
Make sure that your /opt/solr directory has the correct permissions set. I was following the SolrJetty tutorial before later moving to the Tomcat install. Because my solr user was created with this command:
useradd -d /opt/solr -s /sbin/false solr
the /opt/solr directory was created with permissions 700, so tomcat could not get to the WAR file. Change to 755 and it worked perfectly.
In my case it was file corruption during file transfer caused this issue. Hence it's always a best practice to validate the checksum of the file whenever we transfer it to a remote server.
Make sure your path to the WAR file is correct. I had a typo and this got that same error.
BalusC is right. I encountered this error when I ran my webapp on a Linux box that had the openjdk version of Java installed instead of a regular JDK. After installing a normal JDK and pointing tomcat's JRE_HOME variable to the normal JDK the problem disappeared.
I had the same problem (java.lang.IllegalArgumentException: Invalid or unreadable WAR file). For me, the cause was that I had catalina-6.0.43.jar included in my WAR file. To get rid of the error, I created a new WAR file that didn't include this jar, then Tomcat 7 was able to successfully start the application. Unfortunately, this solution only worked for Tomcat 7. I'm still getting the same error when I try to deploy the exact same WAR on Tomcat 8.
In my case I was using WinSCP to transfer the file. I tried many times with all the suggestions described here. All I did to make it work was restarting the WinSCP and the tomcat could read the file.
Thank you #BalusC. Had same issue. Tried many options. Thought this is because of lib I added to maven without prototype scope and as a result it went to war file as well, corrected, same result. I can open it as a zip and all "looks" good there.
Tried locally (different tomcat version: 7.0.67 versus 7.0.22 I have the issue with) works good. Then tried with 7.0.22 but on different VM (instance) - works good. I suspect there is something with tomcat or probably conflict with other was files (that is only difference with other VM, all including Java is same).
The issue is resolved for me using different tomcat instance.
In my case war file not downloaded properly from the repository as size is in few KB.
After corrected my download syntax started properly
The Cause is clearly shown:
java.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file
A WAR (Web ARchive) file is a zip file containing your classes, libraries and resources for your web application.
Rename your WAR file from a.war to a.zip. If you can't open the zip file using Winzip/7-Zip/WinRar, rebuild your WAR file again.
Hope this helps.
I have placed Commonsfileuploadservlet folder inside webapps. And inside that folder i have written upload.jsp
After switching on the tomcat server, while attempting to run the jsp file, the below error comes in the browser.
What might be the cause?
The requested resource (/Commonsfileuploadservlet/upload.jsp) is not available.
As requested by OP, I am reposting the comment which solved the problem as an answer:
Anything in server logs? Check for most recent log updates in Tomcat/logs folder. It might contain detail about startup errors.
I am fairly new to Tomcat. I just managed to build a project and exported it as a WAR file. I tried manually copying a WAR file to the Tomcat folder then restarting. It created the folder structure and everything but I get a 404 Status code when I try to reach the application. I tried deploying it through the Tomcat Admin panel but I'm seeing the same behavior. Am I doing anything fundamentally wrong?
Assuming that you have full privileges with the Tomcat installation, try going to http://localhost:8080/manager/html/, if you don't know the password to get into that area, look for the tomcat-users.xml file in your ${tomcat-installation}/conf directory, and that should have it. If it has no entries in it then you will want to add an entry like the following to it:
<user username="username" password="password" roles="admin,manager" />
See whether your application shows up in that screen, and if it does, click on the link and see if that gets you anywhere. If it doesn't, then I suggest following ifishers's advice, and looking at the log files to see if it lists any errors.
But long story short, most likely something is screwed up with your project's web.xml
In more recent times, this condition might occur if JAVA_HOME points to an earlier version of Java than the code in the WAR. Tomcat might use JAVA_HOME to determine JRE_HOME it shows after running startup.bat in Tomcat's BIN directory. While Tomcat may be happy itself with the Java version it gets, for the application this might not be sufficient. In my case, Tomcat 8.0.49 was running alright with JDK1.7, while the application was not initializing at all (yes, it was a Spring Boot application, WAR was being unpacked, but that's all) - without giving any errors. After setting JAVA_HOME to the location of JDK1.8, the problem was solved.
I have the same problem.
My problem is my application name and war file name are different.
I have change war file name to my application name.
Here, when your application is deployed tomcat automatically extract your war file with same name. In my case my service name is my-web-service(i.e.https://localhost:8080/my-web-service/) and my war file name is MY-java-connector-0.0.1-SNAPSHOT.war(this is my project folder name). Now tomcat is looking for my-web=service folder and it finds epicor-java-connector-0.0.1-SNAPSHOT folder. so rename the folder to my-web=service.war and it is working.
I had the same issue, my problem was that I was copying the file via sftp straight into the webapps dir of tomcat which may have caused a polling issue causing it to not deploy correctly.
Tomcat monitors the webapps dir and when it sees the .xml it will crack on and do its thing, problem is that maybe everything hasn't been copied across yet. :(
Best to create a staging folder, move or copy the war to that folder and then use linux mv command to move it into the webapps - mv is atomic so tomcat won't do anything until the operation is complete.
Magic.
Credit goes to a very very random post that I found on javarance which in turn lead to : http://pub.admc.com/howtos/tomcat/ch02.html#stagedir-section
Hope this helps someone else :)
If your'e using Spring-Boot like me to create your WAR file make sure to add the following to your main Application file.
#SpringBootApplication
public class serverTestApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(serverTestApplication.class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(serverTestApplication.class);
}
}
I was stuck on this for awhile, looked through dozens of guides. This is the video that finally showed me I never configured my application properly:
https://www.youtube.com/watch?v=05EKZ9Xmfws
My best guess is that you have not configured the welcome files in your web.xml. If you go to /app/ you need to have some default file available. Typically, people either created an index.html or they have welcome file settings to point the user to the correct jsp.
I ran into this problem, too.
My simple roundabout solution is to change docBase path.
problem occurs when
docBase=".../tomcat/webapps/app_name.war";
problem solved with
docBase=".../tomcat/webapps/app_foldername/web"
I had the same problem with tomcat and just fixed it by forcing my IDE to create a web.xml file. Mine was missing. It would deploy the project but I would still get the 404 error. I read through several of these tutorials but to no avail. I read somewhere that the web.xml file needed to be configured correctly. Went to find the web.xml in the WEB-INF folder, and there was no folder and no web.xml file. I did a quick google on how to create on using my IDE and then compiled my program with the web.xml output, and it fixed the problem for me. Hope that helps. Cheers!
FWIW I had this problem and fixed it by discovering I was accessing the wrong host, like "http://wronghost:8080/why_is_this_war_not_there" so if it says "XX.war successfully deployed" in catalina.out/localhost.*.out that may be a hint for followers.
I had the same issue. In my case there were no errors in the log files, I had a welcome page defined, it was listed in the Tomcat manager webapp, and it deployed and worked fine on my dev machine. However, visiting the app at http://example.com/myApp just returned a 404 error.
It turns out the problem was in the Apache config. Apache didn't have a mount point, so it didn't know to proxy those requests to Tomcat.
Adding in the appropriate directive fixed the problem:
ProxyPass /myApp ajp://127.0.0.1:8009/myApp
If you have not created any welcome page like index.html JSP or whatever then create one. project must have an index page. I just created one say index.html and the problem is solved..πππ
Did you try
localhost:8080/app
assuming your war file is app.war?
edit for comment -- then your web.xml is screwed up.