I am trying to deploy an application using spring in tomcat7 running on ubuntu12. When I drop the war file in the webapps directory, the directory is created for the application inside webapps - yet the application does not load up. Latest issue is copied below. Any thoughts on troubleshooting this will be appreciated.
Java versions are the same on the computers where the war file was generated vs the one where I am deploying the application. I do not see a file permission issue - there is a logging.properties file in tomcat7.
Jan 31, 2014 10:43:05 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jan 31, 2014 10:43:05 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/test-webapp] startup failed due to previous errors
Jan 31, 2014 10:43:05 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/test-webapp] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
Update:
I missed an error message. I will update this ticket shortly.
Update:
I was missing a file in tomcat meant for the application deployment - pilot error. Thanks to everyone for sharing their thoughts- much appreciated!
It looks like a known issue of MySQL over tomcat, have you tried yet any of the suggested solutions in
http://bugs.mysql.com/bug.php?id=69526
http://bugs.mysql.com/bug.php?id=68556
?
Related
I have an embedded tomcat (7.0.64) on MAC and am deploying a war file, running on java 1.7.067. For some reason my tomcat server hangs on the call "Tomcat.start()".
I know for sure that it's getting stuck deploying the war file. The way i figured this i plugged in a different war file(a simple hello world) and that worked.
I tried hooking up tomcat log.properties and got the logs directed to file with hope of getting any clues. But i don't see any exception, the logging stops at these lines,
FINE: Loading class from parent
Nov 16, 2015 9:30:01 PM org.apache.catalina.loader.WebappClassLoader loadClass
FINE: Loading class from parent
Nov 16, 2015 9:30:01 PM org.apache.catalina.loader.WebappClassLoader loadClass
FINE: loadClass(com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl, false)
Nov 16, 2015 9:30:01 PM org.apache.catalina.loader.WebappClassLoader loadClass
FINE: loadClass(com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl, false)
Nov 16, 2015 9:30:01 PM org.apache.catalina.loader.WebappClassLoader loadClass
FINE: loadClass(com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl, false)
Nov 16, 2015 9:30:01 PM org.apache.catalina.loader.WebappClassLoader loadClass
FINE: loadClass(com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl, false)
Not sure if it can't find "DTDDVFactoryImpl", since this is part of the jdk libraries itself as well as i am including xercesimpl.jar as well.
Basically i am looking for ways that can help me figure out, what or which class is blocking from the web deployment from happening.
Any ideas/pointers?
TIA
Updated - My log.properties looks like,
handlers=java.util.logging.ConsoleHandler, org.apache.juli.FileHandler
org.apache.juli.FileHandler.level=ALL
org.apache.juli.FileHandler.directory=./logs
org.apache.juli.FileHandler.prefix=tomcat-
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
org.apache.catalina.level=FINEST
org.apache.catalina.handlers=org.apache.juli.FileHandler
the line -
FINE: loadClass(com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl, false)
The above message means that a web application have already been
stopped, but the TimerTask tries to load a class from it.
What web application has started this timer?
If the timer was started by this web application, then it is your
fault. You should have configured a
javax.servlet.ServletContextListener to stop (cancel) the timer when
the web application stops. You cannot load classes when web
application have already been stopped.
OR
If the timer was started by a different web application, it means
that you have PermGen memory leak somewhere. Ensure that you have
JreMemoryLeakPreventionListener configured in server.xml.
It is known that there was a PermGen memory leak in Java XML APIs. A
workaround to suppress it was added to JreMemoryLeakPreventionListener
in r884341 [1]
Mark has a presentation on Memory Leaks
http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf
OR
Bundling a separate copy of Apache Xerces with the web application
may help. It will not help if the root cause is your failure to cancel
the timer.
[1] http://svn.apache.org/viewvc?view=revision&revision=r884341
hope this helps.
I have a Java servlet web app (.war) which I deployed to Tomcat Ubuntu server.
Can I change the content the Java classes at: myProject/WEB-INF/classes/
without re-export-and-deploy the entire app ?
Thanks in advance.
I could thought of below to re deploy your app without restarting tomcat:
Modify your java file
Generate .class file
Replace it with your existing file in Tomcat
Trigger your app restart by touching WEB-INF/web.xml
Disclaimer: I don't recommend doing this because it can give unexpected results. I am aware that sometimes you need to do "quick-and-dirty" fix, but consider yourself warned :)
I assume you have a Web application, let's call it 'MyApp'. Go to <TOMCAT-DIR>/webapps and locate your MyApp.war file. Put new .class file into the MyApp.war (open it with some archiver) and then delete the folder <TOMCAT-DIR>/webapps/MyApp. Deleting the folder means undeployment for Tomcat. After some time, Tomcat will figure out that it has a .war file in his <TOMCAT-DIR>/webapps folder that needs to deploy and it will automatically do it. You will see in Tomcat's log something like:
Aug 25, 2015 9:24:55 AM org.apache.catalina.startup.HostConfig undeploy
INFO: Undeploying context [/MyApp]
Aug 25, 2015 9:24:55 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /home/tomcat/apache-tomcat-7.0.55/webapps/MyApp.war
Aug 25, 2015 9:25:17 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /home/tomcat/apache-tomcat-7.0.55/webapps/MyApp.war has finished in 21,937 ms
And there you go, you just refreshed your application without redeployment and without restarting server.
I've deployed two instances of the same Grails app in Tomcat7. I've used the following to create wars, using environments in config files:
grails -Dgrails.env=instance1 war
grails -Dgrails.env=instance2 war
I use setenv.sh for extra configurations and settings for JAVA_OPTS.
First instance runs correctly. The second gives me the following error:
Error 500: Internal Server Error
URI
/instance2/
Class
java.lang.IllegalStateException
Message
No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
Trace
Line | Method
->> 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Any suggestion?
EDIT:
I've tried to deploy a third instance with a different name. It works correctly. So I've undeployed and redeployed it into Tomcat, but it does not work...
I'm going crazy, because it seems that the app name has an influence...
I've deployed the application using the following:
grails -Dgrails.env=nameofapp war
where nameofapp is the name of the application
I'm using Grails 2.2.1 version
EDIT 2:
I've understood that the problem occurs when an app is deployed for the first time. Infact, when first deploy into Tomcat occurs, I see the following in catalina.out:
java.lang.NullPointerException
at medicalofficemanager.SecUserSecRole.create(SecUserSecRole.groovy:32)
at BootStrap$_closure1.doCall(BootStrap.groovy:61)
at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:308)
at grails.util.Environment.executeForEnvironment(Environment.java:301)
at grails.util.Environment.executeForCurrentEnvironment(Environment.java:277)
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:722)
Jan 18, 2015 5:49:49 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jan 18, 2015 5:49:49 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/MyAppName] startup failed due to previous errors
Jan 18, 2015 5:49:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/MyAppName] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Jan 18, 2015 5:49:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyAppName] appears to have started a thread named [net.sf.ehcache.CacheManager#d5381] but has failed to stop it. This is very likely to create a memory leak.
Jan 18, 2015 5:49:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyAppName] appears to have started a thread named [myapp.SecRole.data] but has failed to stop it. This is very likely to create a memory leak.
Jan 18, 2015 5:49:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyAppName] appears to have started a thread named [org.hibernate.cache.UpdateTimestampsCache.data] but has failed to stop it. This is very likely to create a memory leak.
Jan 18, 2015 5:49:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyAppName] appears to have started a thread named [org.hibernate.cache.StandardQueryCache.data] but has failed to stop it. This is very likely to create a memory leak.
Jan 18, 2015 5:49:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyAppName] appears to have started a thread named [net.sf.ehcache.CacheManager#13e45] but has failed to stop it. This is very likely to create a memory leak.
Jan 18, 2015 5:49:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyAppName] appears to have started a thread named [aclCache.data] but has failed to stop it. This is very likely to create a memory leak.
Jan 18, 2015 5:51:13 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load net.sf.ehcache.store.compound.CompoundStore$KeySet. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1587)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
at net.sf.ehcache.store.compound.CompoundStore.keySet(CompoundStore.java:216)
at net.sf.ehcache.store.compound.factories.DiskStorageFactory$DiskExpiryTask.run(DiskStorageFactory.java:670)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
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:722)
I think that first exception (about SecUserSecRole) it is not relevant...
If I undeploy and redeploy the same war, without cleaning the database, the application starts correctly.
What about this stacktrace?
There is a problem in this line: grails -Dgrails.env=instance1 war
-Dgrails.env should be set to the environment name eg: dev, test, prod or myCustomEnv, not the name of the application.
This setting tells Grails to look up the settings in the environment section of DataSource.groovy and Config.groovy under the name supplied and apply them. If they do not exist who knows what you will end up with.
As you can see in your stacktrace you are getting a null pointer exception when Grails is trying to execute the environment block. This is because the value you have given it does not exist.
Your problem appears to be in SecUserSecRole.groovy:32. I'd be willing to bet that is the spot where your app first tries to do DB access. Can you post the relevant section of SecUserSecRole.groovy as well as details on your DB configuration?
I am trying to load a WAR file to my Tomcat 7,
and I am using eclipse to start or stop the Server.
I pasted the war file in TOMCAT_HOME/webapps folder and I started the server.
The server Started fine and i got the below console message.
10 Dec, 2012 9:10:46 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\Program Files\Java\jdk1.6.0_37\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;F:/Program Files/Java/jre6/bin/client;F:/Program Files/Java/jre6/bin;F:/Program Files/Java/jre6/lib/i386;C:\Program Files\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Windows Live\Shared;C:\Program Files\QuickTime\QTSystem\;.;F:\Program Files\Java\jdk1.6.0_37\bin;F:\apache-maven-3.0.4\bin;;F:\eclipse-juno;;.
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8090"]
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
10 Dec, 2012 9:10:46 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 484 ms
10 Dec, 2012 9:10:46 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
10 Dec, 2012 9:10:46 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.33
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8090"]
10 Dec, 2012 9:10:46 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
10 Dec, 2012 9:10:46 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 211 ms
But when i try to access my application it gave me ERROR 404, File not Found.
I checked the application TOMCAT_HOME/webapps there i found both my war file and a folder of same name - "JavaServerFaces"
TOMCAT_HOME/webapps directory :
The Server is ON, war file is present, A folder structure is generated, but still i am not able to access my application which gives
HTTP Status 404 - /JavaServerFaces/xhtml/hello.xhtml
Any solutions for proper deployment and running of war file on tomcat 7?
In your console message, I do not find the deploying of "JavaServerFaces.war".
In eclipse,
open your server setting file,under "Server Location " check if the option "Use tomcat installation (.......) ".
if it is checked, then check the deploy name if it "webapps". if not then, change it to "webapps".
And if, this all are correct, then possibly your .war file is making fault.
There is problem with tomcat to start or stop with eclipse.
Its best to start and stop tomcat with the bat files in bin folder.
There are 3 steps to find error
1) copy the folder name which contains all application file and paste it into url. Now copy your servlet application url from web.xml and paste after folder name. If that works that means your Servlet application have some error..see the server console
2)On clicking on your application name in Manager App, and then your html file didn't run then there must be error in you your xml file try to rename your html file to index.xhtml
3)4** error shows that there is an error on xml or html file. while 5** series error shows there is error in your tomcat server.
Check the server setting in your eclipse. Check where the Configuration path is pointing. Also notice the Server location. By default it's Workspace Metadata, so set it to Tomcat Installation in your case.
suddenly for some reason tomcat server is not runnin/starting/stopping.
below is the result I get when i run the startup command,
C:\Program Files\jasperserver-3.5.0\apache-tomcat\bin>startup
Using CATALINA_BASE: C:\Program Files\jasperserver-3.5.0\apache-tomcat
Using CATALINA_HOME: C:\Program Files\jasperserver-3.5.0\apache-tomcat
Using CATALINA_TMPDIR: C:\Program Files\jasperserver-3.5.0\apache-tomcat\temp
Using JRE_HOME: C:\PROGRA~1\JASPER~1.0\java\jre
The tomcat window pops up for a split of a second and goes away.
(I have another java instance installed under c:\program files)
Help!!!
Update:
Logs from catalina file
Mar 22, 2011 3:41:50 AM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Mar 22, 2011 3:41:50 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1017 ms
Mar 22, 2011 3:41:51 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 22, 2011 3:41:51 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.20
Mar 22, 2011 3:41:51 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Mar 22, 2011 3:42:06 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 22, 2011 3:42:06 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 22, 2011 3:42:06 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/43 config=null
Mar 22, 2011 3:42:06 AM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Mar 22, 2011 3:42:06 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 15374 ms
Use catalina.bat run instead of startup.bat. Then the window won't go away and you can see what's going on
In my case that was a problem with final slash in %CATALINA_HOME% path: final slash should not be there!
C:\tomcat\8.0.30 - correct
C:\tomcat\8.0.30\ - wrong
See http://blackandwhitecomputer.blogspot.de/2015/09/tomcat-debug-cannot-startup.html
Honestly, I had not expected modern applications may be depended on final slash in environment variable path!
I ran into a similar problem. I open cmd prompt and cd to tomcat\bin\startup.bat. The issue was my JRE_HOME not defined in the environment variables. I added and it worked.
I had the same problem and I solved it this way:
First, following #ykaganovich suggestions, I tried to start the server using the catalina.bat start command; it did not solve the problem, but at least it showed a log that specified the error, which was really helpful.
In my case, the log said that the problem was because of the java versiĆ³n. I had the JAVA_HOME variable pointing to the JDK7, but my tomcat version needed it to point to the JDK8.
I changed the JAVA_HOME variable to point to JDK8 (instead of JDK7) and then , when I executed the catalina.bat start command again, it worked perfectly and the server started. I hope my suggestion could be helpful to someone.
Hmm it's very strange problem because in the log you have that server started, so try this:
restart computer :) - the best solution for strange situations
change tomcat port
close every unnecessary applications: skype, ip phones etc (I've encountered similar problem someday and application ip phone "softly" blocked this port ("softly" - in tomcat log everything was OK but in reality webapp doesn't work)
Add tomcat in your eclipse and start it from there. Configure tomcat as 'Use Tomcat installation'. It will work
Had same problem with apache Tomcat 9 version.
Solution very simple.
Apache Tomcat 9 is supported by Java 8 and later versions.
So, i had JRE_HOME with JRE7 path, I binded it to new JRE8 and everything works fine.
Different versions of Apache Tomcat are available for different versions of the Servlet and JSP specifications. The mapping between the specifications and the respective Apache Tomcat versions is:
Hope this will work for you guys, cheers!
If Tomcat was earlier working fine and Tomcat not starting happens unexpectedly, it's because some other process has started using the port you were using Tomcat on. In my case, I had shutdown Tomcat and was trying to run my servlet directly from Eclipse. So Eclipse took control of the port. After I closed Eclipse and tried restarting Tomcat (with startup.bat), everything worked fine.
ykaganovich's answer helped me track down my issue.
Non of the solutions above worked for me.
I found my way out by removing my current tomcat and replace it with a new one and setting up again my workspace.
I hope this may help someone
Open up the Tomcat users file (tomcat-users.xml)and check that you've closed all your speech marks. That is what fixed it for me.
Now double-check the role names:
<tomcat-users>
<role rolename="admin" />
<role rolename="manager" />
<user username="admin" password="secret" roles="admin,manager" />
</tomcat-users>
Finally, execute startup.bat file from bin
Try to open Tomcat7w.exe or follow the below steps.
(I have installed Tomcat under folder C:\Program Files\Apache Software Foundation\Tomcat 7.0)
open command prompt as Administrator
run --> "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7w.exe" //MS//
now you can see icon in the system tray
double click on icon and start/stop