Discussion:
[Cucumber] CucumberException: Annotations differs on glue classes found
(too old to reply)
Eugene Shragovich
2017-09-14 09:09:14 UTC
Permalink
Raw Message
Greetings,


I have this issue after upgrading to Cucumber 1.2.5 from 1.1.8

I already found some posts that seem to discuss the same issue here:
https://groups.google.com/forum/#!searchin/cukes/CucumberException$3A$20Annotations$20differs$20on$20glue$20classes$20found|sort:relevance/cukes/eOa_4eI_7os/tdOZ6yM4FAEJ

and also here:
https://github.com/cucumber/cucumber-jvm/commit/73039ae516c6e2253ef91b0deb834486cb769441
https://github.com/cucumber/cucumber-jvm/pull/711
https://github.com/cucumber/cucumber-jvm/issues/798


From all that I understand that this error is returned if two classes have
different @ContextHierarchy/@ContextConfiguration annotations.
In my case however, I have only one class annotated with
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")}), and
the rest of the glue classes extend this class and do not contain any such
annotations themselves.


The parent class looks like this:

@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
@Component
public abstract class BddGlue {

}

And the glue classes just extend it so there is no duplication of mixing of
different annotations. Nevertheless, I still get the above mentioned error.

Can you please advise what am I doing wrong here?


Thanks!
Eugene
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Björn Rasmusson
2017-09-14 11:07:30 UTC
Permalink
Raw Message
Post by Eugene Shragovich
Greetings,
I have this issue after upgrading to Cucumber 1.2.5 from 1.1.8
https://groups.google.com/forum/#!searchin/cukes/CucumberException$3A$20Annotations$20differs$20on$20glue$20classes$20found|sort:relevance/cukes/eOa_4eI_7os/tdOZ6yM4FAEJ
https://github.com/cucumber/cucumber-jvm/commit/73039ae516c6e2253ef91b0deb834486cb769441
https://github.com/cucumber/cucumber-jvm/pull/711
https://github.com/cucumber/cucumber-jvm/issues/798
From all that I understand that this error is returned if two classes have
In my case however, I have only one class annotated with
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")}), and
the rest of the glue classes extend this class and do not contain any such
annotations themselves.
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
@Component
public abstract class BddGlue {
}
And the glue classes just extend it so there is no duplication of mixing
of different annotations. Nevertheless, I still get the above mentioned
error.
Can you please advise what am I doing wrong here?
Since you do not show the declaration of the classes that Cucumber-JVM
complains about, it is impossible to say what you are doing wrong.

/Björn
Post by Eugene Shragovich
Thanks!
Eugene
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eugene Shragovich
2017-09-15 04:22:47 UTC
Permalink
Raw Message
Hi and thanks for the reply,

I think I was able to understand what was causing the issue. Not all the
classes that inherit from BddGlue had been annotated with @Component. I
thought that only
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
annotation must be equal.


The problem now is that not all of my classes that inherit from BddGlue
should be annotated with @Component but it seems I am now forced into doing
that. Is that correct?


Thanks,
Eugene
Post by Björn Rasmusson
Post by Eugene Shragovich
Greetings,
I have this issue after upgrading to Cucumber 1.2.5 from 1.1.8
https://groups.google.com/forum/#!searchin/cukes/CucumberException$3A$20Annotations$20differs$20on$20glue$20classes$20found|sort:relevance/cukes/eOa_4eI_7os/tdOZ6yM4FAEJ
https://github.com/cucumber/cucumber-jvm/commit/73039ae516c6e2253ef91b0deb834486cb769441
https://github.com/cucumber/cucumber-jvm/pull/711
https://github.com/cucumber/cucumber-jvm/issues/798
From all that I understand that this error is returned if two classes
In my case however, I have only one class annotated with
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")}), and
the rest of the glue classes extend this class and do not contain any such
annotations themselves.
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
@Component
public abstract class BddGlue {
}
And the glue classes just extend it so there is no duplication of mixing
of different annotations. Nevertheless, I still get the above mentioned
error.
Can you please advise what am I doing wrong here?
Since you do not show the declaration of the classes that Cucumber-JVM
complains about, it is impossible to say what you are doing wrong.
/Björn
Post by Eugene Shragovich
Thanks!
Eugene
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Björn Rasmusson
2017-09-15 06:42:49 UTC
Permalink
Raw Message
Post by Eugene Shragovich
Hi and thanks for the reply,
I think I was able to understand what was causing the issue. Not all the
thought that only
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
annotation must be equal.
Cucumber-JVM uses one glue class to create the spring context. Cucumber-JVM
cannot know which annotations, besides @ContextConfiguration and
@ContextHierarchy, that affect the spring context created, therefore the
list of all annotations on the classes which have @ContextConfiguration and
@ContextHierarchy annotations must be equal. The Cucumber-JVM can be sure
that it does not matter which of these classes it uses to create the spring
context.
Post by Eugene Shragovich
The problem now is that not all of my classes that inherit from BddGlue
doing that. Is that correct?
All classes which have @ContextConfiguration and @ContextHierarchy
annotations (in your case that inherit from BddGlue) must have exactly the
same annotations on them. However all glue classes does not need to have
@ContextConfiguration and @ContextHierarchy annotations, Cucumber-JVM must
only find (at least) one. The solution in your case seems to be to remove
the inheritance from BddGlue on all classes that should be annotated with
@Component (or remove the inheritance from BddGlue on all classes that
should not be annotated with @Component).

