It seems like this must have been answered, but I just spent an hour going through old questions, some of which sound just like mine, but my issue isn't solvable by the methods given.
Basically, I've got a default installation of Apache Tomcat 7.0.50 and when I go to localhost:8080, all I get is a blank page. In fact, if I try to go anywhere on localhost:8080 (not just the default start page), I get a blank page. When I shut Tomcat down, netstat -anf inet shows nothing connected to port 8080, so only Tomcat is using that port.
catalina.2014-01-16.log contains the following at any point at which I tried to load a page:
Jan 16, 2014 1:28:18 PM org.apache.coyote.http11.AbstractHttp11Processor process SEVERE: Error processing request
java.lang.NoSuchFieldError: IS_ERROR
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:456)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
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:744)
At the exact same time, localhost.2014-01.16.log contains this stack trace (which I shortened because you don't need the whole thing):
Jan 16, 2014 1:28:18 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception
[javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.tomcat.util.http.parser.HttpParser.parseMediaType(Ljava/io/StringReader;)Lorg/apache/tomcat/util/http/parser/MediaType;] with root cause
java.lang.NoSuchMethodError: org.apache.tomcat.util.http.parser.HttpParser.parseMediaType(Ljava/io/StringReader;)Lorg/apache/tomcat/util/http/parser/MediaType;
at org.apache.tomcat.util.http.parser.MediaTypeCache.parse(MediaTypeCache.java:54)
at org.apache.catalina.connector.Response.setContentType(Response.java:805)
at org.apache.catalina.connector.ResponseFacade.setContentType(ResponseFacade.java:245)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:51)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at ...
I note it's a NoSuchMethodError. It seems like I must have a strange mix of libraries, but it's a default installation. I'm at a complete loss.
What version of jdk did you use to run tomcat? Was it OpenJDK, Oracle JDK? Try running tomcat using Oracle JDK 1.6 or 1.7
What OSX user did you use to run tomcat? Have you made sure it has all sufficient permission to read/write files into the directory?
Resolved. It turned out that someone had copied some other libraries into the Tomcat lib directory and I didn't realize it when upgrading. These other libraries are not compatible with Tomcat 7. Removing the offending jars fixed the issue.
Related
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.
im getting this error when starting my tomcat 7
can someone help me?
Mar 03, 2014 5:07:31 PM org.apache.catalina.startup.Bootstrap initClassLoaders
SEVERE: Class loader creation threw exception
java.io.IOException: Invalid argument
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.Win32FileSystem.canonicalize(Unknown Source)
at java.io.File.getCanonicalPath(Unknown Source)
at java.io.File.getCanonicalFile(Unknown Source)
at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:171)
at org.apache.catalina.startup.Bootstrap.createClassLoader(Bootstrap.java:176)
at org.apache.catalina.startup.Bootstrap.initClassLoaders(Bootstrap.java:103)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:208)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:406)
not sure if this is your problem but I received a similar error trying to starup Tomcat 6.
The problem was caused by this line in the catalina.properties file:
shared.loader=${catalina.base}/lib/*.jar,${catalina.base}/shared/classes,${catalina.home}/shared/lib/*.jar
You cant see it but there is an unprintable character following the *.jar which was being read as an invalid argument.
After I deleted that character Tomcat came up sucessefully.
I had a similar issue and it was a ending back slash issue \ in CATALINA_HOME environment variable.
https://stackoverflow.com/a/22209500/1383538
Maybe a bit late; but for anyone else who may have this problem; it
turned out i had put a backslash \ at the end on my CATALINA_HOME
environment variable (I was using windows). When i removed it, i could
start using catalina run command.
https://stackoverflow.com/a/28261336/1383538
Had a similar issue with Tomcat 8 and Java 8 on Windows 8, and after
little bit of playing around, I noticed that CATALINA_HOME was set as
"CATA_HOME=c:\mydir\tomcat.8.0\"
I just changed it to CATA_HOME=c:\mydir\tomcat.8.0" and it fixed all
the issues. I never thought ending back slash would cause the issue
but there you are...it did!!!
We are getting the following error in catalina.out file when we restart our application with newrelic java agent configured.
We have followed the steps specified in newrelic installation guide and following is the entry created in catalina.sh by newrelic installer:
# ---- New Relic switch automatically added to start command on 2013 Dec 09, 20:24:35
NR_JAR=/usr/share/fk-ops-tomcat6-base/newrelic/newrelic.jar; export NR_JAR
JAVA_OPTS="$JAVA_OPTS -javaagent:$NR_JAR"; export JAVA_OPTS
Exception on app restart in catalina.out:
Error bootstrapping New Relic agent: java.lang.RuntimeException: java.io.IOException: No such file or directory
java.lang.RuntimeException: java.io.IOException: No such file or directory
at com.newrelic.bootstrap.BootstrapLoader.load(BootstrapLoader.java:95)
at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1704)
at java.io.File.createTempFile(File.java:1792)
at java.io.File.createTempFile(File.java:1828)
at com.newrelic.bootstrap.BootstrapLoader.getJarFileInAgent(BootstrapLoader.java:81)
at com.newrelic.bootstrap.BootstrapLoader.addBridgeJarToClassPath(BootstrapLoader.java:47)
at com.newrelic.bootstrap.BootstrapLoader.load(BootstrapLoader.java:92)
... 7 more
I just encountered the same problem. The not very helpful error message alluded to the fact that the newrelic agent (or rather the user under which my server is running) wasn't able to write into /tmp. Maybe that helps!
I hit that exception with that stack trace recently, and in my case it was caused by the temporary directory not existing at all.
In particular: by default tomcat uses $CATALINA_BASE/temp as value for the java.io.tmpdir property, and seems to create that when needed. At the time the newrelic agent boots up however it may not yet exist, and so newrelic agent fails with that exception.
After restarting things are fine (now the directory exists!), but I solved in my startup scripts:
1. set the value of CATALINA_TMPDIR explicitly to something I control
2. ensure that directory exists before starting tomcat.
Make sure the newrelic.yml placed and marked readable in the same directory as the .jar
I work for New Relic.
As you've seen from the answers above, there can be multiple causes for this kind of message - some of which are pretty unexpected. Since this forum is not intended for back-and-forth messaging about incidents, in case neither of the previous two answers solved the problem for you, your best bet will be to open a ticket for support at http://support.newrelic.com where we can ask to look at your logfile and gather debug logs as necessary.
I had the same problem using apache version 6.0.33. Once I upgraded to 7.0.53 everything worked.
save problem.
But I found this:
Sep 09, 2015 11:19:48 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /mnt/apache-tomcat-7.0.56/temp
then doing this:
mkdir /mnt/apache-tomcat-7.0.56/temp
cp /mnt/apache-tomcat-7.0.56/newrelic/* /mnt/apache-tomcat-7.0.56/temp
Everything works.
You may not need cp.
If you look at very early of Tomcat log (catalina.out) after NewRelic exception, you can see what folder is required that are missing. Here is mine:
May 29, 2017 5:04:31 PM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /var/log/tomcat/tomcat7/temp
May 29, 2017 5:04:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.59
Hope this help
I have my war running on tomcat in a context path - say /path1.
I've made some more changes to my codebase, added more classes, jars etc, and now without disturbing the first war that is running on /path1, i want to add this war to /path2.
Can this be done?
Because when I tried this the second war is failing to start when spring loads -
SEVERE: Error listenerStart
Feb 7, 2011 4:46:44 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/path2] startup failed due to previous errors
And there is no stack trace or anything though i've set log level to debug.
I think there is no problem with the code because when I run this on my local machine and on a server where the first one is not running it works fine. When i try to run this on the server with /path1 active then it fails.
Thanks!
The 'listenerStart' bit suggests that the error is in a ServletContextListener, so if you have any of those in your code, take a hard look, and see what they're doing; are they accessing any resources that the other instance might then try to share?
Tomcat fails to start even if i remove all my applications from the WEBAPPS directory leaving everything just like after the OS installation.
The log (catalina.out) says:
Using CATALINA_BASE: /usr/share/tomcat5
Using CATALINA_HOME: /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
Created MBeanServer with ID: -dpv07y:fl4s82vl.0:hydrogenium.timberlinecolorado.com:1
java.lang.NoClassDefFoundError: org.apache.catalina.core.StandardService
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.newInstance(libgcj.so.7rh)
at org.apache.catalina.startup.Bootstrap.init(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.modeler.Registry not found in org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/server/classes/,file:/usr/share/java/tomcat5/catalina-cluster-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-storeconfig-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-optional-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-coyote-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-jkstatus-ant-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-ajp-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-default-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-invoker-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-ant-jmx-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-http-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-util-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-apr-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/servlets-webdav-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-5.5.23.jar], parent=org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/common/classes/,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-ja.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-fr.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-en.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-es.jar,file:/usr/share/java/tomcat5/naming-resources-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/naming-factory-5.5.23.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/lib/jvm/java/lib/tools.jar,file:/usr/share/tomcat5/bin/bootstrap.jar,file:/usr/share/tomcat5/bin/commons-logging-api.jar,file:/usr/share/java/mx4j/mx4j-impl.jar,file:/usr/share/java/mx4j/mx4j-jmx.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
...5 more
Seems like you've implemented a JMX service and tried to install it on your server.xml file but forgot to add the apache commons modeler jar to the server/lib directory (therefore the ClassNotFoundException for org.apache.commons.modeler.Registry). Check your server.xml file for anything you might have added, and try to add the proper jar file to your server classpath.
This screams class path issue, to me. Where exactly is your tomcat installed? (Give us command line printouts of where the home directory is.) Also, how are you starting it?
Seems like you need to have the jar for commons-modeler into $CATALINA_HOME/common/lib. You get the same kind of error when trying to setup JDBC datasources if you didn't put the driver's jar file into tomcat's server classpath.
Check your JAVA_HOME/JRE_HOME setting. You might want to use a different JVM rather than the one that is installed with the OS