- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试从终端在 linux 中运行一个 jar 文件(打包的),但它一直失败。它在 eclipse 中运行得很好,但是当我尝试从终端运行它时,它失败了。该应用程序只是一个小服务,因为我正在学习 spring 框架。这是我在终端中得到的:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::
2018-01-05 11:23:19.793 INFO 20547 --- [ main] one.demo.SpringbootApplication : Starting SpringbootApplication on mumen-S400CA with PID 20547 (/home/mumen/Downloads/demo/target/. started by mumen in /home/mumen/Downloads/demo/target)
2018-01-05 11:23:19.799 INFO 20547 --- [ main] one.demo.SpringbootApplication : No active profile set, falling back to default profiles: default
2018-01-05 11:23:20.090 INFO 20547 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@42505474: startup date [Fri Jan 05 11:23:20 GST 2018]; root of context hierarchy
2018-01-05 11:23:20.637 WARN 20547 --- [ main] .i.s.PathMatchingResourcePatternResolver : Cannot search for matching files underneath URL [rsrc:one/demo/] because it does not correspond to a directory in the file system
java.io.FileNotFoundException: URL [rsrc:one/demo/] cannot be resolved to absolute file path because it does not reside in the file system: rsrc:one/demo/
at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:217) ~[jar:rsrc:spring-core-5.0.2.RELEASE.jar!/:na]
at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:70) ~[jar:rsrc:spring-core-5.0.2.RELEASE.jar!/:na]
at org.springframework.core.io.UrlResource.getFile(UrlResource.java:225) ~[jar:rsrc:spring-core-5.0.2.RELEASE.jar!/:na]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:699) [jar:rsrc:spring-core-5.0.2.RELEASE.jar!/:na]
at org.springframework.web.context.support.ServletContextResourcePatternResolver.doFindPathMatchingFileResources(ServletContextResourcePatternResolver.java:92) [jar:rsrc:spring-web-5.0.2.RELEASE.jar!/:na]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:512) [jar:rsrc:spring-core-5.0.2.RELEASE.jar!/:na]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:282) [jar:rsrc:spring-core-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1305) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.support.GenericApplicationContext.getResources(GenericApplicationContext.java:238) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:421) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:275) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:284) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:241) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:198) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:166) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:138) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:751) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:387) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at one.demo.SpringbootApplication.main(SpringbootApplication.java:10) [rsrc:./:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) [spring-boot.jar:na]
2018-01-05 11:23:59.663 INFO 20547 --- [ main] o.h.v.i.engine.ValidatorFactoryImpl : HV000238: Temporal validation tolerance set to 0.
2018-01-05 11:24:04.427 INFO 20547 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8085 (http)
2018-01-05 11:24:05.130 INFO 20547 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-01-05 11:24:05.198 INFO 20547 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23
2018-01-05 11:24:05.559 INFO 20547 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
2018-01-05 11:24:06.720 ERROR 20547 --- [cat-startStop-1] org.apache.catalina.core.ContainerBase : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_151]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_151]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@6f73792a]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:113) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4860) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4995) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
... 6 common frames omitted
Caused by: java.lang.Error: factory already defined
at java.net.URL.setURLStreamHandlerFactory(URL.java:1112) ~[na:1.8.0_151]
at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:130) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:53) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:77) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:682) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
... 10 common frames omitted
2018-01-05 11:24:06.722 ERROR 20547 --- [ main] org.apache.catalina.core.ContainerBase : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_151]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_151]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:367) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:98) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:84) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:413) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:176) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:177) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:150) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) [jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:138) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:751) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:387) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at one.demo.SpringbootApplication.main(SpringbootApplication.java:10) [rsrc:./:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) [spring-boot.jar:na]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_151]
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
... 6 common frames omitted
2018-01-05 11:24:06.723 WARN 20547 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2018-01-05 11:24:06.739 INFO 20547 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-01-05 11:24:06.743 ERROR 20547 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[jar:rsrc:spring-context-5.0.2.RELEASE.jar!/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:138) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:751) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:387) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at one.demo.SpringbootApplication.main(SpringbootApplication.java:10) [rsrc:./:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) [spring-boot.jar:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:117) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:84) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:413) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:176) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:177) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:150) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
... 13 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:367) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:98) ~[jar:rsrc:spring-boot-2.0.0.BUILD-SNAPSHOT.jar!/:na]
... 18 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
... 20 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
... 22 common frames omitted
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[jar:rsrc:tomcat-embed-core-8.5.23.jar!/:na]
... 24 common frames omitted
这是主类:
package one.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootApplication.class, args);
}
}
这是 Controller :
package one.demo;
import java.util.ArrayList;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class BooksController {
@GetMapping("/books")
public List<Book> GetAllBooks(){
List<Book> books = new ArrayList<Book>();
books.add(new Book(11, "mo2men book", "mo2men"));
return books;
}
}
这是书类:
package one.demo;
public class Book {
long id;
String name;
String author;
public long getId() {
return id;
}
public String getName() {
return name;
}
public String getAuthor() {
return author;
}
public Book(int id, String name, String author) {
super();
this.id = id;
this.name = name;
this.author = author;
}
@Override
public String toString() {
return "Book [id=" + id + ", name=" + name + ", author=" + author + "]";
}
}
这是 pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>one</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
最佳答案
尝试将此依赖项添加到您的 POM。
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
关于Java 终端失败,eclipse 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48125568/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!