无法在AWS EC2上运行JAR文件 - 无法创建将存储上传文件的目录

发布于 2025-02-08 23:52:10 字数 18644 浏览 1 评论 0原文

我能够从本地运行JAR文件。但是,当我确实将代码上传到Ubuntu 18.4服务器AWS EC2时,我无法运行JAR文件。

通过说java -jar myjarfilename.jar

获取错误 -

无法创建存储上传文件的目录。

详细信息错误错误 -

slf4j:类路径包含多个SLF4J绑定。 SLF4J: Found binding in [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class] slf4j:在[jar:file:/home/ubuntu/.m2/repository/ch/qos/logback/logback/logback-classic/1.2.3/logback-classic-1.2.3.3.jar一下! /staticloggerbinder.class] slf4j:请参阅 http:///www.slf4j.org/codes.htmllutpiple_bindiple_bindiper_bindiper_bindings

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v0.0.1-SNAPSHOT)

2022-06-20 16:44:41.543  INFO 21492 --- [           main] c.s.app.SeamlesschequeApiApplication     : Starting SeamlesschequeApiApplication v0.0.1-SNAPSHOT on ip-172-26-5-71 with PID 21492 (/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar started by ubuntu in /home/ubuntu/echeckinfo-backend/target)
2022-06-20 16:44:41.566  INFO 21492 --- [           main] c.s.app.SeamlesschequeApiApplication     : No active profile set, falling back to default profiles: default
2022-06-20 16:44:41.717  INFO 21492 --- [           main] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-06-20 16:44:41.718  INFO 21492 --- [           main] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-06-20 16:44:45.398  INFO 21492 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2022-06-20 16:44:45.402  INFO 21492 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2022-06-20 16:44:45.817  INFO 21492 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 407ms. Found 25 repository interfaces.
2022-06-20 16:44:46.706  INFO 21492 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'seamlesschequeApiApplication' of type [com.seamlesscheque.app.SeamlesschequeApiApplication$$EnhancerBySpringCGLIB$$be13dd17] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-06-20 16:44:47.528  INFO 21492 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 5000 (http)
2022-06-20 16:44:47.602  INFO 21492 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-06-20 16:44:47.603  INFO 21492 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.13
2022-06-20 16:44:47.621  INFO 21492 --- [           main] 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]
2022-06-20 16:44:47.792  INFO 21492 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-06-20 16:44:47.793  INFO 21492 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 6075 ms
2022-06-20 16:44:48.534  INFO 21492 --- [           main] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[139.59.18.83:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2022-06-20 16:44:48.799  INFO 21492 --- [.59.18.83:27017] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:6108}] to 139.59.18.83:27017
2022-06-20 16:44:48.833  INFO 21492 --- [.59.18.83:27017] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=139.59.18.83:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[5, 0, 0]}, minWireVersion=0, maxWireVersion=13, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=29872868}
2022-06-20 16:44:50.226  INFO 21492 --- [           main] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:6109}] to 139.59.18.83:27017
2022-06-20 16:44:51.877  WARN 21492 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileController': Unsatisfied dependency expressed through field 'fileService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileServiceImpl' defined in URL [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/com/seamlesscheque/app/service/FileServiceImpl.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
2022-06-20 16:44:51.890  INFO 21492 --- [           main] org.mongodb.driver.connection            : Closed connection [connectionId{localValue:2, serverValue:6109}] to 139.59.18.83:27017 because the pool has been closed.
2022-06-20 16:44:51.895  INFO 21492 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-06-20 16:44:51.943  INFO 21492 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-06-20 16:44:51.955 ERROR 21492 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileController': Unsatisfied dependency expressed through field 'fileService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileServiceImpl' defined in URL [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/com/seamlesscheque/app/service/FileServiceImpl.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at com.seamlesscheque.app.SeamlesschequeApiApplication.main(SeamlesschequeApiApplication.java:37) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_312]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_312]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_312]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_312]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.thin.ThinJarLauncher.launch(ThinJarLauncher.java:193) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.thin.ThinJarLauncher.main(ThinJarLauncher.java:140) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_312]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_312]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_312]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_312]
    at org.springframework.boot.loader.wrapper.ThinJarWrapper.launch(ThinJarWrapper.java:140) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.wrapper.ThinJarWrapper.main(ThinJarWrapper.java:107) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileServiceImpl' defined in URL [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/com/seamlesscheque/app/service/FileServiceImpl.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:304) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:285) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1154) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 34 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 47 common frames omitted
Caused by: com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at com.seamlesscheque.app.service.FileServiceImpl.<init>(FileServiceImpl.java:46) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_312]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_312]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_312]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_312]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 49 common frames omitted
Caused by: java.nio.file.AccessDeniedException: /home/echeckpiiweb
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[na:1.8.0_312]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[na:1.8.0_312]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[na:1.8.0_312]
    at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[na:1.8.0_312]
    at java.nio.file.Files.createDirectory(Files.java:674) ~[na:1.8.0_312]
    at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[na:1.8.0_312]
    at java.nio.file.Files.createDirectories(Files.java:767) ~[na:1.8.0_312]
    at com.seamlesscheque.app.service.FileServiceImpl.<init>(FileServiceImpl.java:44) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 54 common frames omitted

I can able to run the JAR file from local. But When I did uploaded the code to the Ubuntu 18.4 server AWS EC2, I am not able to run the JAR file.

By saying java -jar MyjarfileName.jar

Getting Error -

Could not create the directory where the uploaded files will be stored.

Details Error -

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/ubuntu/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v0.0.1-SNAPSHOT)

2022-06-20 16:44:41.543  INFO 21492 --- [           main] c.s.app.SeamlesschequeApiApplication     : Starting SeamlesschequeApiApplication v0.0.1-SNAPSHOT on ip-172-26-5-71 with PID 21492 (/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar started by ubuntu in /home/ubuntu/echeckinfo-backend/target)
2022-06-20 16:44:41.566  INFO 21492 --- [           main] c.s.app.SeamlesschequeApiApplication     : No active profile set, falling back to default profiles: default
2022-06-20 16:44:41.717  INFO 21492 --- [           main] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-06-20 16:44:41.718  INFO 21492 --- [           main] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-06-20 16:44:45.398  INFO 21492 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2022-06-20 16:44:45.402  INFO 21492 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2022-06-20 16:44:45.817  INFO 21492 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 407ms. Found 25 repository interfaces.
2022-06-20 16:44:46.706  INFO 21492 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'seamlesschequeApiApplication' of type [com.seamlesscheque.app.SeamlesschequeApiApplication$EnhancerBySpringCGLIB$be13dd17] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-06-20 16:44:47.528  INFO 21492 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 5000 (http)
2022-06-20 16:44:47.602  INFO 21492 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-06-20 16:44:47.603  INFO 21492 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.13
2022-06-20 16:44:47.621  INFO 21492 --- [           main] 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]
2022-06-20 16:44:47.792  INFO 21492 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-06-20 16:44:47.793  INFO 21492 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 6075 ms
2022-06-20 16:44:48.534  INFO 21492 --- [           main] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[139.59.18.83:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2022-06-20 16:44:48.799  INFO 21492 --- [.59.18.83:27017] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:6108}] to 139.59.18.83:27017
2022-06-20 16:44:48.833  INFO 21492 --- [.59.18.83:27017] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=139.59.18.83:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[5, 0, 0]}, minWireVersion=0, maxWireVersion=13, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=29872868}
2022-06-20 16:44:50.226  INFO 21492 --- [           main] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:6109}] to 139.59.18.83:27017
2022-06-20 16:44:51.877  WARN 21492 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileController': Unsatisfied dependency expressed through field 'fileService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileServiceImpl' defined in URL [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/com/seamlesscheque/app/service/FileServiceImpl.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
2022-06-20 16:44:51.890  INFO 21492 --- [           main] org.mongodb.driver.connection            : Closed connection [connectionId{localValue:2, serverValue:6109}] to 139.59.18.83:27017 because the pool has been closed.
2022-06-20 16:44:51.895  INFO 21492 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-06-20 16:44:51.943  INFO 21492 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-06-20 16:44:51.955 ERROR 21492 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileController': Unsatisfied dependency expressed through field 'fileService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileServiceImpl' defined in URL [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/com/seamlesscheque/app/service/FileServiceImpl.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at com.seamlesscheque.app.SeamlesschequeApiApplication.main(SeamlesschequeApiApplication.java:37) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_312]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_312]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_312]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_312]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.thin.ThinJarLauncher.launch(ThinJarLauncher.java:193) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at org.springframework.boot.loader.thin.ThinJarLauncher.main(ThinJarLauncher.java:140) [spring-boot-thin-launcher-1.0.23.RELEASE-exec.jar:1.0.23.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_312]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_312]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_312]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_312]
    at org.springframework.boot.loader.wrapper.ThinJarWrapper.launch(ThinJarWrapper.java:140) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.wrapper.ThinJarWrapper.main(ThinJarWrapper.java:107) [seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileServiceImpl' defined in URL [jar:file:/home/ubuntu/echeckinfo-backend/target/seamlesscheque-api-0.0.1-SNAPSHOT.jar!/com/seamlesscheque/app/service/FileServiceImpl.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:304) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:285) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1154) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 34 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.seamlesscheque.app.service.FileServiceImpl]: Constructor threw exception; nested exception is com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 47 common frames omitted
Caused by: com.seamlesscheque.app.exception.FileStorageException: Could not create the directory where the uploaded files will be stored.
    at com.seamlesscheque.app.service.FileServiceImpl.<init>(FileServiceImpl.java:46) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_312]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_312]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_312]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_312]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 49 common frames omitted
Caused by: java.nio.file.AccessDeniedException: /home/echeckpiiweb
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[na:1.8.0_312]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[na:1.8.0_312]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[na:1.8.0_312]
    at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[na:1.8.0_312]
    at java.nio.file.Files.createDirectory(Files.java:674) ~[na:1.8.0_312]
    at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[na:1.8.0_312]
    at java.nio.file.Files.createDirectories(Files.java:767) ~[na:1.8.0_312]
    at com.seamlesscheque.app.service.FileServiceImpl.<init>(FileServiceImpl.java:44) ~[seamlesscheque-api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    ... 54 common frames omitted

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

咿呀咿呀哟 2025-02-15 23:52:11

我解决了这个问题。为了运行此功能 -

首先,我们必须以sudo模式运行我们的项目。

sudo java -jar myjarfilename.jar

注意 -

  1. 确保已安装Java

    • sudo apt-update
    • sudo apt-get安装openjdk-8-jre openjdk-8-jdk)
    • 导出java_home =/usr/lib/jvm/java-8-openjdk-amd64/
    • java -version
  2. 确保已安装了Maven

    • sudo apt-get安装maven
    • mvn -version
  3. 确保您能够构建应用程序

注意 - 它需要一些时间开始。一旦开始,您就可以运行应用程序,它将创建所有目录,可以删除sudo,然后再次运行它。通过说 -

java -jar myjarfileName.jar

I have solve this problem. In order to run this -

First we have to run our project in sudo mode.

sudo java -jar myjarfileName.jar

Note -

  1. Make sure you have java installed

    • sudo apt-update
    • sudo apt-get install openjdk-8-jre openjdk-8-jdk)
    • export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
    • java -version
  2. Make sure you have maven installed

    • sudo apt-get install maven
    • mvn -version
  3. Make sure you can able to build your application

Note - It will take some of the time to start. Once its start, you can ran your application, it will create all the directory, you can remove sudo, and ran it again. by saying -

java -jar myjarfileName.jar
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文