【发布时间】:2015-10-11 13:04:07
【问题描述】:
在将我的应用程序投入生产时,我不得不通过 FTP 传输 JMS 序列化程序,因为我无法在生产服务器上使用 composer。
成功了,我在供应商那里看到了。
我的 AppKernel 与本地相同(在生产环境和开发环境中都经过测试):
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new Hager\TransformationBundle\TransformationBundle(),
new JMS\SerializerBundle\JMSSerializerBundle()
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
但我收到了一个非常奇怪的消息
AppKernel.php 第 22 行中的 ClassNotFoundException: 尝试从命名空间“JMS\SerializerBundle”加载类“JMSSerializerBundle”。 您是否忘记了另一个命名空间的“使用”语句?
由于控制台在生产服务器上也不可用,我做了rm -RF /app/cache/*,但仍然出现错误。
帮助很受欢迎。
【问题讨论】:
-
看起来类加载器没有加载 JMSSerializer 类。您是否在生产中更新了 composer.json 和 composer.lock 文件,或者您只是将 jms 序列化程序上传到供应商文件夹?
-
他说他不能在生产服务器中使用composer
-
我不能在生产中使用作曲家,所以是的,我只是在供应商文件夹中通过 ftp 上传它。