CDV ❯ Validate root definitions
-
New Feature
-
Status: Resolved
-
2 Major
-
Resolution: Won't Fix
-
DSO:L1
-
-
prodmgmt
-
Reporter: steve
-
April 19, 2007
-
0
-
Watchers: 2
-
June 24, 2013
-
June 24, 2013
Description
From the forums:
If I mistype the field-name of a root declaration in my terracotta config, running the application does not throw any error whatsoever. I tried enabled root debugging in the config, but it still doesn’t say anything about incorrectly named roots. Is there a way to have terracotta output these errors to the log?
This is a bit tricky. Since java dynamically loads it’s classes the question is at what point does a root definition become invalid? One could even be dynamically generating the class with the root. The way I currently deal with this kind of thing is to turn on debugging and if the root isn’t getting created I go back and validate my config.
That said, we might be able to have some sort of validator that searches the classpath for all roots and gives a warning if no variable matches the root spec. While not perfect because of dynamically generated stuff I think it would be helpful 99 percent of the time.
Comments
Taylor Gautier 2007-04-19
Geert Bevin 2007-04-19
Or maybe have a functionality to list all the roots that are in the config but that aren’t currently in use, this could help to detect config problems. Spitting out a bunch of warnings that can happen with dynamically loaded classes that are not necessarily in the classpath could generate more noise that is actually useful. I’m generally not a real fan of logging warnings.
Steve Harris 2007-04-19
good idea. we could do it with jmx
Fiona OShea 2007-07-26
Do Taylor’s idea.
Fiona OShea 2007-07-26
RMP-213 is added to follow up on Geert’s idea. but in the short term follow Taylor’s plan
Juris Galang 2007-10-10
The implementation to resolve this issue does not check if a root is declared as an expression. Tell me if you would like to support that as well.
Taylor Gautier 2009-02-17
I tried to trigger this condition.
It’s pretty simple, I used both of the helloclusteredxxx projects listed here:
http://www.terracotta.org/web/display/orgsite/Recipe?recipe=helloclusteredworld http://www.terracotta.org/web/display/orgsite/Recipe?recipe=helloclusteredinstance
In both cases, I modified the tc-config.xml to delete one letter from the root definition, making it invalid.
Then I ran the demos as instructed on the site.
I did not receive any warning or info messages indicating the invalid root specification on either the console or in the client logs.
Fiona OShea 2009-02-18
Can you validate that the behaviour is as expected?
nadeem ghani 2009-02-18
edit the tc-config.xml, changing to
run the sample, client output:
macbook ~/cookbook/helloclusteredworld > ~/__releases/feb18/terracotta-2.7.3/bin/dso-java.sh Main Starting BootJarTool… 2009-02-18 14:48:17,800 INFO - Terracotta 2.7.3, as of 20090129-100125 (Revision 11424 by cruise@su10mo5 from 2.7) 2009-02-18 14:48:18,176 INFO - Configuration loaded from the file at ‘/Users/nghani/cookbook/helloclusteredworld/tc-config.xml’.
Starting Terracotta client… 2009-02-18 14:48:19,878 INFO - Terracotta 2.7.3, as of 20090129-100125 (Revision 11424 by cruise@su10mo5 from 2.7) 2009-02-18 14:48:20,242 INFO - Configuration loaded from the file at ‘/Users/nghani/cookbook/helloclusteredworld/tc-config.xml’. 2009-02-18 14:48:20,317 INFO - Log file: ‘/Users/nghani/cookbook/helloclusteredworld/logs-192.168.1.111/terracotta-client.log’. 2009-02-18 14:48:21,920 INFO - Statistics buffer: ‘/Users/nghani/cookbook/helloclusteredworld/statistics-192.168.1.111’. 2009-02-18 14:48:22,180 INFO - Connection successfully established to server at 127.0.0.1:9510 Counter is: 1
add to tc-config:
<instrumented-classes>
<include>
<class-expression>*..*</class-expression>
</include>
</instrumented-classes>
client output now:
macbook ~/cookbook/helloclusteredworld > ~/__releases/feb18/terracotta-2.7.3/bin/dso-java.sh Main Starting BootJarTool… 2009-02-18 14:51:05,581 INFO - Terracotta 2.7.3, as of 20090129-100125 (Revision 11424 by cruise@su10mo5 from 2.7) 2009-02-18 14:51:05,962 INFO - Configuration loaded from the file at ‘/Users/nghani/cookbook/helloclusteredworld/tc-config.xml’.
Starting Terracotta client… 2009-02-18 14:51:07,639 INFO - Terracotta 2.7.3, as of 20090129-100125 (Revision 11424 by cruise@su10mo5 from 2.7) 2009-02-18 14:51:08,008 INFO - Configuration loaded from the file at ‘/Users/nghani/cookbook/helloclusteredworld/tc-config.xml’. 2009-02-18 14:51:08,080 INFO - Log file: ‘/Users/nghani/cookbook/helloclusteredworld/logs-192.168.1.111/terracotta-client.log’. 2009-02-18 14:51:09,535 INFO - Statistics buffer: ‘/Users/nghani/cookbook/helloclusteredworld/statistics-192.168.1.111’. 2009-02-18 14:51:09,779 INFO - Connection successfully established to server at 127.0.0.1:9510 2009-02-18 14:51:09,932 WARN - The root expression ‘Main.counte’ meant for the class ‘Main’ has no effect, make sure that it is a valid expression and that it is spelled correctly. Counter is: 1
Fiona OShea 2009-04-22
Can you re-run this test in 3.0.0 and update the comments? The 2.7.3 are correct.
CDV-1249 is a related issue
nadeem ghani 2009-04-22
No difference between 2.7.3 and 3.0.0
Steve Harris 2009-04-22
Taylor thinks it might work for non-literal roots and not for literal roots. Can you check that?
nadeem ghani 2009-04-22
Also, the behavior is the same for int and Integer. Warning is emitted only if an instrumented-classes stanza is added to tc-config.
Fiona OShea 2009-04-22
From Nadeem Basically for each release I tried two cases:
first, just edited tc-config.xml to typo the root defn, no warning next, leaving the typo in the root defn, add a instrumented-classes stanza to tc-config, now see the warning
And then tried it with the int, as the cookbook has it, and again after modifying to Integer. - No warning
Fiona OShea 2009-04-23
DRB: Is this expected behaviour?
Fiona OShea 2009-04-27
Sit with Taylor when he gets back from Europe. to figure out what is right and expected.
Vitaliy Funshteyn 2013-06-24
DSO is no longer supported.
Another idea:
If a class is loaded that matches the package and classname, but the field specifies a field that does not exist, print a warning.