错误 context.GrailsContextLoader - 初始化应用程序时出错:创建名称为 'grailsApplication' 的 bean 在 ServletContext 中定义时出错
ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext
我更换了我的 PC,并将项目检出到新 PC,当我使用我的 war 构建时,它给出了这个错误,但是我的另一台 PC 构建正确,我使用 grails SDK 2.3.11 .我不知道错误可能是什么..
当我用我的旧电脑构建时它工作正常,我仔细检查了所有配置并且看起来都是正确的。
[localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: (class: privateserver/BulkExportService$EmptyResults, method: super$stream signature: ()Ljava/util/stream/Stream;) Illegal use of nonvirtual function call
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: (class: privateserver/BulkExportService$EmptyResults, method: super$stream signature: ()Ljava/util/stream/Stream;) Illegal use of nonvirtual function call
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.VerifyError: (class: privateserver/BulkExportService$EmptyResults, method: super$stream signature: ()Ljava/util/stream/Stream;) Illegal use of nonvirtual function call
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at privateserver.BulkExportService.<clinit>(BulkExportService.groovy:198)
at java.lang.Class.forName(Class.java:348)
... 5 more
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
<description>Grails application factory bean</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
<property name="grailsResourceLoader" ref="grailsResourceLoader" />
</bean>
<bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean">
<description>A bean that manages Grails plugins</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
<property name="application" ref="grailsApplication" />
</bean>
<bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
<constructor-arg>
<ref bean="grailsApplication" />
</constructor-arg>
<property name="pluginManager" ref="pluginManager" />
</bean>
<bean id="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean" />
<bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
<property name="encoding">
<value>utf-8</value>
</property>
</bean>
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean" />
</beans>
JDK Grails 2.3.11 不支持 8。 Grails 2.5 是我们添加了对 Java 8.
支持的第一个 Grails 版本
问题出在您的“BulkExportService”上,它可能不支持 java 1.8。
我更换了我的 PC,并将项目检出到新 PC,当我使用我的 war 构建时,它给出了这个错误,但是我的另一台 PC 构建正确,我使用 grails SDK 2.3.11 .我不知道错误可能是什么..
当我用我的旧电脑构建时它工作正常,我仔细检查了所有配置并且看起来都是正确的。
[localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: (class: privateserver/BulkExportService$EmptyResults, method: super$stream signature: ()Ljava/util/stream/Stream;) Illegal use of nonvirtual function call
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: (class: privateserver/BulkExportService$EmptyResults, method: super$stream signature: ()Ljava/util/stream/Stream;) Illegal use of nonvirtual function call
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.VerifyError: (class: privateserver/BulkExportService$EmptyResults, method: super$stream signature: ()Ljava/util/stream/Stream;) Illegal use of nonvirtual function call
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at privateserver.BulkExportService.<clinit>(BulkExportService.groovy:198)
at java.lang.Class.forName(Class.java:348)
... 5 more
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
<description>Grails application factory bean</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
<property name="grailsResourceLoader" ref="grailsResourceLoader" />
</bean>
<bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean">
<description>A bean that manages Grails plugins</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
<property name="application" ref="grailsApplication" />
</bean>
<bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
<constructor-arg>
<ref bean="grailsApplication" />
</constructor-arg>
<property name="pluginManager" ref="pluginManager" />
</bean>
<bean id="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean" />
<bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
<property name="encoding">
<value>utf-8</value>
</property>
</bean>
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean" />
</beans>
JDK Grails 2.3.11 不支持 8。 Grails 2.5 是我们添加了对 Java 8.
支持的第一个 Grails 版本问题出在您的“BulkExportService”上,它可能不支持 java 1.8。