5

我正在编写一个 GWT 项目,并且能够运行它。当我单独集成 Spring 时,它可以工作,但后来我尝试集成 Hibernate,这把事情搞砸了。我收到以下错误。

我尝试通过 Spring 的源代码进行调试,但不幸的是我没有看到它从哪里抛出异常。

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read    
candidate component class: file [C:\ws\TicTacToe\war\WEB-INF\classes\com\tic\server\dao\entity\UserEntity.class]; nested exception is 
java.lang.ArrayIndexOutOfBoundsException: 165: java.lang.ArrayIndexOutOfBoundsException: 165

我相信这没有多大意义。这是完整的错误跟踪:

WARNING: Nested in org.springframework.beans.factory.BeanDefinitionStoreException:    
Failed to read candidate component class: file [C:\all-development-tools\all-
eclipse\eclipse-kepler\ws\TicTacToe\war\WEB-
INF\classes\com\tic\server\dao\entity\UserEntity.class]; nested exception is  
java.lang.ArrayIndexOutOfBoundsException: 165:
java.lang.ArrayIndexOutOfBoundsException: 165
at org.springframework.asm.ClassReader.readLabel(Unknown Source)
at org.springframework.asm.ClassReader.a(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:64)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:257)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)
at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:123)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:219)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:154)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:140)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:282)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:249)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:306)
at com.google.appengine.tools.development.AutomaticInstanceHolder.startUp(AutomaticInstanceHolder.java:26)
at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:79)
at com.google.appengine.tools.development.Modules.startup(Modules.java:88)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:241)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)

编辑:

package com.tic.server.dao.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "USER")
public class UserEntity implements Serializable {
private static final long serialVersionUID = -329211977029380182L;

@Id
@GeneratedValue
@Column(name = "ID")
private Long id;

@Column(name = "NAME")
private String name;

@Column(name = "CITY")
private String city;

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getCity() {
    return city;
}

public void setCity(String city) {
    this.city = city;
}

}
4

2 回答 2

4

此错误的另一个原因是在运行 Java 8 lambda 的项目上使用 Spring 3。Spring 3 不支持 lambda,因此您需要升级到 Spring 4 或从代码中删除所有 lambda。这是此异常的更常见情况。

于 2020-07-15T14:17:19.010 回答
1

得到了这个问题的答案。我会说一个部分答案:

这是我想在 GAE 上上传的 GWT 应用程序,所以我有所有的 GAE jar,在我删除它们并删除 appengine 配置的那一刻,我能够成功运行它。

于 2013-09-06T19:10:07.253 回答