2012-05-22 5 views
0

J'ai l'application de grails cela fonctionne bien jusqu'à ce que j'installe REST PLUGIN. Après l'installation, j'essaie d'exécuter mon application, mais l'exécution a échoué pour la raison suivante.utiliser le plugin de repos avec le projet de grails

| Loading Grails 2.0.3 
| Configuring classpath. 
| Environment set to development..... 
| Packaging Grails application..... 
| Error Error executing script RunApp: loader constraint violation: 
    loader (instance of <bootloader>) previously initiated loading for a different 
    type with name "org/w3c/dom/TypeInfo" (Use --stacktrace to see the full trace) 

Note: j'utilise Grails 2.0.3 et groovy 1.8.6 et éclipser suite d'outils source de printemps 2.9.1

i essayer grails> run-app --stacktrace:

| Loading Grails 2.0.3 
| Configuring classpath. 
| Environment set to development..... 
| Packaging Grails application..... 
| Error Error executing script RunApp: loader constraint violation: 
    loader (instance of <bootloader>) previously initiated loading for a 
    different type with name "org/w3c/dom/TypeInfo" 
    (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) 

java.lang.LinkageError: loader constraint violation: loader 
    (instance of <bootloader>) previously initiated loading for a different 
    type with name "org/w3c/dom/TypeInfo" 

at com.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods 
    (ReflectiveInterceptor.java:123) 

at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke 
    (ReflectiveInterceptor.java:1231) 

at _GrailsPackage_groovy$_run_closure5_closure10.doCall 
    (_GrailsPackage_groovy:121) 

at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke 
    (ReflectiveInterceptor.java:1231) 

at _GrailsPackage_groovy$_run_closure5_closure10.doCall 
    (_GrailsPackage_groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke 
    (ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod (GantMetaClass.java:133) 

at _GrailsPackage_groovy$_run_closure5.doCall(_GrailsPackage_groovy:119) 

at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke 
    (ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) 

at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke 
    (ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16_closure18.doCall(GantBinding.groovy:185) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16_closure18.doCall(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at java_util_concurrent_Callable$call.call(Unknown Source) 

at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90) 

at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16.doCall(GantBinding.groovy:185) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16.doCall(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) 

at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:61) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16_closure18.doCall(GantBinding.groovy:185) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16_closure18.doCall(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at java_util_concurrent_Callable$call.call(Unknown Source) 

at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90) 

at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16.doCall(GantBinding.groovy:185) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16.doCall(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81) 

at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128) 

at RunApp$_run_closure1.doCall(RunApp.groovy:28) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16_closure18.doCall(GantBinding.groovy:185) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_c 
    losure16_closure18.doCall(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at java_util_concurrent_Callable$call.call(Unknown Source) 

at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90) 

at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16.doCall(GantBinding.groovy:185) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_ 
    closure16.doCall(GantBinding.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at java_util_concurrent_Callable$call.call(Unknown Source) 

at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at java_util_concurrent_Callable$call.call(Unknown Source) 

at gant.Gant.withBuildListeners(Gant.groovy:427) 

at gant.Gant.this$2$withBuildListeners(Gant.groovy) 

at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) 

at gant.Gant.dispatch(Gant.groovy:415) 

at gant.Gant.this$2$dispatch(Gant.groovy) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at gant.Gant.invokeMethod(Gant.groovy) 

at gant.Gant.executeTargets(Gant.groovy:591) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

at gant.Gant.executeTargets(Gant.groovy:590) 

at com.springsource.loaded.ri.ReflectiveInterceptor. 
    jlrMethodInvoke(ReflectiveInterceptor.java:1231) 

| Error Error executing script RunApp: loader constraint violation: 
    loader (instance of <bootloader>) previously initiated loading for a 
    different type with name "org/w3c/dom/TypeInfo" 

application.properties :

#Grails Metadata file 
#Mon May 21 10:44:15 EEST 2012 
app.grails.version=2.0.3 
app.name= my-application 
app.servlet.version=2.4 
app.version=0.1 
plugins.ckeditor=3.4.0.1 
plugins.crypto=2.0 
plugins.email-confirmation=1.0.4 
plugins.excel-import=0.3 
plugins.filter=0.2 
plugins.filterpane=0.7 
plugins.gsec=1.0 
plugins.hibernate=2.0.3 
plugins.mail=0.9 
plugins.navigation=1.1.1 
plugins.p6spy=0.5 
plugins.quartz=0.4.2 
plugins.rest=0.7 
plugins.tomcat=2.0.3 
plugins.webflow=2.0.0 

TOUT AIDE?

Note: j'essaie d'utiliser REST Client Builder Plugin mais je ne savais pas comment l'utiliser et comment envoyer corps de demande JSON. any one know?

Répondre

3

il est facile à utiliser REST Client Builder Plugin comme:

def test (String testName, String testDescription){ 
    def restBuilder = new RestBuilder() 
    def restRequest = restBuilder.post(url){ 
     contentType "application/json" 
     json { 
      name = testName 
      description = testDescription 
     } 
    } 
    restRequest.json 
} 

1- url: est l'URL que vous souhaitez poster votre demande

2- Nom & Description: sont les noms des paramètres que vous recevrez dans le serveur Web qui appellent cette méthode

Remarque: ne pas oublier d'installer REST Client Builder Plugin et import grails.plugins.rest.client.RestBuilder dans la classe que vous l'utilisez .

+0

votre réponse est correcte, mais savez-vous pourquoi je peux N'utilisez pas le plugin de repos –

+1

@mbayloon Comme Andrew Eisenberg l'a souligné sur la [question que vous avez supprimée il y a 4 heures, malgré son offre d'aider à dépister le problème] (http://stackoverflow.com/questions/10663899/error-executing- script-runapp-loader-constraint-violation), il y a deux choses qui chargent la classe 'org.w3c.dom.TypeInfo' dans leurs classloaders respectifs, donc vous devez indiquer à l'un d'entre eux d'exclure e ce paquet requis (si possible) .. Je ne sais pas comment vous faites cela si ... –

+0

je sais que mais je google ce point, mais je n'ai pas trouvé de réponse, alors j'essaie danny-london réponse qui me dire comment utiliser le plugin rest-client-builder au lieu du plugin rest.si vous savez comment, ou quelqu'un sait comment puis-je résoudre cette erreur s'il vous plaît dites-moi –

2

C'est un bug dans Grails. Spring loaded, la technologie qui permet le rechargement à chaud des classes dans Grails provoque un problème avec le plugin REST Client Build.

La commande suivante devrait vous permettre d'utiliser le plug-in:

Grails -noreloading run-app

2

J'ai eu un problème similaire (si je besoin que la bibliothèque constructeur http et non le plugin lui-même). L'option -noreloading ne l'a pas améliorée.

Cependant, comme elle l'a ici http://jira.grails.org/browse/GPEXPORT-18?focusedCommentId=69307&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-69307 peut la liste manuellement dans BuildConfig.groovy tous les modules qui font référence à xmlbeans et excluent explicitement xmlbeans comme

compile (group:'org.apache.poi', name:'poi', version:'3.7') { 
    excludes 'xmlbeans' 
} 
compile (group:'org.apache.poi', name:'poi-ooxml', version:'3.7') { 
    excludes 'xmlbeans' 
} 
Questions connexes