How to resolve ConfigurationError error 'Unknown directive' in Plone? - plone

I created new plone site after that I created new product using the following command
../bin/zopeskel plone_basic dummy.work
I created browser folder under ../dummy.work/src/dummy/work .then I configured the browser folder in configure.zcml file as like below.
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="dummy.work">
<five:registerPackage package="." initialize=".initialize" />
<plone:static
directory="browser"
type="work"
name="dummy.work"
/>
<genericsetup:registerProfile
name="default"
title="dummy.work"
directory="profiles/default"
description="Installs the dummy.work package"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
<include package=".browser" />
</configure>
when i try to create an instance i am getting the error like
ConfigurationError: ('Unknown directive', u'http://namespaces.plone.org/plone', u'static')
can any one help me to solve this problem

To use the plone:static directive you must include the meta.zcml.
It's documented in the package documentation at https://pypi.python.org/pypi/plone.resource/
You must do <include package="plone.resource" file="meta.zcml"/> before you can use the plone:static directive.
So: add the line <include package="plone.resource" file="meta.zcml"/> before the usage of plone:static.

Related

Flex 4.5.1 runtime ReferenceError: Error #1065: Variable ... is not defined

Ok, I need some help on this one. I upgraded from Flash Builder 4 to Flash Builder 4.5 and have switched my project to the 4.5.1 sdk. I use an ant script to build my project, so I modified it to use the appropriate flexTasks.jar, mxmlc, etc...
Now, if I start out with a blank bin-debug folder, then build and run the app everything works fine. However, if I then make a code change and build (without deleting the bin-debug) then run the app I get a runtime error:
ReferenceError: Error #1065: Variable ... is not defined.
at flash.display::MovieClip/nextFrame()
at mx.managers::SystemManager/deferredNextFrame()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:284]
at mx.managers::SystemManager/preloader_preloaderDocFrameReadyHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:2633]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\preloaders\Preloader.as:515]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
Again, if I delete the bin-debug folder and compile again it runs with no problems.
The variable it complains about is always a Class variable that points to an image file used as an icon. The code I use to create the var:
[Embed(source="/assets/icons/close-32x32.png")]
public var closeIcon:Class;
The file exists, and I verified that when it gives that error the file is in the bin-debug/assets/icons folder and the src/assets/icons/ folder.
After the error is thrown, if I hit the continue button in Flash Builder it then throws the same error again on the next Class variable pointing to an image file.
Any ideas? The delete/recompile takes several minutes, so obviously this is driving me mad.
Edit: Ant task that compiles in debug mode:
<target name="compile-debug">
<echo>Compile MXML</echo>
<mxmlc
file="${SRC_DIR}/${MAIN_SOURCE_FILE}"
debug="true"
optimize="false"
output="${DEBUG_DIR}/${APP_ROOT_FILE}"
append="true"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
link-report="MyReport.xml"
maxmemory="2048m"
incremental="true">
<!-- Get default compiler options. -->
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
<!-- List of path elements that form the roots of ActionScript class hierarchies. -->
<source-path path-element="${FLEX_HOME}/frameworks"/>
<!-- Include Themes -->
<!-- NOTE: Spark theme required -->
<theme dir="${FLEX_HOME}/frameworks/themes/Spark/">
<include name="spark.css" />
</theme>
<theme dir="${FLEX_HOME}/samples/themes/spark_graphite/">
<include name="spark_graphite.css" />
</theme>
<!-- List of SWC files or directories that contain SWC files. -->
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
<include name="../bundles/{locale}" />
</compiler.library-path>
<!-- uncomment if you have external libs (swc files) -->
<library-path dir="${LIB_DIR}/riaspace/" append="true">
<include name="*.swc" />
</library-path>
<library-path dir="${LIB_DIR}/AlivePDF/" append="true">
<include name="*.swc" />
</library-path>
<library-path dir="${LIB_DIR}/coltware/" append="true">
<include name="*.swc" />
</library-path>
</mxmlc>
</target>
Where FLEX_HOME = < path to flash builder >/sdks/4.5.1
The answer is buried in the middle of Maxim's post that he referenced in a comment above:
--> Try turning off incremental compilation.
I had the same issue here with a simple mimeType='application/octet-stream' embed, and when reading Maxim's text this jumped out because I'd recently changed my custom build tools to use inremental compilation: "Embed sometimes fails during incremental compilation"
The result of this failure is that the .swf contains something like this:
<DefineBinaryData id='1' length='1024' />
which looks like it's empty, instead of this (from the working file):
<DefineBitsLossless2 id='1' encoding='base64'>
(.. in my case, 1024 bytes of base64-encoded data)
</DefineBitsLossless2>
(This solved it for me, so a big thank-you to Maxim. I hope it solves it for you too.)
I had the same problem, so I "Clean"ed the project and then re ran. It worked.
I have Flash Builder 4.7 and am using sdk 4.5.1A.
I was using Flash Player debugger version 15 before Christmas of 2014 and everything was working. I had Firefox set up as the default browser. However, in 2015, Adobe has a new player so I upgraded to version 16 and that's when I got the same problem. After much struggle, I found that the problem had to do with the new version of Firefox Flash player debugger. I had to switch the default browser to Internet Explorer and installed the Internet Explorer Flash player debugger. Prior to debugging, I had to clean and update first. Then everything worked again!

