I'm using ubuntu 9.10 and I installed java and tomcat using the package manager. When I went to run startup.sh, it first complains about catalina.out not being there and not being writable. I fixed that and it doesn't complain about that (why isn't that included in the install??) Now it's complaining about server.xml not being there when I shut down the server. Here is my output from command line:
user#desktop:/usr/share/tomcat6$ ./bin/startup.sh
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr/lib/jvm/java-6-sun-1.6.0.15
user#desktop:/usr/share/tomcat6$ ./bin/shutdown.sh
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr/lib/jvm/java-6-sun-1.6.0.15
Dec 11, 2009 4:42:57 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.io.FileNotFoundException: /usr/share/tomcat6/conf/server.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:407)
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 org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:337)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
user#desktop:/usr/share/tomcat6$
I'm really new to tomcat so this might be a dumb question, but why isn't there a sample server.xml in a fresh install of tomcat? What can I put in there to shut it up... even if its just a stub and a +1 to any one who can explain to me the structure of this file?
Try using server.xml located at:
/etc/tomcat6/server.xml
server.xml is the configuration file for the application server. It contains stuff like what port is the server going to listen at, where are the applications being deployed, and other related stuff.
More info on Tomcat in Ubuntu:
https://help.ubuntu.com/12.04/serverguide/tomcat.html
Related
I am using JNDI + HikariCP on Tomcat 9.0.7 with the following configuration :
<Resource name="jdbc/mydb" auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
minimumIdle="5"
maximumPoolSize="20"
connectionTimeout="300000"
dataSourceClassName="com.microsoft.sqlserver.jdbc.SQLServerDataSource"
dataSource.url="jdbc:sqlserver://server:1433;databaseName=mydb"
dataSource.user="fantomas"
dataSource.password="somepassword"
closeMethod="close"
/>
When I run tomcat without any of my WAR deployed (just standard installation, nothing more), I have the following WARNING in Catalina log:
09-May-2018 10:15:16.971 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [host-manager] appears to have started a thread named [mssql-jdbc-TimeoutTimer-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)
java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1073)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
What is wrong and why there is a leak ? How can I fix it ?
UPDATE-1
Custom libraries in ./lib of Tomcat installation are:
ms-sql-6.4.0.jre8.jar
slf4j-api-1.7.25.jar
HikariCP-2.7.8.jar
UPDATE-2
Same problem also with Hikari 3.1.0 & Tomcat 9.0.8
The thread in question (mssql-jdbc-TimeoutTimer) belongs to the MSSQL driver. It shows up when you use HikariCP, but not Tomcat JDBC, because HikariCP appropriately uses JDBC timeout APIs for reliability.
This is a known issue with the MSSQL driver, search for 'mssql-jdbc-TimeoutTimer' here.
It seems that the timer is started by HikariCP's call to the MSSQL driver implementation of Connection.isValid(). So, you may be able to avoid the issue by setting a connectionTestQuery, which will disable the use of isValid().
Related issue with similar leak reported to hikari and it seems that the final solution doesn't use Hikari JNDI factory but Tomcat's Datasource
Try to change the factory to:
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
EDIT
You created a new issue for Hikari
I'm developing app on GAE, I test the website locally fine however, every time I tried to deploy it to the GAE it reports with
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
I searched a lot in google, seems no answer could solve my question. When I look for the log in the GAE app, following is the major problem I found so far. Initially, I thought it's due to JDK8 but when I set JDK8 I can't even run the app locally!
Uncaught exception from servlet
java.lang.UnsupportedClassVersionError: org/apache/jsp/index_jsp : Unsupported major.minor version 52.0
at com.google.appengine.runtime.Request.process-aea5c804a9f29902(Request.java)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:795)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.lang.ClassLoader.loadClass(ClassLoader.java:360)
at org.mortbay.util.Loader.loadClass(Loader.java:91)
at org.mortbay.util.Loader.loadClass(Loader.java:71)
at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:242)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:188)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
at java.lang.Thread.run(Thread.java:724)
This is the telltale: Unsupported major.minor version 52.0. This happens when you compile on higher version JDK (52 = java8) and then execute it on lower JRE version (GAE uses java7).
GAE does not yet support Java8, so you should compile under Java7.
I had the same problem on Windows when Java 8 was installed.
I tried modifying the project/workspace settings but it didn't help me.
So, I created the following batch file as a workaround for GAE projects:
eclipse_gae.bat:
SET JAVA_HOME="C:\Program Files\Java\jdk1.7.0_55"
SET PATH="%JAVA_HOME%\bin"
START eclipse.exe
there is no need to fully remove Java 8 from MacOS. Just reconfigure Eclipse as shown here to force it to compile JSPs as Java 7:
http://java.wildstartech.com/Java-Platform-Standard-Edition/mac-os-x-java-development/how-to-configure-eclipse-to-run-with-java-7-when-java-8-is-installed
Make sure, that the version of Project Properties -> Project Facets -> Java is set to 1.7 and not to 1.8.
This is also nicely explained in the plugin's documentation section 'Changing the JDK Compliance Level'
I ran into a similar issue now. My setup is OS X + JDKs 6, 7 and 8, and in my eclipse.ini I had:
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java
Apparently it will use that compiler no matter what you set in global/project preferences (I even removed JDK 8 from the Installed JRE list, no success).
Once I've changed that to use JDK 7 and redeployed my GAE app, it worked.
You have to compile with Java 1.7. But if you have *.jsp files, you should also completely remove Java 1.8 from the system. If you use Mac, here is how you can do it.
If you are using gradle (e.g. Android Studio) on a mac, you can work around this problem by adding the following lines to the top of your gradlew script:
# Insist on java 7
JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
Variations of this method should work on other platforms.
I'm sure this has been resolved, but here is the solution
GAE runs on java7 (as indicated by Mr. Knego) so maven must be compiling with java7. Do the following:
I prefer to do all this in the terminal
Edit bash profile:
touch ~/.bash_profile; open ~/.bash_profile
Set Java Home Directory
#set JAVA_HOME
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
export JAVA_HOME
# For Apache Maven Commands
export M2_HOME=/Users/your-username/your/path/to/maven/apache-maven-3.3.3
export PATH=$PATH:$M2_HOME/bin
Navigate to your project folder (with pom.xml) and reinstall a clean version of maven
mvn clean install
Navigate to EAR or WAR directory and deploy with a new runtime
mvn appengine:update
If you are using endpoints, you should update your endpoint libraries
I ran the mvn war:war in the command prompt, I then went to upload to appengine using appcfg update and I got this error. The app works on localhost. Aside from the path simply being wrong, there is no appengine-web.xml. Any help would be appreciated thankyou.
C:\appengine-java-sdk\bin>appcfg update C:\mirror-quickstart-java-master
Reading application configuration data...
Aug 31, 2013 7:10:33 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
SEVERE: Received exception processing C:/mirror-quickstart-java-master\WEB-INF/appengine-web.xml
com.google.apphosting.utils.config.AppEngineConfigException: Could not locate C:\mirror-quickstart-java-master\WEB-INF\appengine-web.xml
at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:140)
at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:75)
at com.google.appengine.tools.admin.Application.<init>(Application.java:182)
at com.google.appengine.tools.admin.Application.readApplication(Application.java:319)
at com.google.appengine.tools.admin.AppCfg.readWar(AppCfg.java:279)
at com.google.appengine.tools.admin.AppCfg.readApplication(AppCfg.java:270)
at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:208)
at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:121)
at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:117)
Caused by: java.io.FileNotFoundException: C:\mirror-quickstart-java-master\WEB-INF\appengine-web.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:137)
... 8 more
Bad configuration: Could not locate C:\mirror-quickstart-java-master\WEB-INF\appengine-web.xml
Caused by: C:\mirror-quickstart-java-master\WEB-INF\appengine-web.xml (The system cannot find the path specified)
Please see the logs [C:\Users\Hasan\AppData\Local\Temp\appcfg4724142030047376778.log] for further information.
The latest version of the mirror-quickstart-java that supports Google App Engine has been tagged with app-engine; you should use this specific release.
I am having difficulty getting to the starting line on my machine.
1) Windows 7 32bit all service packs installed
2) Installed JDK 1.7.0_21
3) Checked PATH that only one copy of JDK\bin is in path and that it is correct.
4) Installed Eclipse Juno Java bundle. eclipse-java-juno-SR2-win32.zip
5) Install Google App Engine SDK per the tutorial using:
https://dl.google.com/eclipse/plugin/4.2
Selected:
- Google Plugin for Eclipse
- GWT
- SDK
Did NOT select:
- Developer Tools (Android)
- Google App for Android
- NDK Plugins
6) Following the tutorial, pull down the Google Icon and select "New Web Application Project"
- Name it Guestbook as shown
- Uncheck GWT
- Check Google App Engine
- Finish
7) Following the tutorial, Run as Web Application
At this point, the console shows several successful steps and then crashes and burns with jetty unable to establish a loop back connection. The full console output is attached below. I have searched all over the web and have not been able to find anything. I checked PATH and JDK. I checked the Windows firewall rule for Eclipse, it looks OK. I looked at the Classpath tab but could not see anything obviously wrong (although I don't know what it is supposed to look like)
Full Console Output
Jun 15, 2013 2:56:51 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed E:\User Data\Dave\Documents\Google App Engine Scratch\Guestbook\war\WEB-INF/appengine-web.xml
Jun 15, 2013 2:56:51 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed E:\User Data\Dave\Documents\Google App Engine Scratch\Guestbook\war\WEB-INF/web.xml
Jun 15, 2013 2:56:51 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
INFO: Overwriting system property key 'java.util.logging.config.file', value 'E:\Eclipse Google App Engine\eclipse\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.8.1\appengine-java-sdk-1.8.1\config\sdk\logging.properties' with value 'WEB-INF/logging.properties' from 'E:\User Data\Dave\Documents\Google App Engine Scratch\Guestbook\war\WEB-INF\appengine-web.xml'
Jun 15, 2013 2:56:51 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Jun 15, 2013 7:56:52 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
Jun 15, 2013 7:56:54 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed org.mortbay.jetty.nio.SelectChannelConnector$1#15321fc: java.io.IOException: Unable to establish loopback connection
Jun 15, 2013 7:56:54 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed SelectChannelConnector#127.0.0.1:8888: java.io.IOException: Unable to establish loopback connection
Jun 15, 2013 7:56:54 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed Server#150305e: java.io.IOException: Unable to establish loopback connection
java.io.IOException: Unable to establish loopback connection
at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.ch.PipeImpl.<init>(Unknown Source)
at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source)
at java.nio.channels.Pipe.open(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
at java.nio.channels.Selector.open(Unknown Source)
at org.mortbay.io.nio.SelectorManager$SelectSet.<init>(SelectorManager.java:312)
at org.mortbay.io.nio.SelectorManager.doStart(SelectorManager.java:223)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:314)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.Server.doStart(Server.java:235)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:249)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:307)
at com.google.appengine.tools.development.AutomaticServerInstanceHolder.startUp(AutomaticServerInstanceHolder.java:26)
at com.google.appengine.tools.development.AbstractServer.startup(AbstractServer.java:80)
at com.google.appengine.tools.development.Servers.startup(Servers.java:82)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:237)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:339)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:274)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:250)
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Unknown Source)
at sun.nio.ch.Net.connect(Unknown Source)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
... 26 more
PROBLEM SOLVED!
I was able to absolutely nail the cause of this problem and fix it.
What I did was removed the JRE and JDK from "C:\Program Files\Java\" (which is where Oracle's installer puts them by default) and reinstalled them in "C:\Java\Java7\" Apparently something in Eclipse and/or the Google Android development kit is still sensitive to spaces in the pathname to the JDK. This is an ancient general problem with Eclipse reported around 2005.
I did NOT need to drop down to Java 6
I did NOT need to edit Eclipse.ini and add a -VM line
I did NOT need to manually add the path to the jdk to PATH
Hope this helps the next person because this is an incredibly frustrating problem when you encounter it.
Thanks!
David Hetherington
Problem: Trying to run the 'Hello World' app using google eclipse plugin (eclipse - Kepler).
Solution: Adding to David's answer. If you have multiple jre's installed make sure the jre you are pointing to does not have a space in the absolute path. To change the jre you are pointing to go to eclipse - window->preferences->server->runtime environments->google app engine->edit. Now check the jre version you are pointing to. In my case I had jdk 1.7 installed in Program Files/Java and jre6 and jre7 installed in the same location. I moved jdk 1.7 to Program_files but was still getting the loopback error. Followed the above steps and pointed the jre version to the one in jdk1.7/jre in Program_files/java as earlier it was pointing to C:/Program Files/java/jre7
Hope this helps someone.
Are you sure you don't have anything else running with the same PORT number as the web-application? Default webapplication PORT is 8888
I am trying to run Apache Nutch on Windows for web crawling.I have installed cygwin and set its Path .But I am getting the following exception :
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-cjindal\mapred\staging\cjindal-330065706\.staging to 0700
at org.apache.hadoop.fs.FileUtil.checkReturnValue(FileUtil.java:682)
at org.apache.hadoop.fs.FileUtil.setPermission(FileUtil.java:655)
at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:509)
at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:344)
at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:189)
at org.apache.hadoop.mapreduce.JobSubmissionFiles.getStagingDir(JobSubmissionFiles.java:116)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:856)
at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1083)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850)
at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:824)
at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1261)
at org.apache.nutch.crawl.Injector.inject(Injector.java:217)
at org.apache.nutch.crawl.Crawl.run(Crawl.java:127)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.nutch.crawl.Crawl.main(Crawl.java:55)
I have not installed hadoop. Please help.
It is better to run Nutch on Unix. But if you want to run it on windows then probably you can download 1.2 version of Nutch which comes with Hadoop version which does not have this issue.