-
1. Re: Loading annotations from dynamic modules
ctomc Mar 24, 2014 4:25 PM (in response to mayera21)What module has jandex index now? a deployment?
jandex is needed only for static modules not for dynamic ones...
what is another deployment name? is it called "mymodel.jar" ?
do you have dependency to other deployment expressed in jboss-all.xml?
-
2. Re: Loading annotations from dynamic modules
mayera21 Mar 24, 2014 5:09 PM (in response to ctomc)Ah--didn't know that jandex was only for static modules. I had jandex on my dynamic module mymodel.jar. So I can remove that and apparently the annotations="true" is unnecessary.
But I'm not sure why the JsonIgnoreProperies isn't taking effect then. Are there logs that could be enabled that would provide any insight?
As for my setup, the RESTEasy/Switchyard application (let's call it myimpl.jar) has jboss-deployment-structure.xml that references org.hibernate and deployment.mymodel.jar
But if I make a POST/PUT with additional properties in the json object I get an org.codehaus.jackson.map.exc.UnrecognizedPropertyException
-
3. Re: Re: Loading annotations from dynamic modules
mayera21 Mar 25, 2014 8:51 AM (in response to ctomc)Did a little more digging and it definitely is losing my annotation somehow.
If I run a small test program locally to output the annotations:
Annotation[] annotations = MyClass.class.getDeclaredAnnotations(); for(Annotation an: annotations){ System.out.println(an.toString()); }
I get the following output--which is correct:
@javax.persistence.Embeddable()
@org.codehaus.jackson.annotate.JsonIgnoreProperties(ignoreUnknown=true, value=[])
Running that same code within a running JBoss AS7 deployment, I only see the Embeddable annotation.
-
4. Re: Re: Loading annotations from dynamic modules
ctomc Mar 25, 2014 10:43 AM (in response to mayera21)it might be that your deployment that is importing annotations does not have that annotations classes visible?
try adding dependency also to jackson lib.
problem is that when annotation is resolved it needs classes from which this annotations come from.
you could also enable trace loging for "org.jboss.modules" this way you will probably see this in log.
-
5. Re: Re: Loading annotations from dynamic modules
mayera21 Mar 25, 2014 1:11 PM (in response to ctomc)I added a very similar model class to myimpl.jar and ran similar code to print the class annotations and it showed JsonIgnoreProperties in it's output. So jboss was loading the jackson libraries correctly. But not for mymodel.jar.
I included <module name="org.codehaus.jackson.jackson-core-asl" export="true"> in the jboss-deployment-structure.xml of mymodel.jar and it started working
-
6. Re: Re: Loading annotations from dynamic modules
ctomc Mar 25, 2014 7:53 PM (in response to mayera21)Just a side note, you don't need export="true" part in your dep definition
-
7. Re: Loading annotations from dynamic modules
jeetu Mar 12, 2015 6:02 AM (in response to mayera21)Hi Adam,
Thanks for asking this question. We exactly had this issue and were pulling our hair out, trying to find the answer, until i luckily found this discussion.
I would request you to have better tagging for this discussion so that this can be found easily when searched.
Tomaz,
Thanks for your answer. It works. But i think the documentation should have this written somewhere. I browsed through the whole documentation and could not find anything about this anywhere. Though the solution makes sense, it's highly unlikely for everybody to think of this.