CDV ❯ Issue log banner warning when tc.config system property is ignored
-
New Feature
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
Integration Modules
-
-
hsingh
-
Reporter: gkeim
-
October 26, 2009
-
0
-
Watchers: 0
-
February 12, 2013
-
November 11, 2009
Description
In the “express” deployments for Hibernate and Ehcache, the config MUST be specified embedded in the product-specific config file; the tc.config system property is ignored. In this situation, where the tc.config is specified, a log banner message should warn that the tc.config property is being ignored and that you should embed your tc-config properly.
See: http://forums.terracotta.org/forums/posts/list/2647.page
Comments
Alex Miller 2009-10-27
Gary Keim 2009-10-27
IMO, it’s an error since the misunderstanding leads to failure. Fail fast.
Alex Miller 2009-10-28
In Ehcache, I think the right place to do this is probably somewhere in StandaloneTerracottaStoreFactory in ehcache-terracotta-bootstrap. That’s where we’ve parsed out the config and we could at that point check for tc.config being set and throw an error. There is a good setup for testing this that you can utilize in ehcache-terracotta/system-tests.
In Hibernate, I’m not sure of the class, but I’m assuming the important code is probably in tim-hibernate-cache-provider-3.2 at whatever point we’ve read the config and are feeding it to Terracotta. Some place like TerracottaHibernateCacheProvider. There are system tests you can leverage under terracotta-hibernate-cache.
Himadri Singh 2009-12-15
Got following exception with Terracotta 3.2.0, as of 20091212-151212 (Revision 14206 by cruise@su10mo5 from 3.2) for Ehcache Express
net.sf.ehcache.CacheException: Unable to load class net.sf.ehcache.terracotta.StandaloneTerracottaStoreFactory. Initial cause was The Terracotta config file should not be set through -Dtc.config in this usage. It must be embedded in ehcache configuration file.
at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:109)
at net.sf.ehcache.TerracottaStoreHelper.newStoreFactory(TerracottaStoreHelper.java:101)
at net.sf.ehcache.CacheManager.createTerracottaStore(CacheManager.java:353)
at net.sf.ehcache.Cache.initialise(Cache.java:685)
at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:811)
at net.sf.ehcache.CacheManager.addCache(CacheManager.java:801)
at net.sf.ehcache.CacheManager.addCache(CacheManager.java:779)
at org.terracotta.Service.addCacheToCacheManager(Service.java:232)
at org.terracotta.Service.processRequest(Service.java:103)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:107)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: net.sf.ehcache.CacheException: The Terracotta config file should not be set through -Dtc.config in this usage. It must be embedded in ehcache configuration file.
at net.sf.ehcache.terracotta.StandaloneTerracottaStoreFactory.testForWrongTcconfig(StandaloneTerracottaStoreFactory.java:232)
at net.sf.ehcache.terracotta.StandaloneTerracottaStoreFactory.
Himadri Singh 2009-12-15
2009-12-15 04:09:18,992 INFO [DefaultListableBeanFactory] - <Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@81f03: defining beans [org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.config.internalTransactionAdvisor,petClinicPerfTestActions,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,transactionManager,entityManagerFactoryBase,dataSourceTarget,dataSource,hibernateJpaVendorAdapter,clinic,clinicService,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1,entityManagerFactory]; root of factory hierarchy>
Exception in thread “main” org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.transaction.config.internalTransactionAdvisor’: Cannot create inner bean ‘(inner bean)’ of type [org.springframework.transaction.interceptor.TransactionInterceptor] while setting bean property ‘transactionInterceptor’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘(inner bean)’: Cannot resolve reference to bean ‘transactionManager’ while setting bean property ‘transactionManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’ defined in class path resource [application-common.xml]: Cannot resolve reference to bean ‘entityManagerFactory’ while setting bean property ‘entityManagerFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [application-tc-perf.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: The Terracotta config file should not be set through -Dtc.config in this usage. It must be set through tc-hibernate-cache.xml
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.terracotta.petclinic.perftest.util.SpringFactory.getApplicationContext(SpringFactory.java:77)
at org.terracotta.petclinic.perftest.util.SpringFactory.getApplicationContext(SpringFactory.java:44)
at org.terracotta.petclinic.perftest.util.SpringFactory.getControllerBean(SpringFactory.java:89)
at org.terracotta.petclinic.perftest.type.BaseTest.setup(BaseTest.java:36)
at org.terracotta.petclinic.perftest.type.ReadOnlyTest.setup(ReadOnlyTest.java:14)
at org.terracotta.petclinic.perftest.AbstractPerfTest.doSetupTest(AbstractPerfTest.java:181)
at org.terracotta.petclinic.perftest.AbstractPerfTest.startTest(AbstractPerfTest.java:134)
at org.terracotta.petclinic.perftest.PetClinicPerfTest.main(PetClinicPerfTest.java:303)
:
:
:
Caused by: java.lang.RuntimeException: The Terracotta config file should not be set through -Dtc.config in this usage. It must be set through tc-hibernate-cache.xml
at org.terracotta.modules.hibernatecache.BootstrapCacheProvider.testForWrongTcconfig(BootstrapCacheProvider.java:107)
at org.terracotta.modules.hibernatecache.BootstrapCacheProvider.initialize(BootstrapCacheProvider.java:113)
at org.terracotta.modules.hibernatecache.BootstrapCacheProvider.access$100(BootstrapCacheProvider.java:56)
at org.terracotta.modules.hibernatecache.BootstrapCacheProvider$InitState.initialize(BootstrapCacheProvider.java:488)
at org.terracotta.modules.hibernatecache.BootstrapCacheProvider.
Himadri Singh 2009-12-15
Verified in Terracotta Enterprise 3.2.0, as of 20091212-151256 (Revision 5578-14206 by cruise@su10mo5 from 3.2)
This implies that you could not use an express Ehcache install (for example) along with a custom install. That may well be true anyways but I don’t know if it will always be true. Should this be a warning or an error? I’m thinking warning.