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.
Related
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 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
?
After creating RestFul Web service (let's say helloworld) using Intellij Idea, When I run the server, it runs correctly(it says Server is running). But when I try to access it using my web browser, it says "the web page you are requested is not available".
What is wrong with my web service.?
I just created a basic project.
output -
com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class example.HelloWorld
Dec 26, 2013 3:16:09 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Dec 26, 2013 3:16:09 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.3 06/17/2010 05:04 PM'
Server running
Visit: http ://localhost:9998/helloworld
Hit return to stop...
In your helloworld class,there may be a line like following
HttpServer server = HttpServerFactory.create("http://localhost:9998/");
change the port number to 8080 and try to run again
.I'm using Newrelic for java agent.I install the newrelic.yml file using the command "java -jar newrelic.jar install" in my prompt. When running, it shows the message as INSTALL SUCCESSFUL and some other information. I also find the newrelic.yml setup in running the run.bat file.But i'm not able to see the newrelic API in my browser when running the port as "localhost:8080/newrelic" . I'm started my server in the port 8080.
The log folder in newrelic diectory.My newrelic_agent.log containing the following lines...,
Feb 8, 2012 05:49:07 PM NewRelic INFO: Writing to New Relic log file: D:\work\software\jboss-6.0.0.Final\newrelic\logs\newrelic_agent.log
Feb 8, 2012 05:49:09 PM NewRelic INFO: Configured to connect to New Relic at collector.newrelic.com:80
Feb 8, 2012 05:49:09 PM NewRelic INFO: Setting protocol to "http"
Feb 8, 2012 05:49:09 PM NewRelic INFO: Configuration file is D:\work\software\jboss-6.0.0.Final\newrelic\.\newrelic.yml
Feb 8, 2012 05:49:09 PM NewRelic WARN: The apdex_t setting is obsolete and is ignored! Set the apdex_t value for an application in New Relic UI
Feb 8, 2012 05:49:09 PM NewRelic INFO: New Relic Agent v2.3.0 has started
Feb 8, 2012 05:49:09 PM NewRelic INFO: Java version: 1.6.0_12
Feb 8, 2012 05:49:30 PM NewRelic INFO: JVM is shutting down
Feb 8, 2012 05:49:30 PM NewRelic INFO: New Relic Agent has shutdown
I'm sure not yet started the newrelic API in my browser.It shows an error as "HTTP 404 the request resource /k12/newrelic is not available.I'm using j.d.k 1.6
Help me please..?
The New Relic Ruby agent has a Developer Mode that lives at the /newrelic path you're trying to reach, but the Java agent does not. Developer Mode would give you a detailed trace of each individual web request your app makes that's similar to what the normal New Relic product does with Transaction Traces.
To use New Relic and report performance data, it looks like you've got everything configured correctly. You should be able to log in to https://rpm.newrelic.com and see what your app is doing.
You mentioned "the newrelic API", but I'm not sure what you are looking for exactly. There is an API for the Java agent that lets you configure the agent. There's also a New Relic HTTP REST API that will let you retrieve data reported by your applications.