JSF : java.util.MissingResourceException: Can't find bundle for base : Only if context root is changed - primefaces

I have read a lot of threads with the MissingResourceException problem.
I'm using Primefaces 5.1.3
In my case I have the error :
java.util.MissingResourceException: Can't find bundle for base [...], locale
In face-config.xml :
<message-bundle>message.erreur.MsgErreurPrimefaces</message-bundle>
And in my sources :
The war is packed in an EAR. It works fine when I keep the default context root but if I change the context root, I get the message.
The file is present in the war's WEB-INF folder under :
WEB-INF/classes/message/erreur/MsgErreurPrimefaces_fr_FR.properties
Thanks

I have encountered this kind of error before and my problem has been corrected by editing as below. First of all, I would recommend you to add and test the MsgErreurPrimefaces.properties file.
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-bundle>
<base-name>message.erreur.MsgErreurPrimefaces</base-name>
<var>myBundle</var>
</resource-bundle>
</application>
<application>
<message-bundle>message.erreur.MsgErreurPrimefaces</message-bundle>
<locale-config>
<default-locale>fr_FR</default-locale>
<supported-locale>fr_FR</supported-locale>
<supported-locale>en_US</supported-locale>
</locale-config>
</application>
</faces-config>

Related

How to configure manager app to work with JNDI ream?

I want to make the manager app to work with LDAP, at the moment i have managed to make manager app to work with the realm org.apache.catalina.realm.MemoryRealm but i need to make it work with this realm org.apache.catalina.realm.JNDIRealm. I have set the realm in the context.xml file like this:
<Realm resourceName="nalytics-web-ldap-realm" allRolesMode="authOnly"
className="org.apache.catalina.realm.MemoryRealm" connectionName="uid=admin,ou=system"
connectionPassword="myPassword" connectionURL="ldap://localhost:10389"
debug="99" userBase="ou=product,o=company,dc=com" userRoleName="memberOf"
userSearch="cn={0}" userSubtree="true" />
and my tomcat-users.xml is:
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="deployer" password="deployer" roles="manager-gui,manager-script"/>
</tomcat-users>
Finally my manager.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>
What settings/configurations do i need to do in order to make manager app to work with realm org.apache.catalina.realm.JNDIRealm? After researching i found that i have to create role names in LDAP and put there the username and then change the WEB-INF/web.xml of the manager to match the new role names but i am not sure as i haven't done something similar before.
Anyone who has achieved to make the manager app to work with LDAP it would be very helpful to share what they did.

how to run extensions in the magento

i am a novice person to magento.I installed magneto 1.9.2.4 version.I need to create the extension for magento.I learned about the file structure of creating extension but cannot know how to run.Can anyone specify how to run the extension?
Advance Thanks!
/var/www/html/magento/app/code/local/Multidots/HelloWorld/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Multidots_HelloWorld>
<version>0.1.0</version>
</Multidots_HelloWorld>
</modules>
<frontend>
<routers>
<helloworld>
<use>standard</use>
<args>
<module>Multidots_HelloWorld</module>
<frontName>helloworld</frontName>
</args>
</helloworld>
</routers>
</frontend>
<admin>
<routers>
<helloworld>
<use>admin</use>
<args>
<module>Multidots_HelloWorld</module>
<frontName>admin_helloworld</frontName>
</args>
</helloworld>
</routers>
</admin>
</config>
/var/www/html/magento/app/etc/modules/Multidots_HelloWorld.xml
<?xml version="1.0"?>
<config>
<modules>
<Multidots_HelloWorld>
<active>true</active>
<codePool>local</codePool>
</Multidots_HelloWorld>
</modules>
</config>
/var/www/html/magento/app/code/local/Multidots/HelloWorld/controllers/IndexController.php
<?php
class Multidots_HelloWorld_IndexController extends Mage_Core_Controller_Front_Action{
public function indexAction() {
echo "Huhh...., I knew you can do it!!!n";
echo "Let's do it in proper way, you konow... ;) :D :P";
}
}
?>
i run this code using http://localhost/magento/helloworld also http://localhost/magento/index.php/helloworld but i got error
Whoops, our bad...
The page you requested was not found, and we have a fine guess why.
If you typed the URL directly, please make sure the spelling is correct.
If you clicked on a link to get here, the link is outdated.
What can you do?
Have no fear, help is near! There are many ways you can get back on track with Magento Store.
Go back to the previous page.
Use the search bar at the top of the page to search for your products.
Follow these links to get you back on track!
Store Home | My Account
can anyone suggest how to run?
I think you are asking for creating extension from scratch right?
Please check this link for creating simple extension.
http://inchoo.net/magento/programming-magento/magento-hello-world-module-extension/
And for run that extension please reload the front or backend of the Magento.
Thanks

