grails : deployement error on tomcat ( resources not found ) - css

I have a grails application.
I make a war with 'grails war' then I deploy it on Tomcat.
I have the following errors :
ERROR resources.ResourceMeta: Resource not found: /js/application.js
ERROR resources.ResourceMeta: Resource not found: /js/bootstrap.min.js
ERROR resources.ResourceMeta: Resource not found: /css/bootstrap.min.css
I unzip my war file and I have the following :
fjLearning.war :
css/
main__v1385391634036.css
main__v1385391634036.gz.css
..
js/
jquery-1.8.3.min__v1385391634036.js
...
...
I tried to access to the full path of the resource :
mysite.com/fjLearning/static/js/application__v1385389616024.js
, and it's OK.
But, if I try to access to mysite.com/fjLearning/static/js/application.js, it doesn't work.
To check that the problem comes from files names, I change manually all of them.
Then, I deploy again my war file and it works !
So do you know where does theses files names come from ?
PS :
I suspect ui-performance plugin so I will check if I use it correctly ...
My configuration :
This project is on GitHub : https://github.com/drieu/fjLearning
Grails : 2.3.3
Tomcat : apache-tomcat-7.0.47
Comment : I can run this application with grail run-app without problem.
Buildconfig.groovy :
plugins {
runtime ":hibernate:3.6.10.4"
runtime ":jquery:1.8.3"
runtime ":resources:1.2"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0"
//runtime ":cached-resources:1.0"
//runtime ":yui-minify-resources:0.1.5"
//build ":tomcat:$grailsVersion"
build ":tomcat:7.0.47"
runtime ":database-migration:1.3.2"
compile ':cache:1.0.1'
}
Config.groovy :
modules = {
application {
resource url:'js/application.js'
}
bootstrap {
resource url:'js/bootstrap.min.js'
resource url:'css/bootstrap.min.css'
resource url:'css/main.css'
dependsOn 'jquery'
}
}

Related

How to exclude server module from web module in Razzle

There is a library that is being used only when the application is running on the server.
isBrowser() ? console.log('broser') : require('datadog-node-utils/logging');
the module datadog-node-utils should be bundle on the server, but not in the static vendor.
In my razzle config, I tried to exclude this library.
if (target === 'web') {
config.module.rules.push.exclude = [/\datadog-node-utils/, /\winston/];
...
But no luck.
The library is always present on the bundle :(

How to override the "public" directory?

I've renamed my public directory into www so as the documentation says I've added some line in composer.json file:
"extra": {
"...": "...",
"public-dir": "www"
}
Then I ran composer update.
But it seems not to work.
I have this error :
An exception has been thrown during the rendering of a template ("Asset manifest file "*******/public/build/manifest.json" does not exist.").
So I've added in config/packages/dev/framework.yaml (I'm on dev):
framework:
assets:
json_manifest_path: '%kernel.project_dir%/www/build/manifest.json'
But another error has appeared:
An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "*******/public/build/entrypoints.json" does not exist.").
Then I modify webpack.config.js file like this :
Encore
// directory where compiled assets will be stored
.setOutputPath('www/build/')
But the error is still there.
Is there a simple way to rename the public directory?
I've fixed my issue :
In config/packages/webpack_encore.yaml :
webpack_encore:
# The path where Encore is building the assets.
# This should match Encore.setOutputPath() in webpack.config.js.
output_path: '%kernel.project_dir%/www/build'

"Error: Could not find or load main class" when building a Corda fat-jar client

Trying to execute a Corda "fat jar" RPC client that I've built, but it always fails with this error:
Error: Could not find or load main class,
I have confirmed that MANIFEST.MF contains the correct Main-Class attribute, and that this class is included inside the jar.
The relevant part of my build.gradle is:
jar {
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Executing the jar using java -jar myjar.jar always produces this error:
Error: Could not find or load main class
I have posted this question only for reference because some Corda developers have run into this. The problem with creating a "fat jar" as described above is that some Corda jar artifacts are signed, and so contain extra entries like:
META-INF/CORDACOD.SF
META-INF/CORDACOD.EC
These entries don't apply to the "fat jar" and so if you include them into the "fat jar" then the JVM will reject its classes as invalid when you try to execute it.
The best way to create a "fat jar" in Corda is by using a Gradle plugin like shadow. However, if you must do this work by hand then you should alter your jar task accordingly:
jar {
from(configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.EC"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
exclude "META-INF/INDEX.LIST"
}
}

Tap-i18n is not enabled in the project level, check tap-i18n README

Trying to implement TAP-i18n in a Meteor-1.7 app. I have installed it, and have followed the setup as detailed on the page. The i18n JSON files are in startup/both/i18n/en and fr directory thus:
{
"headers" : {
"appheader" : "OLTega",
"home" : "Home"
}
}
Template implementation:
<template name="header">
{{_ 'headers.home'}}
</template>
I kept on getting this error:
Exception in defer callback: Error: No such function: _
at blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3214
at Spacebars.call (spacebars.js?hash=547cf8e466d1d52603d19bd5f48fb5df184fd237:172)
at Spacebars.mustacheImpl (spacebars.js?hash=547cf8e466d1d52603d19bd5f48fb5df184fd237:106)
at Object.Spacebars.mustache (spacebars.js?hash=547cf8e466d1d52603d19bd5f48fb5df184fd237:110)
at Blaze.View._render (app.js?hash=af2511f3e4a636f030d9ecbfdc553bf9ad12b1a6:400)
at Blaze.View.doRender (blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2086)
at blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1934
at Function.Template._withTemplateInstanceFunc (blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3744)
at blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1932
at Object.Blaze._withCurrentView (blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2271)
detectlang.js:16 tap-i18n is not enabled in the project level, check tap-i18n README
I have checked the README.md and donot understand this statement:
tap-i18n can be used to internationalize projects and packages, but its behavior is determined by whether or not it's installed on the project level. We call these two work modes: enabled and disabled.
It is installed, and shows in the packages file. What am I to do to get it working?

Why is my jar not loading?

I am using the Jsoup jar file in my Coldfusion application. I was originally storing it in a local lib folder, but for security purposes we decided to store it in the cfroot lib folder. I uploaded the jar to the /lib folder in root, and added this code to Application.cfc:
this.javaSettings = {
loadPaths: [
"./lib/"
],
loadColdFusionClassPath: true
};
However, my code (that was working before) now generates the following error:
ERROR
Object Instantiation Exception.
Class not found: org.jsoup.JsoupObject Instantiation Exception.
...
It seems the code is not finding/loading the jar file. How can I point the code towards the Jsoup jar file stored in root?
Try backslash instead of forward-slash,
this.javaSettings = {
loadPaths: [
".\lib\"
],
loadColdFusionClassPath: true
};

Resources