Grails - Class “org.grails.tomcat.TomcatLoader” was not found in the CLASSPATH

放肆的年华 提交于 2020-01-04 05:33:10

问题


grails run-app from within Eclipse is currently giving me the exception below for my Google App Engine/Grails test application:

Enhancing JDO classes
  [enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
  [enhance] Jan 24, 2010 5:11:42 AM org.datanucleus.metadata.MetaDataManager loadClasses
  [enhance] SEVERE: Class "org.grails.tomcat.TomcatLoader" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
  [enhance] org.datanucleus.exceptions.ClassNotResolvedException: Class "org.grails.tomcat.TomcatLoader" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
  [enhance]     at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:250)
  [enhance]     at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:415)
  [enhance]     at org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:379)
  [enhance]     at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:743)
  [enhance]     at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:545)
  [enhance]     at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1252)
  [enhance]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [enhance]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  [enhance]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  [enhance]     at java.lang.reflect.Method.invoke(Method.java:597)
  [enhance]     at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:57)
  [enhance]     at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:60)
  [enhance]     at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:41)
  [enhance] DataNucleus Enhancer completed with success for 0 classes. Timings : input=487 ms, enhance=0 ms, total=487 ms. Consult the log for full details
  [enhance] DataNucleus Enhancer completed and no classes were enhanced. Consult the log for full details

I get this error after creating a Grails project with Spring Tools Suite (STS) and then installing the app-engine plugin "grails install-plugin app-engine". Before, I install the app-engine plugin the Grails project runs correctly.

Any ideas?


回答1:


Have you tried uninstalling the Tomcat plugin? It is installed by default in a new app but looks like it causes issues when you use the GAE plugin.




回答2:


More than likely, the error message from DataNucleus Enhancer is deceiving. It probably can't find the dependent classes of org.grails.tomcat.TomcatLoader. Are all the dependent libs of the grails TomcatLoader class in your classpath? I had a similar situation -- the error message was incorrect.




回答3:


The reason why you are getting this error is that the tomcat plugin has not been uninstalled. Do the following steps :

  1. cd app_directory
  2. grails list-plugins

You will see a whole list of plugins and at the bottom will be a list of plugins installed for your app Note down the tomcat version_number

  1. grails uninstall-plugin tomcat version_number

The tomcat plugin will now be gone and you will not see the Tomcat loader error. I was getting a similar error when trying to use the grails app-engine plugin and it went away after the above steps.



来源:https://stackoverflow.com/questions/2128569/grails-class-org-grails-tomcat-tomcatloader-was-not-found-in-the-classpath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!