CAstle Windsor: How to reference a second xml config file that is an embedded resource?

We have one xml configuration file that we use in production. We also have a little test app that has a couple of additional needs. What I'd like to do is create a second, testing-only xml config file that references the embedded production configuration file. Is there any way to do this?
I'm aware of the "include" element, but am not sure where in the file it is supposed to be placed--in the castle node? The components node?
I feel like the answer is here but I'm too dense to figure it out.
Thanks for any help you can provide.
UPDATE
This is how our production config file is set up:
<?xml version="1.0" encoding="utf-8"?>
<OurCompany>
<Framework>
<castle>
<installers>
<!-- some installers-->
<installers>
<components>
<!--some components-->
<components>
<castle>
<Framework>
<OurCompany>
My most recent attempt at a non-production config file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<OurCompany>
<Framework>
<castle>
<include uri="assembly://AssemblyContainingEmbeddedXml/MyEmbeddedConfig.xml" />
<components>
<!--components I only want registered with container when running in non-production environment-->
<components>
<castle>
<Framework>
<OurCompany>
The exception I get reads:
Configuration parser encountered Framework, but it was expecting to find installers, facilities or components. There might be either a typo on or you might have forgotten to nest it properly.
(In the actual message, "Framework," "installers," "facilities," and "components" are enclosed in angle brackets.)
The bottom of the page you reference has an example of loading from an embedded resourced:
IResource resource = new AssemblyResource("assembly://Acme.Crm.Data/Configuration/services.xml");
container = new WindsorContainer(new XmlInterpreter(resource));

resource file not regenerating when rebuilding (hello world tutorial)

I downloaded monodriod yesterday and was following the hello world tutorial, and came across a problem in monodevelop with resources i couldnt figure out.
When i changed the names of the two string resources in String.xml, the partial String class in Resource.designer.cs wouldnt update when i rebuild the solution. I tried building cleaning restarting the solution, but nothing worked. I then tried removing the partial String class hoping that might force itself to regenerate, but no luck that just brought a compile error.
\HelloM4A\HelloM4A\Resources\layout\main.axml(0,0): Error: No resource found that matches
the given name (at 'text' with value '#string/hello'). (HelloM4A)
can anybody give me a pointer to what i have been doing wrong.
thanks
tut:
http://docs.xamarin.com/android/getting_started/hello_world
It seems that you have not updated main.axml to use the new string name:
Use: #string/<SOME_NEW_NAME_HERE>
Main.axml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout ... >
<Button ...
android:text="#string/<SOME_NEW_NAME_HERE>" />
</LinearLayout>
Strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name="<SOME_NEW_NAME_HERE>">Hello Mono for Android</string>
</resources>

When you import another msbuild file, what is the order of evaluation?

