Ausnahme, die während der Kontextinitialisierung auftreten - Aufbrechen Aktualisierungsversuch: org.springframework.bean

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Ausnahme, die während der Kontextinitialisierung auftreten - Aufbrechen Aktualisierungsversuch: org.springframework.bean

by Anonymous » 18 Aug 2025, 14:02

Führen Sie meine Spring -Boot -Anwendung (Beispielprogramm zum Posten von Jason in Spring Ruhestand Webvise WebService) in Eclipse erfolgreich aus. Wenn ich jedoch den Befehl MVN -Paket verwende, um die JAR -Datei abzurufen. Habe die folgende Nachricht. Jeder könnte helfen. < /P>

Code: Select all

: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'controllerSimple' defined in file
< /code>

 controllerSimple.java

package com.example;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ControllerSimple {

AddressList addressList;
ControllerSimple (){
addressList = new AddressList();
}

@RequestMapping("/hello")
public String index() {
return "Hello World";
}

@RequestMapping(value="/crud_c_final", method=RequestMethod.POST)
public ResponseEntity create_key(@RequestBody AnEntity anentity) throws SMException, IOException{

System.out.println("request create received!");
if(anentity!=null){
String key = anentity.getKey();
String name = anentity.getValue().getName();
String address = anentity.getValue().getAddress();

...
...
}
< /code>

MVN Paket erhalten folgende Nachricht: < /p>

   :: Spring Boot ::        (v1.3.3.RELEASE)

2016-04-12 00:41:16.113  INFO 16920 --- [           main] com.example.DemoApplicationTests         : Starting DemoApplicationTests on WINDOWS-80KONH6 with PID 16920 (C:\Users\MyPC\workspace\springb\target\test-classes started by MyPC in C:\Users\MyPC\workspace\springb)

2016-04-12 00:41:16.114  INFO 16920 --- [           main] com.example.DemoApplicationTests         : No active profile set, falling back to default profiles: default

2016-04-12 00:41:16.231  INFO 16920 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1197a46: startup date [Tue Apr 12 00:41:16 PDT 2016]; root of context hierarchy
2016-04-12 00:41:18.951  WARN 16920 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'controllerSimple' defined in file [C:\Users\MyPC\workspace\springb\target\classes\com\example\ControllerSimple.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.ControllerSimple]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/poi/util/HexDump

2016-04-12 00:41:18.968 ERROR 16920 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'controllerSimple' defined in file [C:\Users\MyPC\workspace\springb\target\classes\com\example\ControllerSimple.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.ControllerSimple]: Constructor threw exception;  nested exception is java.lang.NoClassDefFoundError: org/apache/poi/util/HexDump

at       rg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at     org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]

at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]

at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) [spring-test-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) [spring-test-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) [spring-test-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) [spring-test-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) [spring-test-4.2.5.RELEASE.jar:4.2.5.RELEASE]

at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228) [spring-test-4.2.5.RELEASE.jar:4.2.5.RELEASE]
< /code>

pom.xml



4.0.0

com.example
demo
0.0.1-SNAPSHOT
jar

demo
Demo project for Spring Boot


org.springframework.boot
spring-boot-starter-parent
1.3.3.RELEASE
  



UTF-8
1.8




org.springframework.boot
spring-boot-starter



org.apache.tomcat.embed
tomcat-embed-jasper
provided



javax.servlet
jstl



org.springframework.boot
spring-boot-starter-test
test



org.springframework.boot
spring-boot-starter-web






org.springframework.boot
spring-boot-maven-plugin



< /code>

< /p>

Der verbleibende Fehler kann die Hauptklasse nicht finden. < /p>

:[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin
:1.3.3.RELEASE:repackage (default) on project demo: Execution default of goal or
g.springframework.boot:spring-boot-maven-plugin:1.3.3.RELEASE:repackage failed:
Unable to find a single main class from the following candidates [com.example.De
moApplication, com.example.FileStorage, com.example.RandomGUID] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException

Top