java


Introducing EhCache broke web app (no error message)


This question is similar to the one posted previously on SO:
Ehcache causing Tomcat 7 to give 404
However, by following the two changes suggested, the problem is still there:
Make sure ehcache.xml is in WEB-INF/classes
Make sure that Tomcat is of 7.0.52 or later
(I am running Tomcat 7.0.69)
The webapp simply did not start when I introduced EhCache into it. There
were no error messages.
In catalina.log, it simply said that
Jan 26, 2017 5:34:49 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will
be found in the appropriate container log file
Jan 26, 2017 5:34:49 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/myWebApp] startup failed due to previous errors
And in my webapp's own log, I could only see that a listener MyListener
simply said the context was initialized and then it was also immediately
destroyed. There were no indication as to what caused the immediate destroy action.
2017-01-26 17:34:48,242 [op-2] INFO MyListener,localhost-startStop-2:62
- contextInitialized(): creating hibernate session factory
2017-01-26 17:34:49,437 [op-2] INFO MyListener,localhost-startStop-2:138
- contextDestroyed(): shutting down Quartz scheduler
The webapp could start in my development environment (in Eclipse) but refused to start in a deployed environment (run on tomcat).
It turned out that the problem was that I forgot to check-in an updated version of hibernate.cfg.xml. The deployed environment missed this file so the webapp could not start.
What made this bug hard to track down was there there were no error messages at all. Only after my colleague told me that she also could not start the webapp (in her Eclipse environment) with this error message I realized that I forgot to check in hibernate.cfg.xml
org.hibernate.cache.NoCacheRegionFactoryAvailableException:
Second-level cache is used in the application, but property
hibernate.cache.region.factory_class is not given, please
either disable second level cache or set correct region
factory class name to property hibernate.cache.region.factory_class
(and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath).
at org.hibernate.cache.internal.NoCachingRegionFactory.buildEntityRegion(NoCachingRegionFactory.java:69)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:348)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1760)
In other words, for some reasons the error messages were printed in Eclipse but not tomcat.
I hope tomcat, hibernate, and/or ehcache could have spit out more meaningful error messages in the deployed environment.
By sharing this story I hope it can help someone fix a similar problem quicker in the future.

Related Links

TextView SetText
Java Regex Matcher encountering NullPointerException, when handed null input [duplicate]
android - switch case and its return value
Spring platform-bom and dependencyManagment
JIRA Tomcat SyBase JDBC driver on Windows
spring form vs html form [duplicate]
How to get master_secret after TLS handshake
Gson Help - Trying to get the first value (key) of JSON using Gson
class parameter missing final quote
Strange case error of java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 47 [duplicate]
How to refer to object property within object
Generate Java classes from elasticsearch type mappings
set Blocks Bukkit performance friendly
Request too large in jsp login page
Background Threads not closing when root node is changed [javaFX]
How can I Access Different Java Partitions in my IDocument

Categories

HOME
java
blogger
proxy
openstack
minimum-spanning-tree
electron
android-4.4-kitkat
setup-deployment
bs4
qore
node-notifier
contact
iggrid
google-translate
vifm
user-input
correlation
apache-cayenne
timeout
n-gram
carthage
workload-scheduler
pythonanywhere
nhibernate-envers
firefox-webextensions
karma-jasmine
jprofiler
plunker
jasonette
abi
tokenize
android-widget
microsoft-sync-framework
user-interaction
windows-error-reporting
web-api-testing
xacml
elasticsearch-net
replaceall
ejabberd-module
vision
phonegap
windows-dev-center
asset-pipeline
devextreme
bitbucket-pipelines
occlusion
theano.scan
sas-visual-analytics
mapzen
sfdc
texmaker
isbn
total-commander
gpx
angular2-meteor
dds
theming
git-diff
mplayer
slickedit
pg-dump
google-perftools
nsarray
dtexec
titanium-android
ableton-live
heidisql
ado.net-entity-data-model
rvest
wapiti
ios8-today-widget
embedded-code
service-accounts
nsight
composite
csquery
jsonpickle
ng-animate
wordpress-theme-customize
issuu
openexr
sgen
htmlcleaner
undefined-reference
bundles
srs
prettify
geos
.aspxauth
listings
blending
batterylevel
gwt-rpc
android-hardware
itmstransporter
quickdialog
frameset
ohm
jquery-ui-layout
asyncfileupload
work-stealing
netbeans-7.1
mysql-error-1005
gallio
mozilla-prism
firefox4
kdbg
exchange-server-2003
geneva-server

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App