I have a shared properties file shared.properties.proj
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SharedAssemblySearch>$(MSBuildProjectDirectory)\..\Shared Assemblies</SharedAssemblySearch>
<ParentDir>..</ParentDir>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblyPath Condition="Exists('$(SharedAssemblySearch)')">$(SharedAssemblySearch)</SharedAssemblyPath>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">..\SharedAssemblies</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch>
<SharedAssemblyPath Condition="Exists('$(SharedAssemblySearch)')">$(SharedAssemblySearch)</SharedAssemblyPath>
</PropertyGroup>
</project>
I am searching for whatever level parent directory contains the directory named Shared Assemblies. or alternatively SharedAssemblies
I'd like to put this code in a central location for the sln, so that all the projects can just import it. projects in the sln are not all at the same hierarchy level.
Sample .csproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Shared.Properties.proj))\Shared.Properties.proj"
Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Shared.Properties.proj))' != '' "/>
<ItemGroup>
<Reference Include="EntityFramework">
<HintPath>$(SharedAssemblyPath)\NuGet\EntityFramework.4.3.0\lib\net40\EntityFramework.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="CheckReferencePaths" BeforeTargets="ResolveAssemblyReferences">
<Message Importance="high" Text="Doing CheckReferencePaths" />
<ItemGroup>
<SharedAssemblyPathItem Include="$(SharedAssemblyPath)" />
</ItemGroup>
<Warning Condition="!Exists('#(SharedAssemblyPathItem)')" Text="SharedAssemblyPath not found at '#(SharedAssemblyPathItem)'" />
<Warning Condition="!Exists('#(SharedAssemblyPathItem)')" Text="SharedAssemblyPath not found at '#(SharedAssemblyPathItem->'%(FullPath)')'" />
<Message Condition="!Exists('%(Reference.HintPath)')" Text="FullPath=%(Reference.HintPath)" Importance="high" />
I have this working in the main project without pushing the property group out to a satellite file that I import, but now want to make it reusable between other projects that could have shared references.
The BeforeTargets target shows this on the new attempt that is not working:
CheckReferencePaths:
Doing CheckReferencePaths
D:\projects\Team\Project\Adapters\DbAdapter\dbadapter.csproj(103,5):
warning : SharedAssemblyPath not found at ''
D:\projects\Team\Project\Adapters\DbAdapter\dbadapter.csproj(104,5):
warning : SharedAssemblyPath not found at ''
FullPath=\NuGet\EntityFramework.4.3.0\lib\net40\EntityFramework.dll
FullPath=
How can I get the project file that imports the shared to evaluate the imported project's properties before it evaluates the item groups' hintpaths. Or is the evaluation order proper, but something else in my construction is incorrect?
Your question lead me to find this valuable info on MSDN. I'm posting it here for keeping the answer self-contained.
Order of Evaluation
When MSBuild reaches an Import element, the imported project is effectively inserted into the importing project at the location of the Import element. Therefore, the location of the Import element can affect the values of properties and items. It is important to understand the properties and items that are set by the imported project, and the properties and items that the imported project uses.
When the project builds, all properties are evaluated first, followed by items. For example, the following XML defines the imported project file MyCommon.targets:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Name>MyCommon</Name>
</PropertyGroup>
<Target Name="Go">
<Message Text="Name='$(Name)'"/>
</Target>
</Project>
The following XML defines MyApp.proj, which imports MyCommon.targets:
<Project
DefaultTargets="Go"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Name>MyApp</Name>
</PropertyGroup>
<Import Project="MyCommon.targets"/>
</Project>
When the project builds, the following message is displayed:
Name="MyCommon"
Because the project is imported after the property Name has been defined in MyApp.proj, the definition of Name in MyCommon.targets overrides the definition in MyApp.proj. If, the project is imported before the property Name is defined, the build would display the following message:
Name="MyApp"
Use the following approach when importing projects
Define, in the project file, all properties and items that are used
as parameters for properties and items in the imported project.
Import the project.
Define in the project file all properties and items that must
override default definitions of properties and items in the imported
project.
Example
The following code example shows the MyCommon.targets file that the second code example imports. The .targets file evaluates properties from the importing project to configure the build.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Flavor Condition="'$(Flavor)'==''">DEBUG</Flavor>
<Optimize Condition="'$(Flavor)'=='RETAIL'">yes</Optimize>
<appname>$(MSBuildProjectName)</appname>
<PropertyGroup>
<Target Name="Build">
<Csc Sources="hello.cs"
Optimize="$(Optimize)"
OutputAssembly="$(appname).exe"/>
</Target>
</Project>
The following code example imports the MyCommon.targets file.
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Flavor>RETAIL</Flavor>
</PropertyGroup>
<Import Project="MyCommon.targets"/>
</Project>
Try to use inline task instead of shared.properties.proj file. Check my answer on this question. It was about searching for some file is the parent directories. You can adapt it to search for a parent directory.