VelocityTools error - "java.util.MissingResourceException: Can't find bundle for base name WEB-INF.conf.resources.ss_messages, locale en_US" - apache

I'm trying to integrate VelocityTools.ResourceTool to localize velocity template but whatever I use as the 'bundles' parameter I keep getting the following error:
java.util.MissingResourceException: Can't find bundle for base name
WEB-INF.conf.resources.ss_messages, locale en_US
I'm using VelocityTools v1.4. Here are my configurations:
Tool config /WEB-INF/conf/misc/velocity/toolbox.xml
<tool>
<key>test</key>
<scope>request</scope>
<class>org.apache.velocity.tools.generic.ResourceTool</class>
<parameter name="bundles" value="WEB-INF.conf.resources.ss_messages"/>
<parameter name="locale" value="en_US"/>
</tool>
Bundles:
\WEB-INF\conf\resources\ss_messages_bg_BG.properties
\WEB-INF\conf\resources\ss_messages_en_US.properties
The two files have simple content:
full.name=\u0421\u0442\ (for bg_BG.properties)
full.name=Joe Blow (for en_US.properties)
My Velocity template has this code:
HELLO $test.full.name
I tried different values for the name="bundles" above i.e., /WEB-INF/conf/resources/ss_messages and ./conf/resources/ss_messages (going to the root dir and then referencing the ss_messages bundle).
Also, I tried putting my ss_messages.properties bundle files in a resources folder in the root and use the value="resources" instead, but nothing seems to be working...still getting the same error message.
What am I doing wrong?! Is it that the toolbox.xml file is not in the root? I've been using successfully the toolbox.xml throughout my application up until now.

The resources should be on the classpath, and configured as such.
See the ResourceTool API docs.

Related

Freemarker reference theme.properties in template

I am very new to this and have to migrate an existing web app (that I do not know much about) to Weblogic (12.2.1.4). I had to upgrade the version of struts (2.0.11.2 --> 2.3.1) which also came with a newer version of Freemarker (2.3.8 --> 2.3.18).
The template directory has subdirectories for the different themes.
Under ajax for example I have a file theme.properties containing this line:
parent=xhtml
A head.ftl then contains this include:
<#include "/${parameters.templateDir}/${themeProperties.parent}/head.ftl" />
However this throws the following error in the browser:
The following has evaluated to null or missing:
==> themeProperties.parent [in template "template/ajax/head.ftl" at line 2, column 41]
I believe this was working on the old server.
Is there some new way or syntax to reference the content of that properties file?
It seems like replacing
${themeProperties.parent}
with
${parameters.expandTheme}
seems to work

How to whitelist a vendor-specific API in AOSP for Android 10

I'm trying to add a vendor-specific API to my AOSP code base. I was able to get this working on Android 5 through 9, but cannot figure this out on Android 10.
I read the documentation on the AOSP docs for Implementing Java SDK Library
I have the following blueprint file:
java_sdk_library {
name: "com.mycompany.sdk.myclass",
srcs: ["java/**/*.java"],
api_packages: ["com.mycompany.sdk.myclass"],
}
I generated the api subdirectory using:
build/soong/scripts/gen-java-current-api-files.sh "vendor/mycompany/sdk/myclass" && m update-api
This put all my public method signatures into the current.txt file.
I added this as a boot jar to my top level board.mk file with:
PRODUCT_BOOT_JARS += com.mycompany.sdk.myclass
Building this creates the corresponding com.mycompany.sdk.myclass.xml permissions file:
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<library name="com.mycompany.sdk.myclass"
file="/system/framework/com.mycompany.sdk.myclass.jar"/>
</permissions>
Everything builds and installs fine. I verified the permissions file is in /system/etc/permissions/ and points to the correct jar filename. But I get "Accessing hidden method (blacklist, linking, denied)" exceptions when I run a test app built against my private SDK:
W/test_app: Accessing hidden method Lcom/mycompany/sdk/myclass;->myMethod(Landroid/content/Context;Z)V (blacklist, linking, denied)
I can eliminate this blacklist error by issuing the command:
adb shell settings put global hidden_api_policy 1
So I know my jar is being built and installed correctly. But is just blacklisted for 3rd parties.
I eventually added my package name to frameworks/base/config/hiddenapi-greylist-packages.txt, and suddenly my test app runs, and properly finds the private API. Unfortunately, the blacklist errors are replaced by greylist warnings on every method call. I don't want the log cluttered with these warnings, so it must be whitelisted, not greylisted.
I tried adding it to /build/make/core/tasks/check_boot_jars/package_whitelist.txt, but this made no difference.
How do I whitelist my private API instead of greylist?
There is no white list.
The white list (allow list) is the methods listed in Android SDK.
Private API are not in Android SDK.

