Grails Resources: Image 404, although it exists in WAR

I have 3 Grails 2.x projects. For this example, they are:

ProjectCore    - A Grails plugin containing all reusable code (domains, taglibs, etc)
ProjectWeb     - Front facing web application.  Uses ProjectCore
ProjectAdmin   - Admin appliction.  Uses ProjectCore

Almost all images, js, taglibs, services, etc. located in ProjectCore, and in certain projects only certain applications / views / services / js / css are used.

Everything works fine locally, using NetBeans as my IDE. I launched the ProjectAdmin project and deployed it to my Ubuntu server with Tomcat 6. Everything in the application works as expected, except for 1 image: avatar.png (which is contained in the ProjectCore application).

I use the g: resource tag to create all the links to the image, and all of them are corrected correctly in URL / static / images / some_image_name.png correctly, except for this one image. I also confirmed that the image is present in the war (found in plugins / ProjectCore / images, where all the other images are).

For this particular image, I use taglib (AvatarTagLib) to create a link to this image if the user has not uploaded an avatar for himself. This Taglib is located in ProjectRoot, but is called from other projects. I suppose other images are called from representations in specific projects, so this may be the place where the hangs occur.

, , ( ) tomcat6: tomcat6, , messages.properties SpringSecurityPlugin, , , .

- - , , ?

. , . , http://admin.mydomain.com/images/avatar.png, http://admin.mydomain.com/static/images/avatar.png, 404. .

2. . , .

+5
4

. BuildConfig.groovy runtime ":resources:1.2.RC2"

+4

1.2-RC1.

, 3 png 404 / /static/images. dot.png, calendar.png dotted_vertical.png. (, dotted_vertica.png dotted_vertical1.png), , . .

+1

, .

1) = 2) r: resource?

If you can isolate this from a trivial plugin and application, create jira

0
source

I had the same problem.

I decided to change the resource plugin (runtime ": resources: 1.1.6") to the webxml plugin (compile ": webxml: 1.4.1") in BuildConfig.groovy and now it works.

I hope this works for you too.

0
source

All Articles