0

while putting my app in production, i had to FTP-transfer the JMS Serializer as i can't use composer on the production server.

It worked, i see it in the vendor.

My AppKernel is the same as in local (where it works, as tested in both production and dev environment) :

<?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');
}
}

but i recieve a very strange

ClassNotFoundException in AppKernel.php line 22: Attempted to load class "JMSSerializerBundle" from namespace "JMS\SerializerBundle". Did you forget a "use" statement for another namespace?

As the console isn't available on production server either, i did rm -RF /app/cache/* but still got the error.

Help very wlecome.

3
  • Looks like class loader is not loading JMSSerializer classes. Did you update composer.json and composer.lock files in production or you just uploaded jms serializer to vendor folder? Commented Oct 11, 2015 at 13:13
  • he said he cannot use composer in production server Commented Oct 11, 2015 at 13:16
  • i cant use composer in production so yes, i just ftp-uploaded it in the vendor folder. Commented Oct 11, 2015 at 13:17

3 Answers 3

1

Also upload the vendor/composer directory again.

and upload your web directory too since there might be new assets.

Then go to app/cache and delete everything inside.

Another approach:

download and install the CoreSphere ConsoleBundle

add your ip address in app_dev.php:

if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '100.200.300.400')) || php_sapi_name() === 'cli-server')
)

(replace 100.200.300.400 for your own ip) and upload this file to the server . Then visit your website in app_dev.php/_console and you can execute your console commands from there.

Sign up to request clarification or add additional context in comments.

Comments

1

You said you cannot run Composer in your prod server (why?!). In that case, even if you copy your JMS Serializer files to the vendor dir, they will not be autoloaded by the autoloader that composer generates. You will need to edit the autoload_namespaces.php file in your vendor/composer dir and add this line:

'JMS\\SerializerBundle' => array ($vendorDir . '/jms/serializer-bundle'),

Comments

0

DO not rename or replace Comoser.lock andcomposer.json files. Installnew project symfony new project and replace folders from broken project to new one : app,src,web.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.