gpt4 book ai didi

eclipse - java.lang.NoClassDefFoundError : Lorg/openspaces/core/GigaSpace 错误

转载 作者:行者123 更新时间:2023-11-28 22:20:15 25 4
gpt4 key购买 nike

我正在尝试将 Gigaspaces 与 Spring 结合使用!我有两个 eclipse 项目。消耗 Gigaspaces 空间的 spring rest-service(另一个 eclipse 项目)。我有一个 master eclipse 项目,我有两个项目。

我的问题是我想在我的 Tomcat v7.0 上部署我的 rest-service,它崩溃了并告诉我:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.payulatam.prototype.services.IClientService com.payulatam.prototype.controllers.ClientController.clientService; nested exception is java.lang.NoClassDefFoundError: Lorg/openspaces/core/GigaSpace;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
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:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

tomcat 似乎找不到 gigaspace 的 jar 。但我将它们包含在我的 pom.xml 中:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.payulatam.prototype</groupId>
<artifactId>rest-service</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>rest-service</name>
<url>http://maven.apache.org</url>

<parent>
<groupId>com.payulatam.prototype</groupId>
<artifactId>PayUBank</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<properties>
<gsVersion>9.6.2-9900-RELEASE</gsVersion>
<spring.version>3.2.2.RELEASE</spring.version>
<jackson.version>1.9.10</jackson.version>
<jdk.version>1.6</jdk.version>
</properties>

<dependencies>
<dependency>
<groupId>com.gigaspaces</groupId>
<artifactId>gs-openspaces</artifactId>
<version>${gsVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.payulatam.prototype</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>

<!-- Jackson JSON Mapper -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
</dependencies>

<build>
<finalName>rest-service</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>

知道如何解决吗?

最佳答案

您在放置 <scope>provided</scope> 时指定 com.gigaspaces 将由您正在使用的服务器或执行程序服务提供在 com.gigaspaces 的依赖声明中,根据堆栈跟踪所述,您在类路径中缺少它。

这里最有可能的情况是服务器提供的不是 bieng,所以尝试删除/更改行<scope>provided</scope><scope>compile</scope>在您的 pom 中用于 Gigaspaces 库的依赖声明;所以 Maven 将是提供它的人。

帮助来自:Difference between compile and provided scope

关于eclipse - java.lang.NoClassDefFoundError : Lorg/openspaces/core/GigaSpace 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23831310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com