How to create an aurelia 1.0 app that can be deployed at any root location

I am trying to work out how to deploy an aurelia app, it runs in development with au run. but I need to deploy it into a path which is not the root of the web-site. ie at '/site' not '/'
when I deploy I get an exception from the router: ERROR [app-router] Error: Route not found: /site/
I think it may be that I need to specify a baseURL in one or more places?
but can't see how I can:
make it work in the development environment at /
make it work in the deployed environment at /[any-site-path]
avoid building in knowledge of '/[any-site-path]' to my development environment or bundles, as the path wont be known until someone comes to deploy the code?
i found this question but that seems to apply to an out of date version of the code.
I am using Aurelia 1.0 and building using the au-cli
Any pointers would be useful.
Looks like this is a bug that has been fixed in a more recent version.
I have just gone through and applied the latest versions of:
"aurelia-bootstrapper": "^1.0.0" -> "^2.1.1"
"aurelia-cli": "^0.24.0" -> "^0.26.1"
"aurelia-tools": "^0.2.2" -> "^1.0.0"
And i can now deploy my application to a site sub folder without specifying any url content in the code or html files!
So I can satisfy all 3 of the criteria in my question.
Note the aurelia-cli update (0.25.0) requires a change to the main.(ts/js) as mentioned in the release notes.

How do I change the default location for mule application log files?

I would like to change the log directory from MULE_HOME/logs to MULE_HOME/logs/apps. The only place I have found that refers to a file path is in MULE_HOME/conf/wrapper.conf. Editing the wrapper.logfile does allow me to relocate the mule_ee.log file, which seems to be the Mule application log, but I'd like to include Mule application logs there, too. If I create an application called FOO and deploy it to the runtime environment, it will create a file called MULE_HOME/logs/mule-app-FOO.log, but changing the location seems to be difficult short of completely messing things up writing custom log4j2 XML files.
If you have Mule version 3.6+, then it is recommended to use log4j2.xml instead of log4j.xml.... Using log4j2 you can change the path and get your application log ... a simple example would be :-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log"> <!-- CustomapplicationName is set at mule-app.properties or in VM argument in Run As Configure as -DCustomapplicationName=Log4j -->
<PatternLayout>
<pattern>%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="120 KB" />
</Policies>
<DefaultRolloverStrategy max="1" />
</RollingFile>
Just put this above code in your log4j2.xml in src/main/resource folder
Here in above you can see that, you have configured your path of your log files by mentioning here:-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log">
where ${sys:CustomapplicationName} is the System variable set in mule-app.properties as following :-
CustomapplicationName=yourApplicationName
Right way is to have log4j properties / xml file for FOO application and have that define the desired path for FOO application log. This way will ensure mule_ee.log is not messed up and at the same time other applications too will have their own log files which will be easy to manage and easy to introspect specific application log in case of errors / exceptions
Define location in log4j.properties file.

Error after publishing .net web project

I am publishing a project in my local computer, I am getting an error because of the path of the files, in my project I am using relative path, but when i published the project I specified a Site/application so I put: localhost/myapp, but then, after the login the additional name myapp make it loses the path references, do you have any idea how to go through this?
I encountered the same problem with my web application this problem occurs because in your application you are hardcoding paths for ex :- /Home/Index or something which creates problems whenever you want to provide paths use helpers like #Url.Action(),#Html.Action(),#Url.Content() as shown below :-
#Url.Action("Index","Home",new{//specify route parameters here//})
If you are using areas in you application then specify it as :-
#Url.Action("Index","Home",new { area="myarea" })