1
我正在將我的grails應用程序移動到新的服務器,並且run-app失敗(詳細的堆棧跟蹤如下)。Grails沒有拾取已編譯的java .class文件
Grails宣稱缺少文件(「AutocompleteEntity」)是一個java源文件。它必須被編譯,因爲我在目標目錄中看到了Autocomplete.class。
我試過各種各樣的組合grails乾淨,rm'ing .grails等沒有運氣。我很困惑!
[email protected]:~/macademia/Macademia$ grails run-app --stacktrace --verbose
Base Directory: /home/shilad/macademia/Macademia
| Configuring classpath
| Error SLF4J: Class path contains multiple SLF4J bindings.
| Error SLF4J: Found binding in [jar:file:/home/shilad/.m2/repository/org/grails/grails-plugin-log4j/2.3.7/grails-plugin-log4j-2.3.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: Found binding in [jar:file:/home/shilad/.m2/repository/org/slf4j/slf4j-jdk14/1.7.5/slf4j-jdk14-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
| Error SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
| Error SLF4J: Actual binding is of type [org.slf4j.impl.GrailsSlf4jLoggerFactory]
| Compiling 1 source files
| Compiling 1 source files.....
| Running Grails application
| Error Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass
java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass
at org.codehaus.groovy.grails.commons.ArtefactHandlerAdapter.newArtefactClass(ArtefactHandlerAdapter.java:117)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:812)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:538)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.configureLoadedClasses(DefaultGrailsApplication.java:259)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initialise(DefaultGrailsApplication.java:743)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader$_loadPlugins_closure2.doCall(GrailsProjectPluginLoader.groovy:124)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader$_loadPlugins_closure2.doCall(GrailsProjectPluginLoader.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1086)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
at groovy.lang.Closure.call(Closure.java:411)
at groovy.lang.Closure.call(Closure.java:405)
at org.codehaus.groovy.grails.cli.api.BaseSettingsApi.profile(BaseSettingsApi.java:354)
at org.codehaus.groovy.grails.project.plugins.GrailsProjectPluginLoader.loadPlugins(GrailsProjectPluginLoader.groovy:91)
at org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean.afterPropertiesSet(GrailsPluginManagerFactoryBean.java:74)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:70)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4961)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5455)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor13.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:986)
at org.codehaus.groovy.grails.commons.ArtefactHandlerAdapter.newArtefactClass(ArtefactHandlerAdapter.java:108)
... 46 more
Caused by: java.lang.TypeNotPresentException: Type AutocompleteEntity not present
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.MethodRepository.getReturnType(MethodRepository.java:68)
at java.lang.reflect.Method.getGenericReturnType(Method.java:245)
at java.beans.FeatureDescriptor.getReturnType(FeatureDescriptor.java:370)
at java.beans.Introspector.getTargetEventInfo(Introspector.java:954)
at java.beans.Introspector.getBeanInfo(Introspector.java:415)
at java.beans.Introspector.getBeanInfo(Introspector.java:161)
at org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:45)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:270)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:186)
at org.springframework.beans.BeanUtils.getPropertyDescriptors(BeanUtils.java:360)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.init(ClassPropertyFetcher.java:193)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.<init>(ClassPropertyFetcher.java:91)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:82)
at org.codehaus.groovy.grails.commons.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:63)
at org.codehaus.groovy.grails.commons.AbstractGrailsClass.<init>(AbstractGrailsClass.java:84)
at org.codehaus.groovy.grails.commons.AbstractInjectableGrailsClass.<init>(AbstractInjectableGrailsClass.java:29)
at org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass.<init>(DefaultGrailsServiceClass.java:30)
... 51 more
Caused by: java.lang.ClassNotFoundException: AutocompleteEntity
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:648)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:758)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:746)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
... 76 more
| Error Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass
| Error Forked Grails VM exited with error
| Server running. Browse to http://localhost:8080/Macademia
你的新盒子有意義的改變了Java版本嗎?你可以首先運行一個''grails clean'',然後在你的主目錄''〜/ .grails/.slcahce''中移除並重試?或許是你複製的舊東西。 – cfrick
我試了一下,沒有改變。 FWIW,新的盒子有java 7,我的開發盒子有java 6,但我從源碼重建了grails項目。 –
提到的類是你的類還是來自插件 - 似乎沒有默認的grails。如果它是你的一個,你能確定,源代碼是a)在一個檢測到的源代碼目錄中(例如src/{lang})b)它的包與它所在的directroy相匹配c)類名是與文件名完全一樣。 – cfrick