Flex 4 Modules & Ant - Error: Could not resolve "" to a component implementation

I can compile the main application but am having an issue with compiling a nested module.
I have the following application structure:
src
MyApp.mxml
view
MyView.mxml
module
MyModule.mxml
view
AnotherView.mxml
When using the following command
<mxmlc file="${SRC_DIR}/${MODULE_DIR}/MyModule.mxml"
debug="false"
output="${OUTPUT_DIR}/${MODULE_DIR}/MyModule.swf"
locale=""
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
optimize="true"
fork="true"
load-externs="LinkReport.xml"
incremental="false">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.library-path dir="libs" append="true">
<include name="*.swc"/>
</compiler.library-path>
</mxmlc>
I get the following error:
Error: Could not resolve "view:AnotherView" to a component implementation.
I think the compiler might be having an issue with determining which "view" directory has the right mxml file ..
Any Thoughts? A detailed explaination with an example would be most appreciated.
You need to add your src directory as part of the source-path as well. You basically haven't told the compiler where to find your code.

Could not load definitions from resource flexTasks.tasks. It could not be found

I'm attempting to compile a Flex application from an ANT script, inside of Eclipse (CFBuilder, based on Eclipse), and I've run into this error:
Could not load definitions from resource flexTasks.tasks. It could not be found.
I haven't been able to find anything that gives directions on where this file (flexTasks.tasks) should be copied to, if it's needed at all. Some places indicate that it should be part of the flexTasks.jar file. I've tried two different things:
Copy the jar file into the ant/plugins/lib folder (and restart my CF Builder instance)
Specify the path to the jar in the classpath attribute, as suggested by the comment on this page
Neither helps me get past this error.
Here's my build script, for reference:
<project name="Tagging" default="compile-tagging" basedir=".">
<!-- setup flex compilation capability -->
<taskdef resource="flexTasks.tasks" />
<property name="flex.src" value="./src" />
<property name="flex.bin" value="./bin"/>
<target name="compile-tagging">
<mxmlc
file="${flex.src}/main.mxml"
output="${flex.bin}/main.swf"
keep-generated-actionscript="true">
<source-path path-element="${FLEX_HOME}/frameworks" />
</mxmlc>
</target>
</project>
Adam, I believe you need to tell taskdef where to look for the file. try keeping flextasks.jar in the same directory as your ant file (for now... you can move it later after you get it working).
then, you can do something like this:
<taskdef name="mxmlc" classname="WhateverTheTaskIsNamed" classpath="flexTAsks.jar" />
While not ideal, this code is working for me at the moment:
<project name="IOLTagging" default="go" basedir=".">
<!-- setup flex compilation capability -->
<property name="FLEX_HOME" value="C:/program files (x86)/Adobe/Adobe Flash Builder Beta 2/sdks/3.4.1/" />
<taskdef name="mxmlc" classname="flex.ant.MxmlcTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<taskdef name="html-wrapper" classname="flex.ant.HtmlWrapperTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<property name="flex.src" value="./src" />
<property name="flex.bin" value="./bin"/>
<property name="swf.name" value="main" />
<target name="go" depends="compile-flex" />
<target name="compile-flex">
<mxmlc
file="${flex.src}/main.mxml"
output="${flex.bin}/${swf.name}.swf"
debug="false"
keep-generated-actionscript="false">
<source-path path-element="${FLEX_HOME}/frameworks" />
<compiler.library-path dir="${basedir}/libs" append="true">
<include name="*.swc" />
</compiler.library-path>
</mxmlc>
</target>
</project>
I had the same problem, and the reason was in lack of permissions to acces $FLEX_HOME/ant.
You can also put the flexTasks.jar in ~/.ant/lib directory
If you run ant -diagnostics you should see the jar in USER_HOME/.ant/lib jar listing
I think you should have solved this problem. just trying flexmonkey today and also got the same problem.
"Could not load definitions from resource flexTasks.tasks. It could not be found."
solution is to make sure the flexTasks.jar is included in the dir lib of your project workplace.
when I copied flexTasks.jar from flashbuild folder \ant\lib and built it again. the problem is fixed.

