java. Lang. linkageerror: Loader constraint violation in Grails project
I have built a Grails project with POI (including POI - 3.7 and poi - OOXML - 3.7) I've been working on the buildconfig These two external libraries are added to the dependencies in the groovy file There's nothing strange when I compile it However, when I called the command "run app" for the project, the following stacktrace error occurred:
Base Directory: <path-to-my-project> Resolving dependencies... Dependencies resolved in 5546ms. Running script D:\_TOOLS\STS\grails-1.3.5\scripts\RunApp.groovy Environment set to development Running Grails application.. 2011-05-23 18:51:01,225 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) prevIoUsly initiated loading for a different type with name "org/w3c/dom/DOMConfiguration" org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) prevIoUsly initiated loading for a different type with name "org/w3c/dom/DOMConfiguration" at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:723) at grails.spring.BeanBuilder.beans(BeanBuilder.java:573) at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:519) at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212) at grails.web.container.EmbeddableServer$start.call(UnkNown Source) at RunApp$_run_closure5_closure12.doCall(RunApp:158) at RunApp$_run_closure5_closure12.doCall(RunApp) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at RunApp$_run_closure5.doCall(RunApp:149) at RunApp$_run_closure5.call(RunApp) at RunApp.runInline(RunApp:116) at RunApp.this$4$runInline(RunApp) at RunApp$_run_closure1.doCall(RunApp:59) at RunApp$_run_closure1.doCall(RunApp:33) at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) 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 gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.executeTargets(Gant.groovy:590) at gant.Gant.executeTargets(Gant.groovy:589) Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) prevIoUsly initiated loading for a different type with name "org/w3c/dom/DOMConfiguration" at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getDeclaredMethods(Class.java:1791) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at grails.spring.DynamicElementReader.invokeMethod(DynamicElementReader.groovy:121) ... 26 more
Here is my configuration:
dependencies { provided ('com.oracle:ojdbc6_g:11.2.0.1.0') runtime ('org.apache.poi:poi:3.7','org.apache.poi:poi-ooxml:3.7') }
How can I solve this problem? Thank you.
Solution
This is the repair we finally came back a few hours later In short, exclude xmlbeans from the POI, create another xmlbeans jar, and delete the offending class This is a spell to ward off evil
>Modify buildconfig groovy
dependencies { compile ('org.apache.poi:poi-ooxml:3.6') {excludes "xmlbeans"} }
>Extract xmlbeans
cd〜 mkdir xmlbeantmp cd xmlbeantmp cp〜/ . ivy2 / cache / org. apache. xmlbeans / xmlbeans / jars / xmlbeans-2.3. 0.jar. jar xf xmlbeans-2.3. 0.jar > delete illegal class package
CD org RM -rf W3C / > recreate jar
cd ../ rm xmlbean-2.3. 0.jar jar cf xmlbean-2.3. 0. Jar * > copy the jar to your project library
cp xmlbean-2.3. 0.jar your_ grails_ project / lib /. > Show love
Click the answer up arrow
The above is a collection of Java Lang. linkageerror: the loader constraint violation in Grails project is all about. I hope this article can help you solve the Java Lang. linkageerror: program development problem encountered by loader constraint violation in Grails project.
If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.