Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JasperException - File Not Found even when tag is present

Tags:

java

jsp

maven

osgi

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

like image 227
Jamie Counsell Avatar asked Oct 25 '17 20:10

Jamie Counsell


1 Answers

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.

like image 128
apothic Avatar answered Oct 19 '22 15:10

apothic