복붙노트

[SPRING] 봄 부팅 mvc : 샘플을 따라 한 후에 실패 함

SPRING

봄 부팅 mvc : 샘플을 따라 한 후에 실패 함

나는 링크를 따라 가고있다. https://github.com/spring-guides/gs-serving-web-content

파일을 체크 아웃 한 후, gs-serving-web-content / complete를 IDEA로 가져 와서 실행하십시오. 그것은 성공적으로 실행되지만, http를 사용하여 다음과 같이 액세스하면 실패합니다.

http://127.0.0.1:8080/greating

메시지는 다음과 같습니다.

com.intellij.rt.execution.application.AppMain hello.Application

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.1.9.RELEASE)

2014-11-24 21:07:15.891  INFO 8060 --- [           main] hello.Application                        : Starting Application on SomeHost with PID 8060 (/home/oracle/spring/gs-serving-web-content/complete/build/classes/main started by oracle in /home/oracle/spring/gs-serving-web-content/complete)
2014-11-24 21:07:15.933  INFO 8060 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@11c20519: startup date [Mon Nov 24 21:07:15 CST 2014]; root of context hierarchy
2014-11-24 21:07:16.864  INFO 8060 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2014-11-24 21:07:17.878  INFO 8060 --- [           main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080
2014-11-24 21:07:18.132  INFO 8060 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2014-11-24 21:07:18.133  INFO 8060 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/7.0.56
2014-11-24 21:07:18.271  INFO 8060 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2014-11-24 21:07:18.272  INFO 8060 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2341 ms
2014-11-24 21:07:19.000  INFO 8060 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2014-11-24 21:07:19.004  INFO 8060 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2014-11-24 21:07:19.389  INFO 8060 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-11-24 21:07:19.596  INFO 8060 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String hello.GreetingController.greeting(java.lang.String,org.springframework.ui.Model)
2014-11-24 21:07:19.600  INFO 8060 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2014-11-24 21:07:19.601  INFO 8060 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2014-11-24 21:07:19.623  INFO 8060 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-11-24 21:07:19.624  INFO 8060 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-11-24 21:07:20.117  INFO 8060 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2014-11-24 21:07:20.201  INFO 8060 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2014-11-24 21:07:20.204  INFO 8060 --- [           main] hello.Application                        : Started Application in 4.892 seconds (JVM running for 5.351)
2014-11-24 21:07:26.582 ERROR 8060 --- [nio-8080-exec-1] o.a.coyote.http11.Http11NioProtocol      : Error reading request, ignored

java.lang.NoClassDefFoundError: org/apache/tomcat/util/log/UserDataHelper
    at org.apache.tomcat.util.http.Cookies.<clinit>(Cookies.java:42)
    at org.apache.coyote.Request.<init>(Request.java:131)
    at org.apache.coyote.AbstractProcessor.<init>(AbstractProcessor.java:61)
    at org.apache.coyote.http11.AbstractHttp11Processor.<init>(AbstractHttp11Processor.java:272)
    at org.apache.coyote.http11.Http11NioProcessor.<init>(Http11NioProcessor.java:69)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.createProcessor(Http11NioProtocol.java:260)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.createProcessor(Http11NioProtocol.java:139)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:586)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.log.UserDataHelper
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 14 common frames omitted
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
    at java.util.zip.ZipFile.read(Native Method)
    at java.util.zip.ZipFile.access$1400(ZipFile.java:61)
    at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:420)
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
    at sun.misc.Resource.getBytes(Resource.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:450)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
    ... 20 common frames omitted

2014-11-24 21:07:26.583 ERROR 8060 --- [nio-8080-exec-1] org.apache.tomcat.util.net.NioEndpoint   : 

java.lang.NullPointerException: null
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:722)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

2014-11-24 21:07:26.585 ERROR 8060 --- [nio-8080-exec-2] o.a.coyote.http11.Http11NioProtocol      : Error reading request, ignored

java.lang.NoClassDefFoundError: Could not initialize class org.apache.tomcat.util.http.Cookies
    at org.apache.coyote.Request.<init>(Request.java:131)
    at org.apache.coyote.AbstractProcessor.<init>(AbstractProcessor.java:61)
    at org.apache.coyote.http11.AbstractHttp11Processor.<init>(AbstractHttp11Processor.java:272)
    at org.apache.coyote.http11.Http11NioProcessor.<init>(Http11NioProcessor.java:69)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.createProcessor(Http11NioProtocol.java:260)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.createProcessor(Http11NioProtocol.java:139)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:586)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

2014-11-24 21:07:26.586 ERROR 8060 --- [nio-8080-exec-2] org.apache.tomcat.util.net.NioEndpoint   : 

java.lang.NullPointerException: null
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:722)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

2014-11-24 21:07:26.588 ERROR 8060 --- [nio-8080-exec-3] o.a.coyote.http11.Http11NioProtocol      : Error reading request, ignored

java.lang.NoClassDefFoundError: Could not initialize class org.apache.tomcat.util.http.Cookies
    at org.apache.coyote.Request.<init>(Request.java:131)
    at org.apache.coyote.AbstractProcessor.<init>(AbstractProcessor.java:61)
    at org.apache.coyote.http11.AbstractHttp11Processor.<init>(AbstractHttp11Processor.java:272)
    at org.apache.coyote.http11.Http11NioProcessor.<init>(Http11NioProcessor.java:69)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.createProcessor(Http11NioProtocol.java:260)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.createProcessor(Http11NioProtocol.java:139)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:586)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

2014-11-24 21:07:26.589 ERROR 8060 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint   : 

java.lang.NullPointerException: null
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:722)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

해결법

  1. ==============================

    1.다음과 같은

    다음과 같은

    java.lang.NoClassDefFoundError: org/apache/tomcat/util/log/UserDataHelper
    

    당신이 바람둥이 - july.jar가 부족하다는 것을 의미합니다.

    그러나, 다음은,

    Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
    

    종속성이 손상되었음을 의미합니다. 내 내기는 임베디드 바람둥이 의존성이 제대로 다운로드되지 않았을 것입니다. 내가 너라면, .m2 \ repository \ org \ apache \ tomcat \ embed를 백업하고 삭제하고 예제를 다시 실행하여 종속성을 다시 다운로드한다.

  2. from https://stackoverflow.com/questions/27105619/spring-boot-mvc-failed-after-following-the-sample by cc-by-sa and MIT license