Jamie Counsell
Jamie Counsell

Reputation: 8113

JasperException - File Not Found even when tag is present

Alright StackOverflow, I'm coming to you in a time of need.

I've inherited a project with a custom tag library. The project is in AEM, but the problem is more of an issue with the straight Java side of things and is nothing specific to AEM that I am aware of. AEM is built on OSGI, so that could be related, but again it's sort of unlikely to be part of the answer.

Essentially, I'm getting an exception on only one of two servers. It says:

org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: File "/META-INF/tags/helloWorld.tagx" not found

Now - this helloWorld.tagx is sort of garbage left in from a template project, but for some reason it's essential. There's a few issues here.

  1. The tag is in the right location (META-INF/tags/helloWorld.tagx) and I'm using the jsptld-maven-plugin to generate the tld file which looks correct to me.

The configuration for the plugin (as well as the maven-bundle-plugin):

        <plugin>
            <groupId>com.squeakysand.jsp</groupId>
            <artifactId>jsptld-maven-plugin</artifactId>
            <configuration>
                <shortName>myproject</shortName>
                <processTagFiles>true</processTagFiles>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Bundle-Activator>com.rebny.taglib.osgi.Activator</Bundle-Activator>
                    <Include-Resource>
                        META-INF/${project.artifactId}-${project.version}.tld=${project.build.outputDirectory}/META-INF/${project.artifactId}-${project.version}.tld,
                        {maven-resources}
                    </Include-Resource>
                    <Sling-Bundle-Resources>
                        /META-INF/tags
                    </Sling-Bundle-Resources>
                </instructions>
            </configuration>
        </plugin> 

And the segment from the resulting tld file:

<tag-file>
    <name>helloWorld</name>
    <path>/META-INF/tags/helloWorld.tagx</path>
</tag-file>

So it looks fine to me, and I've done a lot of searching and found people with syntax errors, etc. but I don't believe that to be the case here, especially since it works on one server.

  1. The weird part is the tag isn't actually used anywhere, but removing it doesn't solve the issue. The jsp throwing this error uses other tags, but not this one. There is literally no references to this tag in the entire project - I'm thinking it might be hiding another issue. The error says that it's on line 6 of the JSP, but neither the source JSP or the compiled JSP have anything interesting on line 6, or in the file at all. Again, even compiled JSPs have no reference to this tag!

I'm happy to provide other information. My knowledge of this is pretty poor, so I'm not exactly sure what information is relevant. Any help or troubleshooting tips is greatly appreciated!

Full stack trace here

Upvotes: 11

Views: 1031

Answers (2)

apothic
apothic

Reputation: 345

Your best bet is to go through Adobe Daycare. They are pretty good about getting you patches. Especially if your client has an existing relationship with them which they should if they are using AEM.

Upvotes: 1

Rohit Gaikwad
Rohit Gaikwad

Reputation: 3914

The issue relates to Scripted tag files are not found. Reference.

It's a bug that states, If a taglib in a bundle, references a tag implemented as a script (located in /META-INF/tags) this script is not found as it is not searched within the bundle containing the tld. It's rather used as a resource on the classpath.

The bug has been Fixed in JSP 2.3.2 version. So make use of this JSP version in your project. Moreover, this bug would have been fixed in AEM 6.3.1.1 Or higher,

Here, Is a helpful thread related to this issue.

Upvotes: 0

Related Questions