/Björn
Post by Eugene Shragovich
Thanks,
Eugene
Post by Björn Rasmusson
Post by Eugene Shragovich
Greetings,
I have this issue after upgrading to Cucumber 1.2.5 from 1.1.8
https://groups.google.com/forum/#!searchin/cukes/CucumberException$3A$20Annotations$20differs$20on$20glue$20classes$20found|sort:relevance/cukes/eOa_4eI_7os/tdOZ6yM4FAEJ
https://github.com/cucumber/cucumber-jvm/commit/73039ae516c6e2253ef91b0deb834486cb769441
https://github.com/cucumber/cucumber-jvm/pull/711
https://github.com/cucumber/cucumber-jvm/issues/798
From all that I understand that this error is returned if two classes
In my case however, I have only one class annotated with
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")}), and
the rest of the glue classes extend this class and do not contain any such
annotations themselves.
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
@Component
public abstract class BddGlue {
}
And the glue classes just extend it so there is no duplication of mixing
of different annotations. Nevertheless, I still get the above mentioned
error.
Can you please advise what am I doing wrong here?
Since you do not show the declaration of the classes that Cucumber-JVM
complains about, it is impossible to say what you are doing wrong.
/Björn
Post by Eugene Shragovich
Thanks!
Eugene
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eugene Shragovich
2017-09-15 07:33:18 UTC
Permalink
Raw Message
Thank you very much Björn,

I have made few changes based ion your recommendations and it seem like I
have been able to resolve this problem.


Best Regards,
Eugene
Post by Björn Rasmusson
Post by Eugene Shragovich
Hi and thanks for the reply,
I think I was able to understand what was causing the issue. Not all the
thought that only
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
annotation must be equal.
Cucumber-JVM uses one glue class to create the spring context.
the list of all annotations on the classes which have
@ContextConfiguration and @ContextHierarchy annotations must be equal.
The Cucumber-JVM can be sure that it does not matter which of these classes
it uses to create the spring context.
Post by Eugene Shragovich
The problem now is that not all of my classes that inherit from BddGlue
doing that. Is that correct?
annotations (in your case that inherit from BddGlue) must have exactly the
same annotations on them. However all glue classes does not need to have
@ContextConfiguration and @ContextHierarchy annotations, Cucumber-JVM
must only find (at least) one. The solution in your case seems to be to
remove the inheritance from BddGlue on all classes that should be annotated
/Björn
Post by Eugene Shragovich
Thanks,
Eugene
Post by Björn Rasmusson
Post by Eugene Shragovich
Greetings,
I have this issue after upgrading to Cucumber 1.2.5 from 1.1.8
https://groups.google.com/forum/#!searchin/cukes/CucumberException$3A$20Annotations$20differs$20on$20glue$20classes$20found|sort:relevance/cukes/eOa_4eI_7os/tdOZ6yM4FAEJ
https://github.com/cucumber/cucumber-jvm/commit/73039ae516c6e2253ef91b0deb834486cb769441
https://github.com/cucumber/cucumber-jvm/pull/711
https://github.com/cucumber/cucumber-jvm/issues/798
From all that I understand that this error is returned if two classes
In my case however, I have only one class annotated with
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")}), and
the rest of the glue classes extend this class and do not contain any such
annotations themselves.
@ContextHierarchy({@ContextConfiguration("classpath:/cucumber.xml")})
@Component
public abstract class BddGlue {
}
And the glue classes just extend it so there is no duplication of
mixing of different annotations. Nevertheless, I still get the above
mentioned error.
Can you please advise what am I doing wrong here?
Since you do not show the declaration of the classes that Cucumber-JVM
complains about, it is impossible to say what you are doing wrong.
/Björn
Post by Eugene Shragovich
Thanks!
Eugene
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...