Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if rulehelp.txt is not available on initial startup, Sonar Way profile has no rules #1

Open
wvanderdeijl opened this issue Jun 10, 2016 · 8 comments

Comments

@wvanderdeijl
Copy link
Member

wvanderdeijl commented Jun 10, 2016

Issue migrated from https://java.net/jira/browse/SONARQUBE_OJAUDIT-2

During the first startup of SonarQube after installing the ojaudit plugin it creates the 'Sonar Way' ojaudit profile in the SonarQube database.
If the rulehelp.txt file is not available during this initial launch, the plugin will offer 0 rules to SonarQube resulting in a profile with 0 active rules.

If we create the SONAR_HOME/conf/rulehelp.txt afterwards and restart SonarQube it does recognize the new rules and they are available to sonar. However, since the 'Sonar Way' profile has already been created it still has 0 active rules and all 'new' rules have to be added manually.

@wvanderdeijl
Copy link
Member Author

This is probably similar to the situation where addition rules are added to JDeveloper and a new rulehelp.txt file is generated. These are probably picked up by the ojaudit plugin but will likely not be activated in the Sonar Way profile

@wvanderdeijl
Copy link
Member Author

This might nog be something we can fix. Have a look at http://jira.codehaus.org/browse/SONAR-4764 which describes that new rules that are added to a plugin are not activated automatically. That is basically what is happening here. We start the first time without a rulehelp.txt so we create a profile with 0 rules. Then we fix the rulehelp.txt and on the next sonar startup we discover hundreds of new rules for our plugin. These do not get activated for existing profiles and have to be manually activated by the profile administrator

@wvanderdeijl
Copy link
Member Author

also see http://jira.codehaus.org/browse/SONAR-4642 for similar behavior

@wvanderdeijl
Copy link
Member Author

Created rulehelp.txt file using ojaudit and put it under $sonar_home/conf
Starting the server showing below errror....
[o.a.e.s.o.RulesRepository] Reading rulehelp file at /scratch/aime/Sonar/sonarqube-4.3/conf/rulehelp.txt
ERROR [o.s.s.p.PlatformServletContextListener] Fail to start server
java.lang.IllegalArgumentException: Rule must be set
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88) ~[guava-10.0.1.jar:na]
at org.sonar.api.rule.RuleKey.of(RuleKey.java:45) ~[sonar-plugin-api-4.3.jar:na]

@wvanderdeijl
Copy link
Member Author

Our setup
Jdev 11.1.1.7
SonarQube 4.3.1
Linux - 64 bit
Sun JDK 1.7 - 64 bit
SonarQube has worked good so far for many months on our Java code.
We started evaluating the ADF EMG plugin and ran into this issue. SonarQube doesnt start

