简体   繁体   English

未捕获的 ReflectionException:Class 请求在 Jenkins 中不存在

[英]Uncaught ReflectionException: Class request does not exist in Jenkins

I have jenkins up and running on a laravel project.我在 laravel 项目上启动并运行了 jenkins。 It was working normally till some days ago, then some weird error started to pop up.几天前它一直在正常工作,然后开始弹出一些奇怪的错误。

PHP Fatal error:  Uncaught ReflectionException: Class request does not exist in /var/lib/jenkins/workspace/Test_fix_changing-jenkinsfile/vendor/laravel/framework/src/Illuminate/Container/Container.php:809

I did some digging on the inte.net, i have cleaned and chmod 777 into my bootstrap/cache folder also checked my CreatesApplication.php to make sure i'm importing Kernel from the right place use Illuminate\Contracts\Console\Kernel;我在 inte.net 上做了一些挖掘,我已经清理并chmod 777进入我的bootstrap/cache文件夹还检查了我的CreatesApplication.php以确保我从正确的地方导入 Kernel use Illuminate\Contracts\Console\Kernel; everyting seams normal to me.一切接缝对我来说都很正常。 This error show regardless if all tests passes or fail and this is only happening inside jenkins.无论所有测试通过还是失败,都会显示此错误,并且这仅发生在 jenkins 内部。

I'm using Laravel version 7.30 here's my jenkis file.我正在使用 Laravel 版本 7.30 这是我的 jenkis 文件。

pipeline {
  agent any
    environment {
    GIT_COMMIT_SHORT = "a${env.GIT_COMMIT.take(7)}"
    DB_DATABASE_AUX = "a${env.GIT_COMMIT.take(7)}"
  }
  stages {
    stage("Build") {
      steps {
        sh 'cp ../.env .'
        sh 'php --version'
        sh 'composer install'
        sh 'composer --version'
        sh 'composer dump-autoload'
        sh 'php artisan key:generate'
      }
    }
    stage('Test backend') {
      steps {
          sh '/usr/bin/php artisan mysql:createdb $GIT_COMMIT_SHORT'
          sh '/usr/bin/php artisan clear-compiled'
          sh '/usr/bin/php artisan optimize'
          sh '/usr/bin/php artisan route:clear'
          sh '/usr/bin/php artisan view:clear'
          sh '/usr/bin/php artisan cache:clear'
          sh 'echo ""DB_DATABASE=${DB_DATABASE_AUX}>> .env'
          sh 'chmod 777 bootstrap/cache'
          sh '/usr/bin/php artisan config:cache'
          sh '/usr/bin/php artisan config:clear'
          sh '/usr/bin/php artisan optimize:clear'
          sh '/usr/bin/php artisan migrate:fresh'
          sh '/usr/bin/php artisan passport:install'
          sh '/usr/bin/php vendor/bin/phpunit tests/Unit/ --stop-on-failure'
          sh '/usr/bin/php vendor/bin/phpunit tests/Feature/ --stop-on-failure'
      }
      post {
        always {
          sh '/usr/bin/php artisan mysql:deletedb $GIT_COMMIT_SHORT'
        }
      }
    }
  }
}

Any idea on how to deal with it would be welcome.欢迎任何关于如何处理它的想法。

That error suggests that you're trying to access the request before it's been bound to the service container.该错误表明您在将请求绑定到服务容器之前尝试访问该请求。 This would happen if you're using the request() helper or Request facade before a request has been passed to the Http Kernel.如果在将请求传递到 Http Kernel 之前使用request()帮助程序或Request facade,就会发生这种情况。

Is it possible that you added new code that may be trying to access the request in your tests before you've run $this->get() or any other HTTP helper method?在运行$this->get()或任何其他 HTTP 辅助方法之前,您是否可能添加了可能试图在测试中访问请求的新代码?

In Laravel 7, this is where "request" is bound to the container and this is where the container is failing (based on your error message).在 Laravel 7 中, 这是"request"绑定到容器的地方,也是容器失败的地方(根据您的错误消息)。 This means that the container is trying to resolve request as a class instead of use an instance that's already been bound to that name.这意味着容器正在尝试将request解析为 class,而不是使用已经绑定到该名称的实例。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ReflectionException,类不存在 - ReflectionException, class does not exist Laravel-未捕获的ReflectionException:类日志不存在-配置错误 - Laravel - Uncaught ReflectionException: Class log does not exist - Config error Uncaught ReflectionException:envoyer部署中不存在类哈希 - Uncaught ReflectionException: Class hash does not exist in envoyer deploy 消息“类XXX不存在”的教义未捕获的异常“ Re​​flectionException” - Doctrine Uncaught exception 'ReflectionException' with message 'Class XXX does not exist' 致命错误:未捕获的 ReflectionException:Class “env”不存在 - Fatal error: Uncaught ReflectionException: Class "env" does not exist 如何使用消息“类日志不存在”修复未捕获的异常“ Re​​flectionException”? - How to fix Uncaught exception 'ReflectionException' with message 'Class log does not exist'? Symfony 4:DependencyInjection组件-未捕获的ReflectionException:类不存在 - Symfony 4: DependencyInjection Component - Uncaught ReflectionException: Class does not exist Laravel 5.6:未捕获的反射异常:类 env 不存在 - Laravel 5.6: Uncaught ReflectionException: Class env does not exist Laravel错误:未捕获的ReflectionException:类App \\ Http \\ Kernel不存在 - Laravel Error : Uncaught ReflectionException: Class App\Http\Kernel does not exist 未捕获的异常 'ReflectionException' 带有消息 'Class App\\Console\\Kernel does not exist' - Uncaught exception 'ReflectionException' with message 'Class App\Console\Kernel does not exist'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM