Symfony2 problems with assets - symfony
I recently began to add new features on a website that uses Symfony2.
After creating a new bundle that is very similar to the others already working, I created a button to access to the feature.
But then I got the following errors in my browser's developer tool:
GET prod.project.local/bundles/calinobase/css//calino-main-colors.css prod.project.local/:35
GET prod.project.local/bundles/calinobase/css//main-colors.css prod.project.local/:28
GET prod.project.local/bundles/calinobase/css//bootstrap-override-colors.css prod.project.local/:27
GET prod.project.local/bundles/calinobase/css//buttons-colors.css prod.project.local/:29
GET prod.project.local/bundles/calinobase/css//menus-colors.css prod.project.local/:33
GET prod.project.local/bundles/calinobase/css//forms-colors.css prod.project.local/:32
GET prod.project.local/bundles/calinobase/css//content-colors.css prod.project.local/:30
GET prod.project.local/bundles/calinobase/css//mag-colors.css prod.project.local/:31
GET prod.project.local/bundles/calinobase/css//search-colors.css prod.project.local/:34
Plus an error 500 on my page.
After some researches I found that it came from the stylesheets.html.twig file:
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/bootstrap-override-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/main-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/buttons-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/content-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/mag-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/forms-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/menus-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/search-colors.css') }}" type="text/css" media="screen" />
<link rel="stylesheet" href="{{ asset('bundles/calinobase/css/' ~ colorTheme ~ '/calino-main-colors.css') }}" type="text/css" media="screen" />
Apparently it doesn't find the colorTheme, which is set in the layout.html.twig when it uses the stylesheet:
{% block stylesheets %}
{{ include('::stylesheets.html.twig', {colorTheme: app.user.color|default('bfc100')}, with_context = false) }}
{% endblock %}
In my logs I have the following errors:
[2015-01-21 15:22:42] request.INFO: Matched route "calinobase_homepage" (parameters: "_controller": "Calino\BaseBundle\Controller\DefaultController::indexAction", "_route": "calinobase_homepage") [] []
[2015-01-21 15:22:43] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2015-01-21 15:22:43] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\TableNotFoundException: "An exception occurred while executing 'SELECT a0_.id AS id0, a0_.creaDate AS creaDate1, a0_.editDate AS editDate2, a0_.title AS title3, a0_.slug AS slug4, a0_.intro AS intro5, a0_.content AS content6, a0_.alaune AS alaune7, a0_.published AS published8, a0_.thread_id AS thread_id9, a0_.articleTheme_id AS articleTheme_id10, a0_.avatar_id AS avatar_id11 FROM article_mag a0_ WHERE a0_.alaune = 1 ORDER BY a0_.creaDate DESC LIMIT 1': SQLSTATE[42S02]: Base table or view not found: 1146 Table 'calinofriendsdb.article_mag' doesn't exist" at /var/www/prod.project.local/htdocs/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 53 {"exception":"[object] (Doctrine\\DBAL\\Exception\\TableNotFoundException(code: 0): An exception occurred while executing 'SELECT a0_.id AS id0, a0_.creaDate AS creaDate1, a0_.editDate AS editDate2, a0_.title AS title3, a0_.slug AS slug4, a0_.intro AS intro5, a0_.content AS content6, a0_.alaune AS alaune7, a0_.published AS published8, a0_.thread_id AS thread_id9, a0_.articleTheme_id AS articleTheme_id10, a0_.avatar_id AS avatar_id11 FROM article_mag a0_ WHERE a0_.alaune = 1 ORDER BY a0_.creaDate DESC LIMIT 1':\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table 'calinofriendsdb.article_mag' doesn't exist at /var/www/prod.project.local/htdocs/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:53, Doctrine\\DBAL\\Driver\\PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'calinofriendsdb.article_mag' doesn't exist at /var/www/prod.project.local/htdocs/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:106, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'calinofriendsdb.article_mag' doesn't exist at /var/www/prod.project.local/htdocs/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:104)"} []
[2015-01-21 15:22:43] security.DEBUG: Write SecurityContext in the session [] []
[2015-01-21 15:22:43] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//forms-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//forms-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:43] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//main-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//main-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:43] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//bootstrap-override-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//bootstrap-override-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:43] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//content-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//content-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:43] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//buttons-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//buttons-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:43] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//mag-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//mag-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:44] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//search-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//search-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:44] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//calino-main-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//calino-main-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
[2015-01-21 15:22:44] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /bundles/calinobase/css//menus-colors.css" (from "http://prod.project.local/")" at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php line 3098 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /bundles/calinobase/css//menus-colors.css\" (from \"http://prod.project.local/\") at /var/www/prod.project.local/htdocs/current/app/cache/prod/classes.php:3098, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /var/www/prod.project.local/htdocs/current/app/cache/prod/appProdUrlMatcher.php:1498)"} []
I develop with PhpStorm so when I mouseover "calinobase" in my stylesheets.html.twig, it displays "Missing assets" so I tried to use php app/console assets:install --verbose but I got:
Installing assets as hard copies.
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
[Symfony\Component\Filesystem\Exception\IOException]
Failed to remove file "web/bundles/framework/images/blue_picto_more.gif".
Exception trace:
() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:173
Symfony\Component\Filesystem\Filesystem->remove() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:160
Symfony\Component\Filesystem\Filesystem->remove() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:160
Symfony\Component\Filesystem\Filesystem->remove() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php:98
Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand->execute() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:253
Symfony\Component\Console\Command\Command->run() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:882
Symfony\Component\Console\Application->doRunCommand() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/kemps/dev2/calinofriends/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at /home/kemps/dev2/calinofriends/app/console:22
assets:install [--symlink] [--relative] [target]
Not knowing what to do to handle thoses errors, I will be glad to have any help. Thanks in advance to anyone who will help me.
EDIT: my Symfony project is on a virtual machine installed with Vagrant, configured with Puppetmaster and it has NFS shared folders
Failed to remove file "web/bundles/framework/images/blue_picto_more.gif".
there is something wrong with your permissions,
if the blue_picto_more.gif was uploaded from the website that means the permissions are set to the webserver account.
usually "nginx or www-data".
if you are only using this site locally or your development server you can just set the web folder to 777 (don't do this on production though).
use this on the command line:
chmod -R 777 /pathto/web
this one is production-friendly:
change the permissions to the account you're logging into from the console
chown -R the_user web
Related
How to check if an encrypted variable is decrypted?
I have an Ansible encrypted variable. Now I'd like to be able to run my playbook even when I don't unlock the variable (with --ask-vault-pass) and just skip the tasks that depend on it. Ideally with a warning saying that the task was skipped. Now when I run my playbook without --ask-vault-pass, it fails with an error: fatal: [...]: FAILED! => {"changed": false, "msg": "AnsibleError: An unhandled exception occurred while templating '{{ (samba_passwords | string | from_yaml)[samba_username] }}'. Error was a <class 'ansible.parsing.vault.AnsibleVaultError'>, original message: Attempting to decrypt bu t no vault secrets found"} Is there a way how to check in the when: clause that an encrypted variable is not decrypted and thus inaccessible?
Q: "Check if an encrypted variable is decrypted. Skip the tasks that depend on it. Ideally with a warning saying that the task was skipped." A: For example, given the file with the variable shell> cat vars-test.yml test_var1: test var1 Encrypt the file shell> ansible-vault encrypt vars-test.yml New Vault password: Confirm New Vault password: Encryption successful shell> cat vars-test.yml $ANSIBLE_VAULT;1.1;AES256 61373230346437306135303463393166323063656561623863306333313837666561653466393835 3738666532303836376139613766343930346263633032330a323336643061373039613330653237 30666364376266396633613162626536383161306262613062373239343232663935376364383431 6335623366613834360a336531656537626662376166323766376433653232633139383636613963 64356632633863353534323636313231633866613635343962383463636565303032 Then the playbook shell> cat pb.yml - hosts: test_01 tasks: - include_vars: vars-test.yml ignore_errors: true - set_fact: test_var1: "{{ test_var1|default('default') }}" - name: Execute tasks if test_var1 was decrypted block: - debug: msg: Execute task1 - debug: msg: Execute task2 when: test_var1 != 'default' gives (abridged) shell> ansible-playbook pb.yml --ask-vault-pass TASK [include_vars] **** ok: [test_01] TASK [set_fact] **** ok: [test_01] TASK [debug] **** ok: [test_01] => msg: Execute task1 TASK [debug] **** ok: [test_01] => msg: Execute task2 If you don't provide the command with the password the playbook gives (abridged) shell> ansible-playbook pb.yml PLAY [test_01] **** TASK [include_vars] **** fatal: [test_01]: FAILED! => changed=false ansible_facts: {} ansible_included_var_files: [] message: Attempting to decrypt but no vault secrets found ...ignoring TASK [set_fact] **** ok: [test_01] TASK [debug] **** skipping: [test_01] TASK [debug] **** skipping: [test_01]
I've researched but I haven't found anything to do that. The easy way to solve this case would be used ignore_errors: yes in the task.
W3 Total Cache: minified CSS and JS files not found in AWS S3-based CDN
My configuration consists of a Wordpress installation with the W3 Total Cache plugin that is set up to cache resources on a CDN (Amazon S3+Cloudfront). The HTML resources and images are loaded correctly, but the problem is with minified CSS and JS, as they were renamed by the plugin (e.g. style.css renamed to 18704.css). The problem might be in how I write the URI in the site's HTML code, where the original style.css is referred to, instead of the generated filename: <link rel='stylesheet' id='wptheme-style-css' href='https://<distribution_id>.cloudfront.net/wp-content/themes/wptheme/style.css.gzip?ver=1.0.1' type='text/css' media='all' /> Cloudfront configuration: Two origins added example-com.s3.amazonaws.com and example.com S3 configuration: Bucket policy: . { "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::bucketname/*" } ] } The files stored inside S3 bucket have the correct MIME type, although some may be missing CORS policy: . <?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration> Browser console: wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < (index):96 Uncaught ReferenceError: jQuery is not defined at (index):96 (anonymous) # (index):96 www.example.com/:199 Uncaught ReferenceError: jQuery is not defined at (index):199 (anonymous) # (index):199 www.example.com/:1353 Uncaught ReferenceError: jQuery is not defined at (index):1353 (anonymous) # (index):1353 wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < twitter-widgets.js.gzip Failed to load resource: the server responded with a status of 403 () wp-signup.php:1 Uncaught SyntaxError: Unexpected token < wp-signup.php:1 Uncaught SyntaxError: Unexpected token < Chrome's network console: The actual minified and compressed CSS and JS files in the S3 bucket:
After setting mediation in WSO2 API Manager 1.10, I have figured out null point exception and missing credential error. What I have to do?
I'm using WSO2 APIManager 1.10. I'd like to call api request using mediation like this. <sequence name="loadbalancer_bycompany" trace="disable" xmlns="http://ws.apache.org/ns/synapse"> <property expression="get-property('transport', 'company')" name="company" scope="default" type="STRING"/> <property name="POST_TO_URI" scope="axis2" type="STRING" value="true"/> <switch source="$trp:company"> <case regex="sds"> <send> <endpoint> <address trace="disable" uri="https://70.30.182.167:8243/calc/1.0/"/> </endpoint> </send> </case> <case regex="etc"> <send> <endpoint> <address trace="disable" uri="https://70.30.182.167:9443/calc/1.0/"/> </endpoint> </send> </case> <default> <send> <endpoint> <address trace="disable" uri="https://70.30.182.167:9443/carbon/"/> </endpoint> </send> </default> </switch> </sequence> So,I tried to set mediator and then i called api. But, I got sometimes error response that is code 900902 missing credential, sometimes got right response. At that time, I found logs like this. TID: [-1234] [] [2017-02-03 10:45:10,728] INFO {org.apache.synapse.mediators.builtin.LogMediator} - STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back {org.apache.synapse.mediators.builtin.LogMediator} TID: [-1234] [] [2017-02-03 10:45:10,735] ERROR {org.apache.synapse.transport.passthru.PassThroughHttpSSLSender} - Failed to submit the response {org.apache.synapse.transport.passthru.PassThroughHttpSSLSender} java.lang.NullPointerException at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64) at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:493) at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:108) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155) at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:86) at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102) at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:108) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:534) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:251) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) TID: [-1234] [] [2017-02-03 10:45:10,738] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><am:fault xmlns:am="http://wso2.org/apimanager"><am:code>0</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back</am:description></am:fault></soapenv:Body></soapenv:Envelope> Unexpected error sending message back {org.apache.synapse.core.axis2.Axis2Sender} org.apache.axis2.AxisFault: Failed to submit the response at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:610) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:269) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:493) at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:108) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155) at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:86) at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102) at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:108) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:534) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:251) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64) at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267) ... 18 more TID: [-1234] [] [2017-02-03 10:45:10,740] ERROR {org.apache.axis2.transport.base.threads.NativeWorkerPool} - Uncaught exception {org.apache.axis2.transport.base.threads.NativeWorkerPool} java.lang.RuntimeException: org.apache.synapse.SynapseException: Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><am:fault xmlns:am="http://wso2.org/apimanager"><am:code>0</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back</am:description></am:fault></soapenv:Body></soapenv:Envelope> Unexpected error sending message back at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:110) at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:108) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:534) at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:251) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.synapse.SynapseException: Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><am:fault xmlns:am="http://wso2.org/apimanager"><am:code>0</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>Access-Control-Allow-Headers:authorization,Access-Control-Allow-Origin,Content-Type,company,Access-Control-Allow-Methods:GET,Access-Control-Allow-Origin:*,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back</am:description></am:fault></soapenv:Body></soapenv:Envelope> Unexpected error sending message back at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:247) at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:215) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:493) at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:108) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:155) at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:86) at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102) ... 9 more Caused by: org.apache.axis2.AxisFault: Failed to submit the response at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:610) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:269) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212) ... 16 more Caused by: java.lang.NullPointerException at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64) at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462) at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267) ... 18 more TID: [-1234] [] [2017-02-03 10:45:59,370] INFO {org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler} - Stat is not enabled {org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler} TID: [-1234] [] [2017-02-03 10:45:59,374] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /calc/1.0/subtract?x=3&y=1, MessageID: urn:uuid:8f4000dc-b878-4d5f-b310-f0129f2db0a3, Direction: request, INFO = https://70.30.182.167:8243/calc/1.0/, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator} TID: [-1234] [] [2017-02-03 10:45:59,390] INFO {org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler} - Stat is not enabled {org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler} TID: [-1234] [] [2017-02-03 10:45:59,395] WARN {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} - API authentication failure due to Missing Credentials {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} I found this logs repeatedly, so I i made an effort to fix it. First of all, to remove this error, NullPointerException SourceResponseFactory.create(SourceResponseFactory.java:64) I figured out code issue in PassThroughHttpSender.java that didn't handle with null case for sourceRequest. And then I found that issue was fixed wso2-synapse ESBJAVA-3770 Message size based filtering to prevent OOM. (#679) https://github.com/wso2/wso2-synapse/commit/1aff92c4bad968f78cf38577cbb7c01516475217 So, I added that code into our codes. And then NullPointException was disappeared. And then I tried to remove missing credential error. So I found this link. Authorization Bearer in URL Request using WSO2 API Manager And I tried to set configure like below link. https://docs.wso2.com/display/AM1100/Writing+Custom+Handlers And then Missing credential error was removed. And then result is right response. But I found below log infinitely TID: [-1234] [] [2017-02-08 13:20:12,563] WARN {org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler} - No authentication context information found on the request - Throttling not applied {org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler} I tried to debug SourceHandler and TargetHandler. and I think connection was created infinitely and wasn't closed all. I don't know what to do anymore. So please let me know what I have to do.
Please go through the sample implementation provided in docs. Based on the APIThrottleHandler implementation, this warning message would appear if you haven't set the user context within your custom Auth handler. Please check how the default "OAuthAuthenticator" has been written and how the AuthenticationContext getting initialized. You need to do a similar implementation to your custom handler if need to work with throttling.
What does alert(document.cookie) in logs tell you?
I see log below in my symfony project sometimes and I cannot find out from where I get this log and how to reproduce it: request.CRITICAL: Uncaught PHP Exception UnexpectedValueException: "Invalid Host "<img src="" onerror="alert(document.cookie)">"" at /app/bootstrap.php.cache line 933 {"exception":"[object] (UnexpectedValueException(code: 0): Invalid Host \"<img src=\"\" onerror=\"alert(document.cookie)\">\" at /app/bootstrap.php.cache:933, UnexpectedValueException(code: 0): Invalid Host \"<img src=\"\" onerror=\"alert(document.cookie)\">\" at /app/bootstrap.php.cache:933)"} [] request.CRITICAL: Exception thrown when handling an exception (UnexpectedValueException: Invalid Host "<img src="" onerror="alert(document.cookie)">" at /app/bootstrap.php.cache line 933) {"exception":"[object] (UnexpectedValueException(code: 0): Invalid Host \"<img src=\"\" onerror=\"alert(document.cookie)\">\" at /app/bootstrap.php.cache:933)"} [] How can I reproduce this log? and is it something I should be worry about?
Symfony Sylius Install Fails
I am trying to install Sylius following https://github.com/Sylius/Sylius or http://sylius.org/get-started but no way, all times I get an error in the terminal : >php app/console sylius:install Installing Sylius... Step 1 of 4. Checking system requirements. +-------------------------------+----------------------------------------------- ----------------------+ | Issue | Recommendation | +-------------------------------+----------------------------------------------- ----------------------+ | short_open_tag | | | session.auto_start | | | sylius.extensions.accelerator | Install and enable a PHP accelerator like APC (highly recommended). | +-------------------------------+----------------------------------------------- ----------------------+ Success! Your system can run Sylius properly. Step 2 of 4. Setting up the database. Creating Sylius database for environment dev. The command terminated with an error code: 1. [Exception] The command terminated with an error code: 1. and here is few lines of my log : [2015-07-21 17:51:59] php.DEBUG: "Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead. {"type":16384,"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Helper\HelperSet.php","line":86,"level":4352} [] [2015-07-21 17:51:59] event.DEBUG: Notified event "console.terminate" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onTerminate". [] [] [2015-07-21 17:51:59] event.DEBUG: Notified event "console.command" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure". [] [] [2015-07-21 17:52:00] doctrine.DEBUG: SHOW DATABASES [] [] [2015-07-21 17:52:00] php.DEBUG: "Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead. {"type":16384,"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Helper\HelperSet.php","line":84,"level":4352} [] [2015-07-21 17:52:00] event.DEBUG: Notified event "console.command" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure". [] [] [2015-07-21 17:52:00] event.DEBUG: Notified event "console.terminate" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onTerminate". [] [] [2015-07-21 17:52:00] event.DEBUG: Notified event "console.terminate" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onTerminate". [] [] [2015-07-21 17:52:00] event.DEBUG: Notified event "console.terminate" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onTerminate". [] [] [2015-07-21 17:52:00] php.CRITICAL: Uncaught Exception: The command terminated with an error code: 1. {"type":1,"file":"E:\_projects\symfony\sylius-standard\vendor\sylius\sylius\src\Sylius\Bundle\InstallerBundle\Command\CommandExecutor.php","line":81,"level":16383,"stack":[{"file":"E:\_projects\symfony\sylius-standard\vendor\sylius\sylius\src\Sylius\Bundle\InstallerBundle\Command\AbstractInstallCommand.php","line":122,"function":"runCommand","class":"Sylius\Bundle\InstallerBundle\Command\CommandExecutor","type":"->","args":["doctrine:database:create",[]]},{"file":"E:\_projects\symfony\sylius-standard\vendor\sylius\sylius\src\Sylius\Bundle\InstallerBundle\Command\InstallDatabaseCommand.php","line":50,"function":"runCommands","class":"Sylius\Bundle\InstallerBundle\Command\AbstractInstallCommand","type":"->","args":[["doctrine:database:create","doctrine:schema:create","cache:clear","doctrine:phpcr:repository:init"],"object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php","line":259,"function":"execute","class":"Sylius\Bundle\InstallerBundle\Command\InstallDatabaseCommand","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php","line":886,"function":"run","class":"Symfony\Component\Console\Command\Command","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php","line":195,"function":"doRunCommand","class":"Symfony\Component\Console\Application","type":"->","args":["object","object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php","line":96,"function":"doRun","class":"Symfony\Component\Console\Application","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php","line":126,"function":"doRun","class":"Symfony\Bundle\FrameworkBundle\Console\Application","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\sylius\sylius\src\Sylius\Bundle\InstallerBundle\Command\CommandExecutor.php","line":74,"function":"run","class":"Symfony\Component\Console\Application","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\sylius\sylius\src\Sylius\Bundle\InstallerBundle\Command\InstallCommand.php","line":48,"function":"runCommand","class":"Sylius\Bundle\InstallerBundle\Command\CommandExecutor","type":"->","args":["sylius:install:database",[],"object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php","line":259,"function":"execute","class":"Sylius\Bundle\InstallerBundle\Command\InstallCommand","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php","line":886,"function":"run","class":"Symfony\Component\Console\Command\Command","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php","line":195,"function":"doRunCommand","class":"Symfony\Component\Console\Application","type":"->","args":["object","object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php","line":96,"function":"doRun","class":"Symfony\Component\Console\Application","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php","line":126,"function":"doRun","class":"Symfony\Bundle\FrameworkBundle\Console\Application","type":"->","args":["object","object"]},{"file":"E:\_projects\symfony\sylius-standard\app\console","line":17,"function":"run","class":"Symfony\Component\Console\Application","type":"->","args":["object"]}]} [] Does anybody can tell me what I am doing wrong or missing please ? ----------- Edit Well I remove my pre created db, created trought terminal, db creation works well : >php app/console doctrine:database:create Created database for connection named `sylius` But then I get different errors in terminal now : Step 2 of 4. Setting up the database. Creating Sylius database for environment dev. The command terminated with an error code: 1. PHP Fatal error: Uncaught exception 'Exception' with message 'The command termi nated with an error code: 1.' in E:\_projects\symfony\sylius\src\Sylius\Bundle\I nstallerBundle\Command\CommandExecutor.php:81 Stack trace: #0 E:\_projects\symfony\sylius\src\Sylius\Bundle\InstallerBundle\Command\Abstrac tInstallCommand.php(122): Sylius\Bundle\InstallerBundle\Command\CommandExecutor- >runCommand('doctrine:databa...', Array) #1 E:\_projects\symfony\sylius\src\Sylius\Bundle\InstallerBundle\Command\Install DatabaseCommand.php(50): Sylius\Bundle\InstallerBundle\Command\AbstractInstallCo mmand->runCommands(Array, Object(Symfony\Component\Console\Input\ArrayInput), Ob ject(Symfony\Component\Console\Output\ConsoleOutput)) #2 E:\_projects\symfony\sylius\vendor\symfony\symfony\src\Symfony\Component\Cons ole\Command\Command.php(245): Sylius\Bundle\InstallerBundle\Command\InstallDatab aseCommand->execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(S ymfony\Component\Console\Output\ConsoleOutput)) #3 E:\_projects\symfony\sylius\vendor\sy in E:\_projects\symfony\sylius\src\Syli us\Bundle\InstallerBundle\Command\CommandExecutor.php on line 81 Fatal error: Uncaught exception 'Exception' with message 'The command terminated with an error code: 1.' in E:\_projects\symfony\sylius\src\Sylius\Bundle\Instal lerBundle\Command\CommandExecutor.php on line 81 Exception: The command terminated with an error code: 1. in E:\_projects\symfony \sylius\src\Sylius\Bundle\InstallerBundle\Command\CommandExecutor.php on line 81 Call Stack: 0.0000 124368 1. {main}() E:\_projects\symfony\sylius\app\console:0 0.1250 2980672 2. Symfony\Component\Console\Application->run() E:\_proj ects\symfony\sylius\app\console:26