2014.07.15 13:05:34 INFO [o.a.e.s.o.RulesRepository] Reading rulehelp file at /opt/sonarqube-4.3.1/conf/rulehelp.txt
2014.07.15 13:05:34 INFO [org.sonar.INFO] Register rules done: 664 ms
2014.07.15 13:05:34 ERROR [o.s.s.p.PlatformServletContextListener] Fail to start server
java.lang.IllegalArgumentException: Rule must be set
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88) ~[guava-10.0.1.jar:na]
at org.sonar.api.rule.RuleKey.of(RuleKey.java:45) ~[sonar-plugin-api-4.3.1.jar:na]
at org.sonar.server.rule.DeprecatedRulesDefinition$1.apply(DeprecatedRulesDefinition.java:198) ~[DeprecatedRulesDefinition$1.class:na]
at org.sonar.server.rule.DeprecatedRulesDefinition$1.apply(DeprecatedRulesDefinition.java:195) ~[DeprecatedRulesDefinition$1.class:na]
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:645) ~[guava-10.0.1.jar:na]
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:141) ~[guava-10.0.1.jar:na]
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:136) ~[guava-10.0.1.jar:na]
at com.google.common.collect.Iterators.find(Iterators.java:729) ~[guava-10.0.1.jar:na]
at com.google.common.collect.Iterables.find(Iterables.java:649) ~[guava-10.0.1.jar:na]
at org.sonar.server.rule.DeprecatedRulesDefinition.findRequirement(DeprecatedRulesDefinition.java:195) ~[DeprecatedRulesDefinition.class:na]
at org.sonar.server.rule.DeprecatedRulesDefinition.updateRuleDebtDefinitions(DeprecatedRulesDefinition.java:114) ~[DeprecatedRulesDefinition.class:na]
at org.sonar.server.rule.DeprecatedRulesDefinition.define(DeprecatedRulesDefinition.java:107) ~[DeprecatedRulesDefinition.class:na]
at org.sonar.server.rule.RuleDefinitionsLoader.load(RuleDefinitionsLoader.java:44) ~[RuleDefinitionsLoader.class:na]
at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:108) ~[RegisterRules.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_40]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_40]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_40]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_40]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) ~[picocontainer-2.14.3.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91) ~[sonar-plugin-api-4.3.1.jar:na]
at org.sonar.server.platform.ServerComponents$1.doPrivileged(ServerComponents.java:421) ~[ServerComponents$1.class:na]
at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:46) ~[DoPrivileged.class:na]
at org.sonar.server.platform.ServerComponents.executeStartupTaks(ServerComponents.java:418) ~[ServerComponents.class:na]
at org.sonar.server.platform.ServerComponents.startLevel4Components(ServerComponents.java:395) ~[ServerComponents.class:na]
at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:115) ~[Platform.class:na]
at org.sonar.server.platform.Platform.doStart(Platform.java:80) ~[Platform.class:na]
at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:54) ~[PlatformServletContextListener.class:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) [tomcat-embed-core-7.0.42.jar:7.0.42]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) [tomcat-embed-core-7.0.42.jar:7.0.42]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.42.jar:7.0.42]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [tomcat-embed-core-7.0.42.jar:7.0.42]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [tomcat-embed-core-7.0.42.jar:7.0.42]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_40]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_40]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_40]
at java.lang.Thread.run(Thread.java:724) [na:1.7.0_40]
2014.07.15 13:05:34 INFO [o.s.s.n.NotificationService] Notification service stopped
2014.07.15 13:05:34 INFO [o.elasticsearch.node] [sonarqube] stopping ...
2014.07.15 13:05:34 INFO [o.elasticsearch.node] [sonarqube] stopped
2014.07.15 13:05:34 INFO [o.elasticsearch.node] [sonarqube] closing ...
2014.07.15 13:05:34 INFO [o.elasticsearch.node] [sonarqube] closed

@wvanderdeijl
Copy link
Member Author

Hi Jaspal, Can you share some parts of your rulehelp.txt which used to work for you. Because nothing is working for me. I have created the rulehelp.txt using ojaudit tool

@wvanderdeijl
Copy link
Member Author

sonu12so,
We use SonarQube Java profile for analyzing our Java code.
We just generated rulehelp.txt and could never use it as SonarQube didnt start..
Just curious which version of SonarQube do you use

@wvanderdeijl
Copy link
Member Author

Hi, I am using sonarqube 4.3. once we keep the rulehelp.txt into $sonar_home/conf folder , we get the below error and server fail to start

2014.07.15 12:01:22 INFO [o.a.e.s.o.RulesRepository] Reading rulehelp file at $Sonar/sonarqube-4.3/conf/rulehelp.txt
2014.07.15 12:01:22 INFO [org.sonar.INFO] Register rules done: 376 ms
2014.07.15 12:01:22 ERROR [o.s.s.p.PlatformServletContextListener] Fail to start server
java.lang.IllegalArgumentException: Rule must be set
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88) ~[guava-10.0.1.jar:na]
at org.sonar.api.rule.RuleKey.of(RuleKey.java:45) ~[sonar-plugin-api-4.3.jar:na]
at org.sonar.server.rule.DeprecatedRulesDefinition$1.apply(DeprecatedRulesDefinition.java:198) ~[DeprecatedRulesDefinition$1.class:na]
at org.sonar.server.rule.DeprecatedRulesDefinition$1.apply(DeprecatedRulesDefinition.java:195) ~[DeprecatedRulesDefinition$1.class:na]
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:645) ~[guava-10.0.1.jar:na]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant