Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
var/task/org/springframework/cglib/core/NamingPolicy.class(权限被拒绝)“&引用;errorType";:&引用;java.io.FileNotFoundException“;_Java_Spring Boot_Gradle_Aws Lambda_Spring Batch - Fatal编程技术网

var/task/org/springframework/cglib/core/NamingPolicy.class(权限被拒绝)“&引用;errorType";:&引用;java.io.FileNotFoundException“;

var/task/org/springframework/cglib/core/NamingPolicy.class(权限被拒绝)“&引用;errorType";:&引用;java.io.FileNotFoundException“;,java,spring-boot,gradle,aws-lambda,spring-batch,Java,Spring Boot,Gradle,Aws Lambda,Spring Batch,我的应用程序使用Spring boot+batch+gradle+aws Lambda。我不熟悉aws lambda的功能,当我在s3 bucket中上传jar时,它拥有所有的读取对象、读取对象权限和写入对象权限。当我测试lambda功能时,得到了fileNotFoundException。专家们有什么建议吗 "cause": { "errorMessage": "/var/task/org/springframework/cglib/core/NamingPolicy.class (Per

我的应用程序使用Spring boot+batch+gradle+aws Lambda。我不熟悉aws lambda的功能,当我在s3 bucket中上传jar时,它拥有所有的读取对象、读取对象权限和写入对象权限。当我测试lambda功能时,得到了fileNotFoundException。专家们有什么建议吗

"cause": {
  "errorMessage": "/var/task/org/springframework/cglib/core/NamingPolicy.class (Permission denied)",
  "errorType": "java.io.FileNotFoundException",
  "stackTrace": [
    "java.io.FileInputStream.open0(Native Method)",
    "java.io.FileInputStream.open(FileInputStream.java:195)",
    "java.io.FileInputStream.<init>(FileInputStream.java:138)",
    "sun.misc.URLClassPath$FileLoader$1.getInputStream(URLClassPath.java:1288)",
    "sun.misc.Resource.cachedInputStream(Resource.java:77)",
    "sun.misc.Resource.getByteBuffer(Resource.java:160)",
    "java.net.URLClassLoader.defineClass(URLClassLoader.java:454)",
    "java.net.URLClassLoader.access$100(URLClassLoader.java:73)",
    "java.net.URLClassLoader$1.run(URLClassLoader.java:368)",
    "java.net.URLClassLoader$1.run(URLClassLoader.java:362)",
    "java.security.AccessController.doPrivileged(Native Method)",
    "java.net.URLClassLoader.findClass(URLClassLoader.java:361)",
    "java.lang.ClassLoader.loadClass(ClassLoader.java:424)",
    "java.lang.ClassLoader.loadClass(ClassLoader.java:357)",
    "org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:394)",
    "org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254)",
    "org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:282)",
    "org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)",
    "org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)",
    "org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)",
    "org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)",
    "org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398)",
    "org.springframework.boot.SpringApplication.run(SpringApplication.java:330)",
    "org.springframework.boot.SpringApplication.run(SpringApplication.java:1258)",
    "org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)",
    "com.myapp.BatchMain.startApp(BatchMain.java:75)",
    "com.myapp.MyHandler.handleRequest(MyHandler.java:12)",
    "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
    "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)",
    "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
    "java.lang.reflect.Method.invoke(Method.java:498)"
  ]
}

您可以通过以下命令(linux操作系统)提供对
/var/task/org/springframework/cglib/core/NamingPolicy.class
的权限


请参阅:并通过在build.gradle中添加fileMode=0755解决了此问题

    buildscript {
         ext {
            springBootVersion = '2.0.1.RELEASE'
        }
        repositories {MavenCentral()}

        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
            classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5"
        }
    }

    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'org.springframework.boot'

    mainClassName ="com.myapp.MyHandler"

    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories { mavenCentral()}

    dependencies {

        compile 'org.springframework.batch:spring-batch-core:4.0.0.RELEASE'
        compile 'org.springframework.boot:spring-boot-starter-batch:2.0.4.RELEASE'
        compile 'org.springframework.boot:spring-boot-starter-data-jpa:2.0.4.RELEASE'
        compile 'com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8'
        compile 'junit:junit:4.12'  
        compile 'com.google.code.gson:gson:2.8.2'
        compile 'log4j:log4j:1.2.17'  
        compile 'org.springframework.boot:spring-boot-maven-plugin:2.0.5.RELEASE'

        compile 'com.amazonaws:aws-lambda-java-core:1.2.0'
        compile 'com.amazonaws:aws-lambda-java-events:2.1.0'
        compile 'ch.qos.logback:logback-classic:1.1.2'

    }

    bootJar {
        mainClassName = 'com.myapp.MyHandler'
    }


    //create a single Jar with all dependencies
      task fatJar(type: Jar) {
        manifest {
            attributes 'Main-Class': 'com.myapp.MyHandler'
        }
        baseName = 'all-in-one-jar'
        from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
        with jar
    }
task fatJar(type: Jar) {
manifest {
  attributes 'Main-Class': 'com.myapp.MyHandler'
}
fileMode = 0755

baseName = 'all-in-one-jar'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 
}
  with jar
}

我使用的是windows操作系统,在哪里可以找到ffmpeg文件?我相信你提到的文件是音频/视频文件,与我正在做的事情无关。更新了答案…对不起,我以前理解错了。如果问题仍然存在,请告诉我是否可以在gradle中执行此操作?您使用的是哪种操作系统?linux、windows还是mac?
task fatJar(type: Jar) {
manifest {
  attributes 'Main-Class': 'com.myapp.MyHandler'
}
fileMode = 0755

baseName = 'all-in-one-jar'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 
}
  with jar
}