How do I make my Ant Generated swf as small as possible?

I have a flex project and if I build a release version of the application using flash builder with RSLs on my swf is 115k. If however I build the same application using ant the swf is 342k. Without RSLs the swf is 520k.
How do I get the swf to be as small as the one built by FlashBuilder?
Here is my ant file I have another task that copies the rsls.
<project name="EUI Client Application" default="compileClientApp">
<target name="compileClientApp" depends="compileClientBundles">
<mxmlc
file="${CLIENT_PROJECT.dir}/src/${CLIENT_PROJECT.app}.mxml"
output="${DEPLOY.dir}/${CLIENT_PROJECT.app}.swf"
keep-generated-actionscript="false"
actionscript-file-encoding="UTF-8"
incremental="false"
>
<runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/framework.swc">
<url rsl-url="flex4_4.0.0.7791.swf"/>
<url rsl-url="framework_4.0.0.7791.swf"/>
<url rsl-url="framework_textLayout_4.0.0.7791.swf"/>
<url rsl-url="rpc_4.0.0.7791.swf"/>
<url rsl-url="textLayout_451.swf"/>
</runtime-shared-library-path>
<source-path path-element="${CLIENT_PROJECT.dir}/src" />
<compiler.library-path dir="${LIBS.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
<compiler.library-path dir="${DEPLOY_BIN.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
</mxmlc>
</target>
<target name="generateWrapper">
<html-wrapper
title="${CLIENT_APP_TITLE}"
file="${CLIENT_PROJECT.app}.html"
height="100%" width="100%"
bgcolor="white" application="app"
swf="${CLIENT_PROJECT.app}"
version-major="10" version-minor="0" version-revision="0"
history="true" output="${DEPLOY.dir}" />
</target>
<target name="compileClientBundles">
<compileBundle bundleName="Modules" source="${CORE_PROJECT.dir}/locale" />
</target>
Thanks for the replies guys but it wasn't either of those.
turns out all I needed to do was to remove the runtime-shared-library-path stuff as this is already in the flex-config.xml file. I also had to change the static-link-runtime-shared-libraries to false (so it's dynamic).
I've copied the flex-config.xml file into my build directory and use that so I can safely make changes.
This is with Flex 4 BTW - nto sure if I made that very clear.
my ant file now looks like this:
<project name="EUI Client Application" default="compileClientApp">
<target name="compileClientApp" depends="compileClientBundles">
<mxmlc
file="${CLIENT_PROJECT.dir}/src/${CLIENT_PROJECT.app}.mxml"
output="${DEPLOY.dir}/${CLIENT_PROJECT.app}.swf"
keep-generated-actionscript="false"
actionscript-file-encoding="UTF-8"
optimize="true" incremental="false"
link-report="${DEPLOY_BIN.dir}/app_link_report.xml"
>
<load-config filename="${basedir}/flex-config.xml" />
<define name="CONFIG::stub" value="false" />
<define name="CONFIG::release" value="true" />
<source-path path-element="${CLIENT_PROJECT.dir}/src" />
<compiler.library-path dir="${LIBS.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
<compiler.library-path dir="${DEPLOY_BIN.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
</mxmlc>
</target>
<target name="generateWrapper">
<html-wrapper
title="${CLIENT_APP_TITLE}"
file="${CLIENT_PROJECT.app}.html"
height="100%" width="100%"
bgcolor="white" application="app"
swf="${CLIENT_PROJECT.app}"
version-major="10" version-minor="0" version-revision="0"
history="true" output="${DEPLOY.dir}" />
</target>
<target name="compileClientBundles">
<compileBundle bundleName="Modules" source="${CORE_PROJECT.dir}/locale" />
</target>
You'll probably need to specify the paths to the external libs using the -external-library-path option.
See the docs for more info.
To use RSLs when compiling your application, you use the following application compiler options:
* runtime-shared-libraries Provides the run-time location of the shared library.
* external-library-path|externs|load-externs Provides the compile-time location of the libraries. The compiler requires this for dynamic linking.
Use the runtime-shared-libraries option to specify the location of the SWF file that the application loads as an RSL at run time. You specify the location of the SWF file relative to the deployment location of the application. For example, if you store the library.swf file in the web_root/libraries directory on the web server, and the application in the web root, you specify libraries/library.swf.
You can specify one or more libraries with this option. If you specify more than one library, separate each library with a comma.
Use the external-library-path option to specify the location of the library's SWC file or open directory that the application references at compile time. The compiler provides compile-time link checking by using the library specified by this option. You can also use the externs or load-externs options to specify individual classes or an XML file that defines the contents of the library.
The following command-line example compiles the MyApp application that uses two libraries:
mxmlc -runtime-shared-libraries=
../libraries/CustomCellRenderer/library.swf,
../libraries/CustomDataGrid/library.swf
-external-library-path=../libraries/CustomCellRenderer,
../libraries/CustomDataGrid MyApp.mxml
The order of the libraries is significant because the base classes must be loaded before the classes that use them.
You can also use a configuration file, as the following example shows:
../libraries/CustomCellRenderer
../libraries/CustomDataGrid
../libs/playerglobal.swc
../libraries/CustomCellRenderer/library.swf
../libraries/CustomDataGrid/library.swf
The runtime-shared-libraries option is the relative location of the library.swf files when the application has been deployed. The external-library-path option is the location of the SWC file or open directory at compile time. Because of this, you must know the deployment locations of the libraries relative to the application when you compile it. You do not have to know the deployment structure when you create the library, because you use the compc command-line compiler to create a SWC file.
Try separating your RSLs into their own arguments. Here's what how I have it on my build:
<runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/framework.swc">
<url rsl-url="${rsl.url}/framework_3.2.0.3958.swz" />
<url rsl-url="${rsl.url}/framework_3.2.0.3958.swf" />
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${FLEX_HOME}/frameworks/libs/datavisualization.swc">
<url rsl-url="${rsl.url}/datavisualization_3.2.0.3958.swz" />
<url rsl-url="${rsl.url}/datavisualization_3.2.0.3958.swf" />
</runtime-shared-library-path>
Using RSL, remember to set use-network parameter to true, otherwise the compiled swf will complain security error (can't load RSL) when run in different location.

Using ant, does anyone know how to build a SWF made up of SWCs (that you've built) that include resource bundles?

I'm trying to write an ant build script to build my group's flex app, and I've run into some roadblocks that I'm hoping someone on SO has seen before.
We have two projects that we build into SWCs and these components contain resource bundles. One SWC requires the other SWC. We have one project that we build into our application (the SWF) which uses both SWCs.
When I build the SWCs, I get no complaints about resource bundles not being found, and when I open the SWCs in winzip, I can see the bundles (in /locale/EN_US, for example)
When I build the SWF, however, I get complaints about not being able to find the resource bundles in the two swc's, but no complaints about not being able to find any other resource bundles (like the flex framework ones).
This is the kind of message I get from ant:
[mxmlc] Error: Unable to resolve resource bundle "whatever" for locale "en_US".
[mxmlc]
Surely, I am not the first person to hit this gotcha, so does anyone know what the problem is here?
Am I building the SWCs wrong, or the SWF?
For reference, here's one of my build tasks using compc (for some reason, I can't get the opening target tag to show up)
<path id="facet.sourcePath">
<pathelement location="${flex.facet.src}"/>
</path>
<property name="facet.sourcePath" refid="facet.sourcePath"/>
<echo message="sourcePath is ${facet.sourcePath}"/>
<fileset dir="${facet.sourcePath}" id="facet.sources">
<include name="**/*.as"/>
</fileset>
<pathconvert property="facet.classes" pathsep=" " refid="facet.sources">
<compositemapper>
<chainedmapper>
<globmapper from="*.as" to="*"/>
<globmapper from="${facet.sourcePath}\*" to="*" handledirsep="true" />
</chainedmapper>
<chainedmapper>
<globmapper from="*.mxml" to="*"/>
<globmapper from="${facet.sourcePath}\*" to="*" handledirsep="true" />
</chainedmapper>
</compositemapper>
</pathconvert>
<echo message="classes: ${facet.classes}"/>
<compc output="${flex.lib.output}/${facet.swc.name}" locale="EN_US"
include-classes="${facet.classes}" directory="false"
target-player="10.0.0"
>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<include-resource-bundles bundle="foo"/>
<include-resource-bundles bundle="bar"/>
<include-resource-bundles bundle="whatever"/>
<sp path-element="${flex.facet.dir}/locale/{locale}"/>
<keep-as3-metadata name="Bindable"/>
<keep-as3-metadata name="Remotable"/>
<keep-as3-metadata name="Embed"/>
<keep-as3-metadata name="Event"/>
<keep-as3-metadata name="ResourceBundle"/>
<source-path path-element="${flex.facet.src}"/>
<compiler.library-path append="true" dir="${flex.framework.lib}">
<include name="*.swc"/>
<include name="../locale/${locale}"/>
</compiler.library-path>
<compiler.library-path append="true" dir="${flex.rsm.lib}">
<include name="*.swc"/>
</compiler.library-path>
</compc>
</target>
and here's my mxmlc task:
<target name="flex.webapp.compile" description="compiles your flex app">
<mxmlc file="${flex.webapp.src}\RSM.mxml"
output="${flex.webapp.deploy}\ant_test\RSM.swf"
use-network="true"
keep-generated-actionscript="true"
debug="true"
locale="en_US"
incremental="true"
actionscript-file-encoding="utf-8"
target-player="10.0.0"
>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<include-resource-bundles bundle="RSM"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<source-path path-element="${flex.webapp.src}" />
<source-path path-element="${flex.webapp.dir}/locale/en_US" />
<source-path path-element="${flex.rsm.lib}" />
<sp path-element="${flex.core.dir}/locale/{locale}"/>
<sp path-element="${flex.facet.dir}/locale/{locale}" />
<compiler.library-path append="true" dir="${flex.framework.lib}">
<include name="*.swc"/>
<!--include name="../locale/${locale}"/-->
</compiler.library-path>
<compiler.library-path append="true" dir="${flex.rsm.lib}">
<include name="*.swc"/>
<include name="../locale/${locale}" />
<!--include name="rsm_rb.swc" /-->
</compiler.library-path>
</mxmlc>
</target>
Arrgh!
After many hours of staring at this problem, I realized that the issue was looking me in the face the whole time.
The compc task is using 'locale="EN_US"' and the mxmlc task is using 'locale="en_US"'.
If anyone ever posts a "what's the stupidest work problem you've ever had?", this would be my answer.
btw it doesnt have to be that complicated (even in linux console!), all you need is to include libs...
daemonna#NES-KOS-29:~/Desktop/FlexUnit4Turnkey_4.0_sdk_4.0.fxp_FILES/src$ mxmlc -library-path=../libs -locale=en_US App.mxml
Loading configuration file /home/daemonna/Frameworks/flex_sdk_4.1.0.16076/frameworks/flex-config.xml
Error: Unable to resolve resource bundle "components" for locale "en_US".
....bla bla bla...
Error: Unable to resolve resource bundle "controls" for locale "en_US".
daemonna#NES-KOS-29:~/Desktop/FlexUnit4Turnkey_4.0_sdk_4.0.fxp_FILES/src$ mxmlc -library-path=../libs -library-**path=/home/daemonna/Frameworks/flex_sdk_4.1.0.16076/frameworks/locale/en_US/** -locale=en_US App.mxml
Loading configuration file /home/daemonna/Frameworks/flex_sdk_4.1.0.16076/frameworks/flex-config.xml
/home/daemonna/Desktop/FlexUnit4Turnkey_4.0_sdk_4.0.fxp_FILES/src/App.swf (37964 bytes)

Resources