Closed confile closed 8 years ago
I've never seen it. It seems an info message more than an error, however googling for it I've found http://stackoverflow.com/questions/15767973/jersey-what-does-couldnt-find-grammar-element-mean
Could it be that test.dto.UserDto
doesn't have a default constructor?
I checked this. All my classes have a public default constructor and may be a second parameterized constructor:
class UserDto {
String id
String firstName
String lastName
public UserDto() { }
public UserDto(User user, User currentUser) {
...
}
}
@davidecavestro Do you have any idea how to fix this?
No idea. If I had time I'd debug the relevant jersey code. However I guess we are talking about an info message that you can safely ignore
In my Config.groovy I use:
org.grails.jaxrs.doreader.disable=true
org.grails.jaxrs.dowriter.disable=true
Is there any other config you recommend to prevent these INFO messages?
No idea, did you tried debugging com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator.attachTypes(ApplicationDescription)
?
Since the relevant INFO message is generated at the end of that method, maybe debugging it could be of some help.
Sorry I did not get your point. Could you give me a little help please. How do I debug this?
I also get the following output after server startup:
Sep 18, 2014 3:18:19 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
groovy.util.ConfigObject@6ea2bfd9
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
INFO: Using default applicationContext
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, stickerPositionListDtoReader, of type test.StickerPositionListDtoReader as a provider class
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, org.grails.jaxrs.provider.DomainObjectWriter, of type org.grails.jaxrs.provider.DomainObjectWriter as a provider class
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, loginRequestDtoReader, of type test.LoginRequestDtoReader as a provider class
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, org.grails.jaxrs.provider.XMLReader, of type org.grails.jaxrs.provider.XMLReader as a provider class
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, stickerGroupListResource, of type test.StickerGroupListResource as a root resource class
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, userDetailsResource, of type test.UserDetailsResource as a root resource class
Sep 18, 2014 3:18:20 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
Do you have any idea what to do?
In this post: http://stackoverflow.com/questions/15767973/jersey-what-does-couldnt-find-grammar-element-mean
A possible solution is to put the following in my web.xml:
<init-param>
<param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
<param-value>true</param-value>
</init-param>
Where do I have to put this init param to? Is there a config in your plugin to disable WADL?
The grails-jaxrs plugin simply uses jersey (the jaxrs reference implementation), embedding it into the grails web application.
So almost any jersey configuration applies, it being understood that the jersey servlet is not directly configured into the web.xml: its features are exposed through a dedicated controller.
I'd go for disabling wadl generation through jersey api or perhaps setting the param into a map and passing it as jaxrsInitParameters
attribute of the jaxrsContext
using resources.groovy.
@davidecavestro Thank you very much for your help. I would go with the resources.groovy solution.
Could you please tell me what I do have to set in resources.groovy?
I think it would be something like
import org.grails.jaxrs.web.JaxrsContext
beans = {
myJaxrsContext(JaxrsContext);
Map<String, String> jaxrsProviderInitParameters = new HashMap<String, String>();
jaxrsProviderInitParameters.put("com.sun.jersey.config.feature.DisableWADL", "true");
myJaxrsContext.setJaxrsInitParameters(jaxrsProviderInitParameters);
}
Keep in mind you can put groovy code into resources.groovy BTW I guess it should be fine... try it
2014-09-19 11:01 GMT+02:00 Confile notifications@github.com:
@davidecavestro https://github.com/davidecavestro Thank you very much for your help. I would go with the resources.groovy solution.
Could you please tell me what I do have to set in resources.groovy?
I think it would be something like
import org.grails.jaxrs.web.JaxrsContext
beans = { myJaxrsContext(JaxrsContext); Map<String, String> jaxrsProviderInitParameters = new HashMap<String, String>(); jaxrsProviderInitParameters.put("com.sun.jersey.config.feature.DisableWADL", "true");
myJaxrsContext.setJaxrsInitParameters(jaxrsProviderInitParameters); }
— Reply to this email directly or view it on GitHub https://github.com/krasserm/grails-jaxrs/issues/57#issuecomment-56153282 .
It does not work this way. I get the following error:
2014-09-19 15:36:44,037 [localhost-startStop-1] ERROR spring.GrailsRuntimeConfigurator - [RuntimeConfiguration] Unable to load beans from resources.groovy
Message: null
Line | Method
->> 65 | doCall in resources$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 754 | invokeBeanDefiningClosure in grails.spring.BeanBuilder
| 584 | beans . . . . . . . . . . in ''
| 460 | checkExternalBeans in grails.plugin.hibernate3.HibernatePluginSupport
| 135 | doCall . . . . . . . . . in grails.plugin.hibernate3.HibernatePluginSupport$__clinit__closure1
| 754 | invokeBeanDefiningClosure in grails.spring.BeanBuilder
| 584 | beans . . . . . . . . . . in ''
| 527 | invokeMethod in ''
| 334 | innerRun . . . . . . . . in java.util.concurrent.FutureTask$Sync
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . . . . . . in java.lang.Thread
What do I have to change?
@davidecavestro I still have this problem could you please give me some advice how to disable WADL?
Sorry, even last weekend I had no time to give it a try
BTW if I were you, I'd continue with the resources.groovy
approach: try commenting the entire closure contents, then uncomment just one line at time in order to find the error cause.
There could be other (probably better) ways I am not aware of and it would be very interesting taking time to investigate.
What should I put in resources.groovy?
@davidecavestro Could the answer in this question be a solution?
http://stackoverflow.com/questions/25915049/jersey-couldnt-find-grammar-element-for-class
This issue was moved to budjb/grails-jaxrs#18
In my production environment I get the following error:
What does this mean?