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

Constant Map for case selection in switch statement?
How do we deal with the overflow edge case for float type in Java?
Muti thread join & get return values
Extracting a value from a file name base on regex in Java
Does setting variable to null clear just the reference? [duplicate]
Saving data in Parse LocalDataStore but can't retrieve it. See Code and Logs
My check statements for nQueens are not working properly
An error in creating a method for work with PostgreSQL [duplicate]
Approximating Pi - Why isn't this code working? [duplicate]
JUnit Using #Before Over #BeforeClass
How to implement timer to make text visible for a certain time and then replace it with another text in Java?
stringBuilder.append(“string”) - unrechable statement
How to export a file to a specific location using java code
I need help to print the elements in this array?
Checking if user input matches HashMap value
Graph path finder

Categories

HOME
ibm-bluemix
netsuite
ngrx
iot
alfresco
android-4.4-kitkat
rsync
disassembler
android-youtube-api
cloudkit
gorm
n-gram
gz
transformation
pugjs
sms-gateway
google-pagespeed
textfield
lldb
errorlevel
functional-testing
arabic
facebook-instant-articles
extjs5
mmap
fish
chromebook
large-file-upload
libuv
windowbuilder
tasklet
tinymce-4
fabric8
functor
calibre
lxd
cloud-code
normal-distribution
wpf-controls
adobe-premiere
web-mining
libraries
user-controls
ruby-on-rails-3.1
total-commander
businessworks
websphere-mq-fte
upstart
komodoedit
python-c-api
dropbox-php
mu
mplayer
brightcove
diagnostics
font-size
boost-preprocessor
pdfclown
cudafy.net
dynamics-sl
minimization
smart-table
setuptools
vmware-tools
sts-springsourcetoolsuite
skobbler-maps
mathematica-frontend
autorest
disque
nsviewcontroller
superstack
rvest
pickadate
bluegiga
ios4
asp.net5
lib.web.mvc
atk4
nsmutabledictionary
facebook-graph-api-v2.4
website-monitoring
file-copying
socketexception
eol
braille
undefined-reference
meteor-velocity
message-driven-bean
prettify
xsockets.net
flash-builder4.5
eventlistener
sublist
dsn
regsvr32
whoosh
pydot
zpt
deobfuscation
coercion
locationlistener
gdlib
radcombobox
blitz++
wise
simpletest
mediarss
defensive-programming
geneva-server

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App